xref: /haiku/headers/os/package/hpkg/HPKGDefs.h (revision 5fb1c6ff1f55fe4094a761b653041b3a0b9abf1d)
1*5fb1c6ffSOliver Tappe /*
2*5fb1c6ffSOliver Tappe  * Copyright 2011, Haiku, Inc.
3*5fb1c6ffSOliver Tappe  * Distributed under the terms of the MIT License.
4*5fb1c6ffSOliver Tappe  */
5*5fb1c6ffSOliver Tappe #ifndef _PACKAGE__HPKG__HPKG_DEFS_H_
6*5fb1c6ffSOliver Tappe #define _PACKAGE__HPKG__HPKG_DEFS_H_
7*5fb1c6ffSOliver Tappe 
8*5fb1c6ffSOliver Tappe 
9*5fb1c6ffSOliver Tappe #include <SupportDefs.h>
10*5fb1c6ffSOliver Tappe 
11*5fb1c6ffSOliver Tappe 
12*5fb1c6ffSOliver Tappe namespace BPackageKit {
13*5fb1c6ffSOliver Tappe 
14*5fb1c6ffSOliver Tappe namespace BHPKG {
15*5fb1c6ffSOliver Tappe 
16*5fb1c6ffSOliver Tappe 
17*5fb1c6ffSOliver Tappe // magic, version
18*5fb1c6ffSOliver Tappe enum {
19*5fb1c6ffSOliver Tappe 	B_HPKG_MAGIC	= 'hpkg',
20*5fb1c6ffSOliver Tappe 	B_HPKG_VERSION	= 1
21*5fb1c6ffSOliver Tappe };
22*5fb1c6ffSOliver Tappe 
23*5fb1c6ffSOliver Tappe 
24*5fb1c6ffSOliver Tappe // attribute types
25*5fb1c6ffSOliver Tappe enum {
26*5fb1c6ffSOliver Tappe 	// types
27*5fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_TYPE_INVALID			= 0,
28*5fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_TYPE_INT				= 1,
29*5fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_TYPE_UINT				= 2,
30*5fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_TYPE_STRING			= 3,
31*5fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_TYPE_RAW				= 4
32*5fb1c6ffSOliver Tappe };
33*5fb1c6ffSOliver Tappe 
34*5fb1c6ffSOliver Tappe 
35*5fb1c6ffSOliver Tappe // attribute encodings
36*5fb1c6ffSOliver Tappe enum {
37*5fb1c6ffSOliver Tappe 	// signed/unsigned int encodings
38*5fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_INT_8_BIT		= 0,
39*5fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_INT_16_BIT	= 1,
40*5fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_INT_32_BIT	= 2,
41*5fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_INT_64_BIT	= 3,
42*5fb1c6ffSOliver Tappe 
43*5fb1c6ffSOliver Tappe 	// string encodings
44*5fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_STRING_INLINE	= 0,
45*5fb1c6ffSOliver Tappe 		// null-terminated string
46*5fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_STRING_TABLE	= 1,
47*5fb1c6ffSOliver Tappe 		// unsigned LEB128 index into string table
48*5fb1c6ffSOliver Tappe 
49*5fb1c6ffSOliver Tappe 	// raw data encodings
50*5fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_RAW_INLINE	= 0,
51*5fb1c6ffSOliver Tappe 		// unsigned LEB128 size, raw bytes
52*5fb1c6ffSOliver Tappe 	B_HPKG_ATTRIBUTE_ENCODING_RAW_HEAP		= 1
53*5fb1c6ffSOliver Tappe 		// unsigned LEB128 size, unsigned LEB128 offset into the heap
54*5fb1c6ffSOliver Tappe };
55*5fb1c6ffSOliver Tappe 
56*5fb1c6ffSOliver Tappe 
57*5fb1c6ffSOliver Tappe // maximum number of bytes of data to be encoded inline; more will be allocated
58*5fb1c6ffSOliver Tappe // on the heap
59*5fb1c6ffSOliver Tappe #define B_HPKG_MAX_INLINE_DATA_SIZE	8
60*5fb1c6ffSOliver Tappe 
61*5fb1c6ffSOliver Tappe 
62*5fb1c6ffSOliver Tappe // name of file containing package information (in package's root folder)
63*5fb1c6ffSOliver Tappe #define B_HPKG_PACKAGE_INFO_FILE_NAME	".PackageInfo"
64*5fb1c6ffSOliver Tappe 
65*5fb1c6ffSOliver Tappe 
66*5fb1c6ffSOliver Tappe // default values
67*5fb1c6ffSOliver Tappe enum {
68*5fb1c6ffSOliver Tappe 	B_HPKG_DEFAULT_DATA_CHUNK_SIZE_ZLIB		= 64 * 1024
69*5fb1c6ffSOliver Tappe };
70*5fb1c6ffSOliver Tappe 
71*5fb1c6ffSOliver Tappe 
72*5fb1c6ffSOliver Tappe }	// namespace BHPKG
73*5fb1c6ffSOliver Tappe 
74*5fb1c6ffSOliver Tappe }	// namespace BPackageKit
75*5fb1c6ffSOliver Tappe 
76*5fb1c6ffSOliver Tappe 
77*5fb1c6ffSOliver Tappe #endif	// _PACKAGE__HPKG__HPKG_DEFS_H_
78