haiku/headers/os/package/hpkg/HPKGDefs.h
Oliver Tappe aaf05784d4 * some rearrangements and renames with respect to public/private
types and defines of HPKG
* added header, magic and version for haiku repository format

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40370 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-02-07 13:04:00 +00:00

130 lines
2.9 KiB
C++

/*
* Copyright 2009,2011, Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _PACKAGE__HPKG__HPKG_DEFS_H_
#define _PACKAGE__HPKG__HPKG_DEFS_H_
#include <SupportDefs.h>
namespace BPackageKit {
namespace BHPKG {
// magic & version of package and repository files
enum {
B_HPKG_MAGIC = 'hpkg',
B_HPKG_VERSION = 1,
//
B_HPKG_REPO_MAGIC = 'hpkr',
B_HPKG_REPO_VERSION = 1
};
// attribute types
enum {
// types
B_HPKG_ATTRIBUTE_TYPE_INVALID = 0,
B_HPKG_ATTRIBUTE_TYPE_INT = 1,
B_HPKG_ATTRIBUTE_TYPE_UINT = 2,
B_HPKG_ATTRIBUTE_TYPE_STRING = 3,
B_HPKG_ATTRIBUTE_TYPE_RAW = 4,
//
B_HPKG_ATTRIBUTE_TYPE_ENUM_COUNT
};
// attribute encodings
enum {
// signed/unsigned int encodings
B_HPKG_ATTRIBUTE_ENCODING_INT_8_BIT = 0,
B_HPKG_ATTRIBUTE_ENCODING_INT_16_BIT = 1,
B_HPKG_ATTRIBUTE_ENCODING_INT_32_BIT = 2,
B_HPKG_ATTRIBUTE_ENCODING_INT_64_BIT = 3,
// string encodings
B_HPKG_ATTRIBUTE_ENCODING_STRING_INLINE = 0,
// null-terminated string
B_HPKG_ATTRIBUTE_ENCODING_STRING_TABLE = 1,
// unsigned LEB128 index into string table
// raw data encodings
B_HPKG_ATTRIBUTE_ENCODING_RAW_INLINE = 0,
// unsigned LEB128 size, raw bytes
B_HPKG_ATTRIBUTE_ENCODING_RAW_HEAP = 1
// unsigned LEB128 size, unsigned LEB128 offset into the heap
};
// maximum number of bytes of data to be encoded inline; more will be allocated
// on the heap
#define B_HPKG_MAX_INLINE_DATA_SIZE 8
// name of file containing package information (in package's root folder)
#define B_HPKG_PACKAGE_INFO_FILE_NAME ".PackageInfo"
// package attribute IDs
enum BPackageAttributeID {
B_PACKAGE_ATTRIBUTE_NAME = 0,
B_PACKAGE_ATTRIBUTE_SUMMARY,
B_PACKAGE_ATTRIBUTE_DESCRIPTION,
B_PACKAGE_ATTRIBUTE_VENDOR,
B_PACKAGE_ATTRIBUTE_PACKAGER,
B_PACKAGE_ATTRIBUTE_ARCHITECTURE,
B_PACKAGE_ATTRIBUTE_VERSION_MAJOR,
B_PACKAGE_ATTRIBUTE_VERSION_MINOR,
B_PACKAGE_ATTRIBUTE_VERSION_MICRO,
B_PACKAGE_ATTRIBUTE_VERSION_RELEASE,
B_PACKAGE_ATTRIBUTE_COPYRIGHT,
B_PACKAGE_ATTRIBUTE_LICENSE,
B_PACKAGE_ATTRIBUTE_PROVIDES,
B_PACKAGE_ATTRIBUTE_PROVIDES_TYPE,
B_PACKAGE_ATTRIBUTE_REQUIRES,
B_PACKAGE_ATTRIBUTE_SUPPLEMENTS,
B_PACKAGE_ATTRIBUTE_CONFLICTS,
B_PACKAGE_ATTRIBUTE_FRESHENS,
B_PACKAGE_ATTRIBUTE_REPLACES,
B_PACKAGE_ATTRIBUTE_RESOLVABLE_OPERATOR,
//
B_PACKAGE_ATTRIBUTE_ENUM_COUNT,
};
// compression types
enum {
B_HPKG_COMPRESSION_NONE = 0,
B_HPKG_COMPRESSION_ZLIB = 1
};
// file types (HPKG_ATTRIBUTE_NAME_FILE_TYPE)
enum {
B_HPKG_FILE_TYPE_FILE = 0,
B_HPKG_FILE_TYPE_DIRECTORY = 1,
B_HPKG_FILE_TYPE_SYMLINK = 2
};
// default values
enum {
B_HPKG_DEFAULT_FILE_TYPE = B_HPKG_FILE_TYPE_FILE,
B_HPKG_DEFAULT_FILE_PERMISSIONS = 0644,
B_HPKG_DEFAULT_DIRECTORY_PERMISSIONS = 0755,
B_HPKG_DEFAULT_SYMLINK_PERMISSIONS = 0777,
B_HPKG_DEFAULT_DATA_COMPRESSION = B_HPKG_COMPRESSION_NONE,
B_HPKG_DEFAULT_DATA_CHUNK_SIZE_ZLIB = 64 * 1024
};
} // namespace BHPKG
} // namespace BPackageKit
#endif // _PACKAGE__HPKG__HPKG_DEFS_H_