# rpmdb/header_internal.h File Reference

`#include <rpmtag.h>`
`#include <netinet/in.h>`
Include dependency graph for header_internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

struct | entryInfo_s
struct | indexEntry_s
struct | headerToken_s
| The Header data structure. More...

## Defines

#define | hdrchkTags(_ntags) ((_ntags) & 0xff000000)
| Sanity check on no.
#define | hdrchkType(_type) ((_type) < RPM_MIN_TYPE || (_type) > RPM_MAX_TYPE)
| Sanity check on type values.
#define | hdrchkData(_nbytes) ((_nbytes) & 0xc0000000)
| Sanity check on data size and/or offset and/or count.
#define | hdrchkAlign(_type, _off) ((_off) & (rpm_typeAlign[_type]-1))
#define | hdrchkRange(_dl, _off) ((_off) < 0 || (_off) > (_dl))
| Sanity check on range of data offset.
#define | INDEX_MALLOC_SIZE 8
#define | HEADER_OLDFILENAMES 1027
#define | HEADER_BASENAMES 1117
#define | REGION_TAG_TYPE RPM_BIN_TYPE
#define | REGION_TAG_COUNT sizeof(struct entryInfo_s)
#define | ENTRY_IS_REGION(_e) (((_e)->info.tag >= HEADER_IMAGE) && ((_e)->info.tag < HEADER_REGIONS))
#define | ENTRY_IN_REGION(_e) ((_e)->info.offset < 0)
#define | HEADERFLAG_SORTED (1 << 0)
#define | HEADERFLAG_ALLOCATED (1 << 1)
#define | HEADERFLAG_LEGACY (1 << 2)
#define | HEADERFLAG_DEBUG (1 << 3)
#define | HEADERFLAG_SIGNATURE (1 << 4)

## Typedefs

typedef struct entryInfo_s * | entryInfo
| Description of tag data.
typedef struct indexEntry_s * | indexEntry
| A single tag from a Header.

## Functions

int | headerVerifyInfo (uint32_t il, uint32_t dl, const void *pev, void *iv, int negate)
| Perform simple sanity and range checks on header tag(s).
static int | headerUsageCount (Header h)
| Return header reference count.

## Variables

int | rpm_typeAlign [16]
| Sanity check on data alignment for data type.

## Detailed Description

Definition in file header_internal.h.

## Define Documentation

#define ENTRY_IN_REGION | ( | _e |  | ) | ((_e)->info.offset < 0)

Definition at line 67 of file header_internal.h.

Referenced by headerAddI18NString(), headerAppendEntry(), headerFree(), headerModifyEntry(), and headerRemoveEntry().

#define ENTRY_IS_REGION | ( | _e |  | ) | (((_e)->info.tag >= HEADER_IMAGE) && ((_e)->info.tag < HEADER_REGIONS))

Definition at line 65 of file header_internal.h.

Referenced by copyEntry(), headerFree(), headerNext(), headerReload(), headerSizeof(), and headerUnload().

#define hdrchkAlign | ( | _type,
|  | _off |  | ) | ((_off) & (rpm_typeAlign[_type]-1))

Definition at line 36 of file header_internal.h.

Referenced by headerVerifyInfo(), and regionSwab().

#define hdrchkData | ( | _nbytes |  | ) | ((_nbytes) & 0xc0000000)

Sanity check on data size and/or offset and/or count.

This check imposes a limit of 1 Gb.

Definition at line 29 of file header_internal.h.

Referenced by headerAddEntry(), headerCopyLoad(), headerLoad(), headerMergeLegacySigs(), headerUnload(), headerVerifyInfo(), regionSwab(), and rpmReadHeader().

#define hdrchkRange | ( | _dl,
|  | _off |  | ) | ((_off) < 0 || (_off) > (_dl))

Sanity check on range of data offset.

Definition at line 41 of file header_internal.h.

Referenced by headerVerifyInfo().

#define hdrchkTags | ( | _ntags |  | ) | ((_ntags) & 0xff000000)

Sanity check on no.

of tags. This check imposes a limit of 16M tags.

Definition at line 18 of file header_internal.h.

Referenced by headerCopyLoad(), headerLoad(), headerUnload(), and rpmReadHeader().

#define hdrchkType | ( | _type |  | ) | ((_type) < RPM_MIN_TYPE || (_type) > RPM_MAX_TYPE)

Sanity check on type values.

Definition at line 23 of file header_internal.h.

Referenced by headerAddEntry(), headerLoad(), headerMergeLegacySigs(), headerVerifyInfo(), and regionSwab().

#define HEADER_BASENAMES 1117

Definition at line 49 of file header_internal.h.

Referenced by headerLoad().

#define HEADER_OLDFILENAMES 1027

Definition at line 48 of file header_internal.h.

Referenced by headerLoad().

#define HEADERFLAG_ALLOCATED (1 << 1)

Is 1st header region allocated?

Definition at line 99 of file header_internal.h.

Referenced by headerAllocated(), headerCopyLoad(), headerFree(), headerReload(), rdSignature(), rpmdbNextIterator(), and rpmReadHeader().

#define HEADERFLAG_DEBUG (1 << 3)

Debug this header?

Definition at line 101 of file header_internal.h.

#define HEADERFLAG_LEGACY (1 << 2)

Header came from legacy source?

Definition at line 100 of file header_internal.h.

Referenced by headerLoad(), headerSizeof(), and headerUnload().

#define HEADERFLAG_SIGNATURE (1 << 4)

Signature header?

Definition at line 102 of file header_internal.h.

Referenced by rdSignature().

#define HEADERFLAG_SORTED (1 << 0)

Are header entries sorted?

Definition at line 98 of file header_internal.h.

Referenced by findEntry(), headerAddEntry(), headerLoad(), headerNew(), headerSort(), and headerUnload().

#define INDEX_MALLOC_SIZE 8

Definition at line 43 of file header_internal.h.

Referenced by headerAddEntry(), and headerNew().

#define REGION_TAG_COUNT sizeof(struct entryInfo_s)

Definition at line 63 of file header_internal.h.

Referenced by copyEntry(), headerCheck(), headerLoad(), rdSignature(), and regionSwab().

#define REGION_TAG_TYPE RPM_BIN_TYPE

Definition at line 62 of file header_internal.h.

Referenced by headerLoad().

## Function Documentation

int headerVerifyInfo | ( | uint32_t | il,
|  | uint32_t | dl,
|  | const void * | pev,
|  | void * | iv,
|  | int | negate |
| ) |  |  |

Perform simple sanity and range checks on header tag(s).

Parameters:

  | il | no. of tags in header
  | dl | no. of bytes in header data.
  | pev | 1st element in tag array, big-endian
  | iv | failing (or last) tag element, host-endian
  | negate | negative offset expected?

Returns:
  -1 on success, otherwise failing tag element index

Definition at line 36 of file header_internal.c.

References entryInfo_s::count, hdrchkAlign, hdrchkData, hdrchkRange, hdrchkType, entryInfo_s::offset, RPM_UINT8_TYPE, entryInfo_s::tag, and entryInfo_s::type.

Referenced by headerCheck(), and rdSignature().

## Variable Documentation

int rpm_typeAlign[16]

Sanity check on data alignment for data type.

Definition at line 17 of file header_internal.c.