1 #ifndef H_HEADER_INTERNAL
2 #define H_HEADER_INTERNAL
5 * \file lib/header_internal.h
8 #include <rpm/header.h>
11 * Description of tag data.
13 typedef struct entryInfo_s * entryInfo;
15 rpm_tag_t tag; /*!< Tag identifier. */
16 rpm_tagtype_t type; /*!< Tag data type. */
17 int32_t offset; /*!< Offset into data segment (ondisk only). */
18 rpm_count_t count; /*!< Number of tag elements. */
21 #define REGION_TAG_TYPE RPM_BIN_TYPE
22 #define REGION_TAG_COUNT sizeof(struct entryInfo_s)
25 * A single tag from a Header.
27 typedef struct indexEntry_s * indexEntry;
29 struct entryInfo_s info; /*!< Description of tag data. */
30 rpm_data_t data; /*!< Location of tag data. */
31 int length; /*!< No. bytes of data. */
32 int rdlen; /*!< No. bytes of data in region. */
36 * Sanity check on no. of tags.
37 * This check imposes a limit of 65K tags, more than enough.
39 #define hdrchkTags(_ntags) ((_ntags) & 0xffff0000)
42 * Sanity check on type values.
44 #define hdrchkType(_type) ((_type) < RPM_MIN_TYPE || (_type) > RPM_MAX_TYPE)
47 * Sanity check on data size and/or offset and/or count.
48 * This check imposes a limit of 16 MB, more than enough.
50 #define HEADER_DATA_MAX 0x00ffffff
51 #define hdrchkData(_nbytes) ((_nbytes) & (~HEADER_DATA_MAX))
54 * Sanity check on data alignment for data type.
56 #define hdrchkAlign(_type, _off) ((_off) & (typeAlign[_type]-1))
59 * Sanity check on range of data offset.
61 #define hdrchkRange(_dl, _off) ((_off) < 0 || (_off) > (_dl))
68 * Set header instance (rpmdb record number)
70 * @param instance record number
73 void headerSetInstance(Header h, unsigned int instance);
75 /* Package IO helper to consolidate partial read and error handling */
77 ssize_t Freadall(FD_t fd, void * buf, ssize_t size);
82 #endif /* H_HEADER_INTERNAL */