xref: /haiku/headers/os/package/hpkg/HPKGDefs.h (revision 6f0278cdc9a22a1e22c3ac3f480beffd6bb5fcff)
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 
175fb1c6ffSOliver Tappe // magic, version
185fb1c6ffSOliver Tappe enum {
195fb1c6ffSOliver Tappe 	B_HPKG_MAGIC	= 'hpkg',
205fb1c6ffSOliver Tappe 	B_HPKG_VERSION	= 1
215fb1c6ffSOliver Tappe };
225fb1c6ffSOliver Tappe 
235fb1c6ffSOliver Tappe 
245fb1c6ffSOliver Tappe // attribute types
255fb1c6ffSOliver Tappe enum {
265fb1c6ffSOliver Tappe 	// types
275fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_TYPE_INVALID			= 0,
285fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_TYPE_INT				= 1,
295fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_TYPE_UINT				= 2,
305fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_TYPE_STRING			= 3,
31*6f0278cdSOliver Tappe 	B_HPKG_ATTRIBUTE_TYPE_RAW				= 4,
32*6f0278cdSOliver Tappe 	//
33*6f0278cdSOliver Tappe 	B_HPKG_ATTRIBUTE_TYPE_ENUM_COUNT
345fb1c6ffSOliver Tappe };
355fb1c6ffSOliver Tappe 
365fb1c6ffSOliver Tappe 
375fb1c6ffSOliver Tappe // attribute encodings
385fb1c6ffSOliver Tappe enum {
395fb1c6ffSOliver Tappe 	// signed/unsigned int encodings
405fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_INT_8_BIT		= 0,
415fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_INT_16_BIT	= 1,
425fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_INT_32_BIT	= 2,
435fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_INT_64_BIT	= 3,
445fb1c6ffSOliver Tappe 
455fb1c6ffSOliver Tappe 	// string encodings
465fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_STRING_INLINE	= 0,
475fb1c6ffSOliver Tappe 		// null-terminated string
485fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_STRING_TABLE	= 1,
495fb1c6ffSOliver Tappe 		// unsigned LEB128 index into string table
505fb1c6ffSOliver Tappe 
515fb1c6ffSOliver Tappe 	// raw data encodings
525fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_RAW_INLINE	= 0,
535fb1c6ffSOliver Tappe 		// unsigned LEB128 size, raw bytes
545fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_RAW_HEAP		= 1
555fb1c6ffSOliver Tappe 		// unsigned LEB128 size, unsigned LEB128 offset into the heap
565fb1c6ffSOliver Tappe };
575fb1c6ffSOliver Tappe 
585fb1c6ffSOliver Tappe 
595fb1c6ffSOliver Tappe // maximum number of bytes of data to be encoded inline; more will be allocated
605fb1c6ffSOliver Tappe // on the heap
615fb1c6ffSOliver Tappe #define B_HPKG_MAX_INLINE_DATA_SIZE	8
625fb1c6ffSOliver Tappe 
635fb1c6ffSOliver Tappe 
645fb1c6ffSOliver Tappe // name of file containing package information (in package's root folder)
655fb1c6ffSOliver Tappe #define B_HPKG_PACKAGE_INFO_FILE_NAME	".PackageInfo"
665fb1c6ffSOliver Tappe 
675fb1c6ffSOliver Tappe 
68*6f0278cdSOliver Tappe // package attribute IDs
69*6f0278cdSOliver Tappe enum BPackageAttributeID {
70*6f0278cdSOliver Tappe 	B_PACKAGE_ATTRIBUTE_NAME = 0,
71*6f0278cdSOliver Tappe 	B_PACKAGE_ATTRIBUTE_SUMMARY,
72*6f0278cdSOliver Tappe 	B_PACKAGE_ATTRIBUTE_DESCRIPTION,
73*6f0278cdSOliver Tappe 	B_PACKAGE_ATTRIBUTE_VENDOR,
74*6f0278cdSOliver Tappe 	B_PACKAGE_ATTRIBUTE_PACKAGER,
75*6f0278cdSOliver Tappe 	B_PACKAGE_ATTRIBUTE_ARCHITECTURE,
76*6f0278cdSOliver Tappe 	B_PACKAGE_ATTRIBUTE_VERSION_MAJOR,
77*6f0278cdSOliver Tappe 	B_PACKAGE_ATTRIBUTE_VERSION_MINOR,
78*6f0278cdSOliver Tappe 	B_PACKAGE_ATTRIBUTE_VERSION_MICRO,
79*6f0278cdSOliver Tappe 	B_PACKAGE_ATTRIBUTE_VERSION_RELEASE,
80*6f0278cdSOliver Tappe 	B_PACKAGE_ATTRIBUTE_COPYRIGHT,
81*6f0278cdSOliver Tappe 	B_PACKAGE_ATTRIBUTE_LICENSE,
82*6f0278cdSOliver Tappe 	B_PACKAGE_ATTRIBUTE_PROVIDES,
83*6f0278cdSOliver Tappe 	B_PACKAGE_ATTRIBUTE_PROVIDES_TYPE,
84*6f0278cdSOliver Tappe 	B_PACKAGE_ATTRIBUTE_REQUIRES,
85*6f0278cdSOliver Tappe 	B_PACKAGE_ATTRIBUTE_SUPPLEMENTS,
86*6f0278cdSOliver Tappe 	B_PACKAGE_ATTRIBUTE_CONFLICTS,
87*6f0278cdSOliver Tappe 	B_PACKAGE_ATTRIBUTE_FRESHENS,
88*6f0278cdSOliver Tappe 	B_PACKAGE_ATTRIBUTE_REPLACES,
89*6f0278cdSOliver Tappe 	B_PACKAGE_ATTRIBUTE_RESOLVABLE_OPERATOR,
90*6f0278cdSOliver Tappe 	//
91*6f0278cdSOliver Tappe 	B_PACKAGE_ATTRIBUTE_ENUM_COUNT,
92*6f0278cdSOliver Tappe };
93*6f0278cdSOliver Tappe 
94*6f0278cdSOliver Tappe 
95*6f0278cdSOliver Tappe // TODO: make this accessible via a function
965fb1c6ffSOliver Tappe // default values
975fb1c6ffSOliver Tappe enum {
985fb1c6ffSOliver Tappe 	B_HPKG_DEFAULT_DATA_CHUNK_SIZE_ZLIB		= 64 * 1024
995fb1c6ffSOliver Tappe };
1005fb1c6ffSOliver Tappe 
1015fb1c6ffSOliver Tappe 
1025fb1c6ffSOliver Tappe }	// namespace BHPKG
1035fb1c6ffSOliver Tappe 
1045fb1c6ffSOliver Tappe }	// namespace BPackageKit
1055fb1c6ffSOliver Tappe 
1065fb1c6ffSOliver Tappe 
1075fb1c6ffSOliver Tappe #endif	// _PACKAGE__HPKG__HPKG_DEFS_H_
108