header_internal.h File Reference
HEADER.
`#include <rpmtag.h>`
`#include <yarn.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...

## Macros

#define | hdrchkTags(_ntags) ((_ntags) & 0xff000000)
| Sanity check on no. More...
#define | hdrchkType(_type) ((_type) < RPM_MIN_TYPE || (_type) > RPM_MAX_TYPE)
| Sanity check on type values. More...
#define | hdrchkData(_nbytes) ((_nbytes) & 0xc0000000)
| Sanity check on data size and/or offset and/or count. More...
#define | hdrchkAlign(_type, _off) ((_off) & (rpm_typeAlign[_type]-1))
#define | hdrchkRange(_dl, _off) ((_off) < 0 || (_off) > (_dl))
| Sanity check on range of data offset. More...
#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)
#define | HEADERFLAG_MAPPED (1 << 5)
#define | HEADERFLAG_RDONLY (1 << 6)

## Typedefs

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

## Functions

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

## Variables

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

## Macro Definition Documentation

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

Definition at line 68 of file header_internal.h.

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

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

Definition at line 66 of file header_internal.h.

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

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

Definition at line 37 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 30 of file header_internal.h.

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

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

Sanity check on range of data offset.

Definition at line 42 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 19 of file header_internal.h.

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

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

Sanity check on type values.

Definition at line 24 of file header_internal.h.

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

#define HEADER_BASENAMES 1117

Definition at line 50 of file header_internal.h.

Referenced by headerLoad().

#define HEADER_OLDFILENAMES 1027

Definition at line 49 of file header_internal.h.

Referenced by headerLoad().

#define HEADERFLAG_ALLOCATED (1 << 1)

Is 1st header region allocated?

Definition at line 111 of file header_internal.h.

Referenced by headerAllocated(), headerMap(), headerReload(), headerScrub(), rdSignature(), and rpmReadHeader().

#define HEADERFLAG_DEBUG (1 << 3)

Debug this header?

Definition at line 113 of file header_internal.h.

#define HEADERFLAG_LEGACY (1 << 2)

Header came from legacy source?

Definition at line 112 of file header_internal.h.

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

#define HEADERFLAG_MAPPED (1 << 5)

Is 1st header region mmap'd?

Definition at line 115 of file header_internal.h.

Referenced by headerMap(), headerScrub(), rdSignature(), rpmmiNext(), and rpmReadHeader().

#define HEADERFLAG_RDONLY (1 << 6)

Is 1st header region rdonly?

Definition at line 116 of file header_internal.h.

Referenced by headerMap(), rdSignature(), rpmmiNext(), and rpmReadHeader().

#define HEADERFLAG_SIGNATURE (1 << 4)

Signature header?

Definition at line 114 of file header_internal.h.

Referenced by rdSignature().

#define HEADERFLAG_SORTED (1 << 0)

Are header entries sorted?

Definition at line 110 of file header_internal.h.

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

#define INDEX_MALLOC_SIZE 8

Definition at line 44 of file header_internal.h.

Referenced by headerAddEntry(), and headerNew().

#define REGION_TAG_COUNT sizeof(struct entryInfo_s)

Definition at line 64 of file header_internal.h.

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

#define REGION_TAG_TYPE RPM_BIN_TYPE

Definition at line 63 of file header_internal.h.

Referenced by headerLoad().

## Function Documentation

int headerVerifyInfo | ( | rpmuint32_t | il,
|  | rpmuint32_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.