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