# HEADER.

## Files

file | formats.c
file | package.c
file | rpmlib.h
| In Memoriam: Steve Taylor <staylor@redhat.com> was here, now he's not.

file | header.c
file | header_internal.c
file | header_internal.h
file | rpmtag.h

## Data Structures

struct | sprintfTag_s
struct | sprintfToken_s
struct | headerSprintfArgs_s
struct | headerToken_s
| The Header data structure. More...
union | rpmDataType_u
struct | _HE_s

## Typedefs

typedef struct sprintfTag_s * | sprintfTag
typedef struct sprintfToken_s * | sprintfToken
typedef struct headerSprintfArgs_s * | headerSprintfArgs
typedef struct entryInfo_s * | entryInfo
| Description of tag data.
typedef struct indexEntry_s * | indexEntry
| A single tag from a Header.
typedef const char * | errmsg_t
typedef struct headerToken_s * | Header
typedef enum rpmTagType_e | rpmTagType
typedef union rpmDataType_u | rpmTagData
typedef uint32_t | rpmTagCount
typedef struct _HE_s * | HE_t
typedef enum rpmSubTagType_e | rpmSubTagType
typedef enum rpmTagReturnType_e | rpmTagReturnType
| Identify how to return the header data type.
typedef struct headerIterator_s * | HeaderIterator
typedef struct headerTagIndices_s * | headerTagIndices
typedef struct headerSprintfExtension_s * | headerSprintfExtension
typedef enum rpmTag_e | rpmTag
typedef enum rpmSigTag_e | rpmSigTag

## Enumerations

enum | rpmTagType_e { RPM_UINT8_TYPE = 2, RPM_UINT16_TYPE = 3, RPM_UINT32_TYPE = 4, RPM_UINT64_TYPE = 5, RPM_STRING_TYPE = 6, RPM_BIN_TYPE = 7, RPM_STRING_ARRAY_TYPE = 8, RPM_I18NSTRING_TYPE = 9 }
| The basic types of data in tags from headers. More...
enum | rpmSubTagType_e { RPM_REGION_TYPE = -10, RPM_BIN_ARRAY_TYPE = -11, RPM_XREF_TYPE = -12 }

enum

rpmTagReturnType_e {
RPM_ANY_RETURN_TYPE = 0, RPM_SCALAR_RETURN_TYPE = 0x00010000, RPM_ARRAY_RETURN_TYPE = 0x00020000, RPM_MAPPING_RETURN_TYPE = 0x00040000,
RPM_PROBE_RETURN_TYPE = 0x00100000, RPM_TREE_RETURN_TYPE = 0x00200000, RPM_OPENPGP_RETURN_TYPE = 0x00400000, RPM_X509_RETURN_TYPE = 0x00800000,
RPM_ASN1_RETURN_TYPE = 0x01000000, RPM_OPAQUE_RETURN_TYPE = 0x10000000, RPM_MASK_RETURN_TYPE = 0xffff0000
}

| Identify how to return the header data type. More...

enum

rpmTag_e {
RPMTAG_HEADERIMAGE = 61, RPMTAG_HEADERSIGNATURES = 62, RPMTAG_HEADERIMMUTABLE = 63, RPMTAG_HEADERREGIONS = 64,
RPMTAG_HEADERI18NTABLE = 100, RPMTAG_SIG_BASE = 256, RPMTAG_SIGSIZE = RPMTAG_SIG_BASE+1, RPMTAG_SIGLEMD5_1 = RPMTAG_SIG_BASE+2,
RPMTAG_SIGPGP = RPMTAG_SIG_BASE+3, RPMTAG_SIGLEMD5_2 = RPMTAG_SIG_BASE+4, RPMTAG_SIGMD5 = RPMTAG_SIG_BASE+5, RPMTAG_SIGGPG = RPMTAG_SIG_BASE+6,
RPMTAG_SIGPGP5 = RPMTAG_SIG_BASE+7, RPMTAG_BADSHA1_1 = RPMTAG_SIG_BASE+8, RPMTAG_BADSHA1_2 = RPMTAG_SIG_BASE+9, RPMTAG_PUBKEYS = RPMTAG_SIG_BASE+10,
RPMTAG_DSAHEADER = RPMTAG_SIG_BASE+11, RPMTAG_RSAHEADER = RPMTAG_SIG_BASE+12, RPMTAG_SHA1HEADER = RPMTAG_SIG_BASE+13, RPMTAG_NAME = 1000,
RPMTAG_VERSION = 1001, RPMTAG_RELEASE = 1002, RPMTAG_EPOCH = 1003, RPMTAG_SUMMARY = 1004,
RPMTAG_DESCRIPTION = 1005, RPMTAG_BUILDTIME = 1006, RPMTAG_BUILDHOST = 1007, RPMTAG_INSTALLTIME = 1008,
RPMTAG_SIZE = 1009, RPMTAG_DISTRIBUTION = 1010, RPMTAG_VENDOR = 1011, RPMTAG_GIF = 1012,
RPMTAG_XPM = 1013, RPMTAG_LICENSE = 1014, RPMTAG_PACKAGER = 1015, RPMTAG_GROUP = 1016,
RPMTAG_CHANGELOG = 1017, RPMTAG_SOURCE = 1018, RPMTAG_PATCH = 1019, RPMTAG_URL = 1020,
RPMTAG_OS = 1021, RPMTAG_ARCH = 1022, RPMTAG_PREIN = 1023, RPMTAG_POSTIN = 1024,
RPMTAG_PREUN = 1025, RPMTAG_POSTUN = 1026, RPMTAG_OLDFILENAMES = 1027, RPMTAG_FILESIZES = 1028,
RPMTAG_FILESTATES = 1029, RPMTAG_FILEMODES = 1030, RPMTAG_FILEUIDS = 1031, RPMTAG_FILEGIDS = 1032,
RPMTAG_FILERDEVS = 1033, RPMTAG_FILEMTIMES = 1034, RPMTAG_FILEDIGESTS = 1035, RPMTAG_FILELINKTOS = 1036,
RPMTAG_FILEFLAGS = 1037, RPMTAG_ROOT = 1038, RPMTAG_FILEUSERNAME = 1039, RPMTAG_FILEGROUPNAME = 1040,
RPMTAG_EXCLUDE = 1041, RPMTAG_EXCLUSIVE = 1042, RPMTAG_ICON = 1043, RPMTAG_SOURCERPM = 1044,
RPMTAG_FILEVERIFYFLAGS = 1045, RPMTAG_ARCHIVESIZE = 1046, RPMTAG_PROVIDENAME = 1047, RPMTAG_REQUIREFLAGS = 1048,
RPMTAG_REQUIRENAME = 1049, RPMTAG_REQUIREVERSION = 1050, RPMTAG_NOSOURCE = 1051, RPMTAG_NOPATCH = 1052,
RPMTAG_CONFLICTFLAGS = 1053, RPMTAG_CONFLICTNAME = 1054, RPMTAG_CONFLICTVERSION = 1055, RPMTAG_DEFAULTPREFIX = 1056,
RPMTAG_BUILDROOT = 1057, RPMTAG_INSTALLPREFIX = 1058, RPMTAG_EXCLUDEARCH = 1059, RPMTAG_EXCLUDEOS = 1060,
RPMTAG_EXCLUSIVEARCH = 1061, RPMTAG_EXCLUSIVEOS = 1062, RPMTAG_AUTOREQPROV = 1063, RPMTAG_RPMVERSION = 1064,
RPMTAG_TRIGGERSCRIPTS = 1065, RPMTAG_TRIGGERNAME = 1066, RPMTAG_TRIGGERVERSION = 1067, RPMTAG_TRIGGERFLAGS = 1068,
RPMTAG_TRIGGERINDEX = 1069, RPMTAG_VERIFYSCRIPT = 1079, RPMTAG_CHANGELOGTIME = 1080, RPMTAG_CHANGELOGNAME = 1081,
RPMTAG_CHANGELOGTEXT = 1082, RPMTAG_BROKENMD5 = 1083, RPMTAG_PREREQ = 1084, RPMTAG_PREINPROG = 1085,
RPMTAG_POSTINPROG = 1086, RPMTAG_PREUNPROG = 1087, RPMTAG_POSTUNPROG = 1088, RPMTAG_BUILDARCHS = 1089,
RPMTAG_OBSOLETENAME = 1090, RPMTAG_VERIFYSCRIPTPROG = 1091, RPMTAG_TRIGGERSCRIPTPROG = 1092, RPMTAG_DOCDIR = 1093,
RPMTAG_COOKIE = 1094, RPMTAG_FILEDEVICES = 1095, RPMTAG_FILEINODES = 1096, RPMTAG_FILELANGS = 1097,
RPMTAG_PREFIXES = 1098, RPMTAG_INSTPREFIXES = 1099, RPMTAG_TRIGGERIN = 1100, RPMTAG_TRIGGERUN = 1101,
RPMTAG_TRIGGERPOSTUN = 1102, RPMTAG_AUTOREQ = 1103, RPMTAG_AUTOPROV = 1104, RPMTAG_CAPABILITY = 1105,
RPMTAG_SOURCEPACKAGE = 1106, RPMTAG_OLDORIGFILENAMES = 1107, RPMTAG_BUILDPREREQ = 1108, RPMTAG_BUILDREQUIRES = 1109,
RPMTAG_BUILDCONFLICTS = 1110, RPMTAG_BUILDMACROS = 1111, RPMTAG_PROVIDEFLAGS = 1112, RPMTAG_PROVIDEVERSION = 1113,
RPMTAG_OBSOLETEFLAGS = 1114, RPMTAG_OBSOLETEVERSION = 1115, RPMTAG_DIRINDEXES = 1116, RPMTAG_BASENAMES = 1117,
RPMTAG_DIRNAMES = 1118, RPMTAG_ORIGDIRINDEXES = 1119, RPMTAG_ORIGBASENAMES = 1120, RPMTAG_ORIGDIRNAMES = 1121,
RPMTAG_OPTFLAGS = 1122, RPMTAG_DISTURL = 1123, RPMTAG_PAYLOADFORMAT = 1124, RPMTAG_PAYLOADCOMPRESSOR = 1125,
RPMTAG_PAYLOADFLAGS = 1126, RPMTAG_INSTALLCOLOR = 1127, RPMTAG_INSTALLTID = 1128, RPMTAG_REMOVETID = 1129,
RPMTAG_SHA1RHN = 1130, RPMTAG_RHNPLATFORM = 1131, RPMTAG_PLATFORM = 1132, RPMTAG_PATCHESNAME = 1133,
RPMTAG_PATCHESFLAGS = 1134, RPMTAG_PATCHESVERSION = 1135, RPMTAG_CACHECTIME = 1136, RPMTAG_CACHEPKGPATH = 1137,
RPMTAG_CACHEPKGSIZE = 1138, RPMTAG_CACHEPKGMTIME = 1139, RPMTAG_FILECOLORS = 1140, RPMTAG_FILECLASS = 1141,
RPMTAG_CLASSDICT = 1142, RPMTAG_FILEDEPENDSX = 1143, RPMTAG_FILEDEPENDSN = 1144, RPMTAG_DEPENDSDICT = 1145,
RPMTAG_SOURCEPKGID = 1146, RPMTAG_FILECONTEXTS = 1147, RPMTAG_FSCONTEXTS = 1148, RPMTAG_RECONTEXTS = 1149,
RPMTAG_POLICIES = 1150, RPMTAG_PRETRANS = 1151, RPMTAG_POSTTRANS = 1152, RPMTAG_PRETRANSPROG = 1153,
RPMTAG_POSTTRANSPROG = 1154, RPMTAG_DISTTAG = 1155, RPMTAG_SUGGESTSNAME = 1156, RPMTAG_SUGGESTSVERSION = 1157,
RPMTAG_SUGGESTSFLAGS = 1158, RPMTAG_ENHANCESNAME = 1159, RPMTAG_ENHANCESVERSION = 1160, RPMTAG_ENHANCESFLAGS = 1161,
RPMTAG_PRIORITY = 1162, RPMTAG_CVSID = 1163, RPMTAG_BLINKPKGID = 1164, RPMTAG_BLINKHDRID = 1165,
RPMTAG_BLINKNEVRA = 1166, RPMTAG_FLINKPKGID = 1167, RPMTAG_FLINKHDRID = 1168, RPMTAG_FLINKNEVRA = 1169,
RPMTAG_PACKAGEORIGIN = 1170, RPMTAG_TRIGGERPREIN = 1171, RPMTAG_BUILDSUGGESTS = 1172, RPMTAG_BUILDENHANCES = 1173,
RPMTAG_SCRIPTSTATES = 1174, RPMTAG_SCRIPTMETRICS = 1175, RPMTAG_BUILDCPUCLOCK = 1176, RPMTAG_FILEDIGESTALGOS = 1177,
RPMTAG_VARIANTS = 1178, RPMTAG_XMAJOR = 1179, RPMTAG_XMINOR = 1180, RPMTAG_REPOTAG = 1181,
RPMTAG_KEYWORDS = 1182, RPMTAG_BUILDPLATFORMS = 1183, RPMTAG_PACKAGECOLOR = 1184, RPMTAG_PACKAGEPREFCOLOR = 1185,
RPMTAG_XATTRSDICT = 1186, RPMTAG_FILEXATTRSX = 1187, RPMTAG_DEPATTRSDICT = 1188, RPMTAG_CONFLICTATTRSX = 1189,
RPMTAG_OBSOLETEATTRSX = 1190, RPMTAG_PROVIDEATTRSX = 1191, RPMTAG_REQUIREATTRSX = 1192, RPMTAG_BUILDPROVIDES = 1193,
RPMTAG_BUILDOBSOLETES = 1194, RPMTAG_DBINSTANCE = 1195, RPMTAG_NVRA = 1196, RPMTAG_FILEPATHS = 1197,
RPMTAG_ORIGPATHS = 1198, RPMTAG_RPMLIBVERSION = 1199, RPMTAG_RPMLIBTIMESTAMP = 1200, RPMTAG_RPMLIBVENDOR = 1201,
RPMTAG_CLASS = 1202, RPMTAG_TRACK = 1203, RPMTAG_TRACKPROG = 1204, RPMTAG_SANITYCHECK = 1205,
RPMTAG_SANITYCHECKPROG = 1206, RPMTAG_FIRSTFREE_TAG
}

| Tags identify data in package headers. More...

## Functions

static void | headerSort (Header h)
| Sort tags in header.
static void | headerUnsort (Header h)
| Restore tags in header to original ordering.
static uint32_t | regionSwab (indexEntry entry, uint32_t il, uint32_t dl, entryInfo pe, unsigned char *dataStart, const unsigned char *dataEnd, int32_t regionid)
| Swap uint32_t and uint16_t arrays within header region.
static int | headerRemoveEntry (Header h, rpmTag tag)
| Delete tag in header.
static int | copyEntry (const indexEntry entry, HE_t he, int minMem)
| Retrieve data from header entry.
static int | headerAddEntry (Header h, HE_t he)
| Add tag to header.
static int | headerAppendEntry (Header h, HE_t he)
| Append element to tag array in header.
static int | headerAddOrAppendEntry (Header h, HE_t he)
| Add or append element to tag array in header.
static int | headerModifyEntry (Header h, HE_t he)
| Modify tag in header.
static int | headerUsageCount (Header h)
| Return header reference count.
static rpmRC | rpmWriteHeader (FD_t fd, Header h, const char **msg)
| Write (with unload) header to file handle.
char * | headerSprintf (Header h, const char *fmt, headerTagTableEntry tags, headerSprintfExtension exts, errmsg_t *errmsg)
| Return formatted output string from header tags.
int | headerGet (Header h, HE_t he, unsigned int flags)
| Retrieve extension or tag value from a header.
int | headerPut (Header h, HE_t he, unsigned int flags)
| Add or append tag container to header.
int | headerDel (Header h, HE_t he, unsigned int flags)
| Remove tag container from header.
int | headerMod (Header h, HE_t he, unsigned int flags)
| Modify tag container in header.
HeaderIterator | headerFini (HeaderIterator hi)
| Destroy header tag container iterator.
HeaderIterator | headerInit (Header h)
| Create header tag iterator.
int | headerNext (HeaderIterator hi, HE_t he, unsigned int flags)
| Return next tag from header.
Header | headerLink (Header h)
| Reference a header instance.
Header | headerUnlink (Header h)
| Dereference a header instance.
Header | headerFree (Header h)
| Dereference a header instance.
Header | headerNew (void)
| Create new (empty) header instance.
size_t | headerSizeof (Header h)
| Return size of on-disk header representation in bytes.
void * | headerUnload (Header h, size_t *lenp)
Header | headerReload (Header h, int tag)
| Convert header to on-disk representation, and then reload.
Header | headerCopy (Header h)
| Duplicate a header.
Header | headerLoad (void *uh)
| Convert header to in-memory representation.
Header | headerCopyLoad (const void *uh)
| Make a copy and convert header to in-memory representation.
int | headerIsEntry (Header h, rpmTag tag)
| Check if tag is in header.
int | headerAddI18NString (Header h, rpmTag tag, const char *string, const char *lang)
| Add locale specific tag to header.
void | headerCopyTags (Header headerFrom, Header headerTo, rpmTag *tagstocopy)
| Duplicate tag values from one header into another.
int | headerGetMagic (Header h, unsigned char **magicp, size_t *nmagicp)
| Return header magic.
int | headerSetMagic (Header h, unsigned char *magic, size_t nmagic)
| Store header magic.
const char * | headerGetOrigin (Header h)
| Return header origin (e.g path or URL).
int | headerSetOrigin (Header h, const char *origin)
| Store header origin (e.g path or URL).
uint32_t | headerGetInstance (Header h)
| Return header instance (if from rpmdb).
uint32_t | headerSetInstance (Header h, uint32_t instance)
| Store header instance (e.g path or URL).
void * | headerGetStats (Header h, int opx)
| Return header stats accumulator structure.
int | headerNEVRA (Header h, const char **np, const char **ep, const char **vp, const char **rp, const char **ap)
| Return name, epoch, version, release, arch strings from header.
void | headerMergeLegacySigs (Header h, const Header sigh)
| Translate and merge legacy signature tags into header.
Header | headerRegenSigHeader (const Header h, int noArchiveSize)
| Regenerate signature header.

## Variables

static unsigned char | header_magic [8]
static int | typeSizes [16]
| Size of header data types.
static size_t | headerMaxbytes = (1024*1024*1024)
| Maximum no.
headerSprintfExtension | headerDefaultFormats
| Supported default header tag output formats.
headerSprintfExtension | headerCompoundFormats
| Supported default header extension/tag output formats.

## Typedef Documentation

typedef struct entryInfo_s* entryInfo

Description of tag data.

Definition at line 54 of file header_internal.h.

typedef const char* errmsg_t

Definition at line 17 of file rpmtag.h.

typedef struct _HE_s* HE_t

tag container.

Definition at line 58 of file rpmtag.h.

typedef struct headerToken_s* Header

Definition at line 21 of file rpmtag.h.

typedef struct headerIterator_s* HeaderIterator

Definition at line 125 of file rpmtag.h.

typedef struct headerSprintfArgs_s* headerSprintfArgs

Definition at line 1852 of file hdrfmt.c.

typedef struct headerSprintfExtension_s* headerSprintfExtension

Definition at line 133 of file rpmtag.h.

typedef struct headerTagIndices_s* headerTagIndices

Definition at line 129 of file rpmtag.h.

typedef struct indexEntry_s* indexEntry

A single tag from a Header.

Definition at line 72 of file header_internal.h.

typedef enum rpmSigTag_e rpmSigTag

Definition at line 446 of file rpmtag.h.

typedef enum rpmSubTagType_e rpmSubTagType

typedef enum rpmTag_e rpmTag

Definition at line 442 of file rpmtag.h.

typedef uint32_t rpmTagCount

tag data element count.

Definition at line 54 of file rpmtag.h.

typedef union rpmDataType_u rpmTagData

tag data.

Definition at line 50 of file rpmtag.h.

typedef enum rpmTagReturnType_e rpmTagReturnType

Identify how to return the header data type.

typedef enum rpmTagType_e rpmTagType

tag data type.

Definition at line 46 of file rpmtag.h.

typedef struct sprintfTag_s* sprintfTag

Definition at line 1791 of file hdrfmt.c.

typedef struct sprintfToken_s* sprintfToken

Definition at line 1814 of file hdrfmt.c.

## Enumeration Type Documentation

enum rpmSubTagType_e

Enumerator:

  RPM_REGION_TYPE |
  RPM_BIN_ARRAY_TYPE |
  RPM_XREF_TYPE |

Definition at line 84 of file rpmtag.h.

enum rpmTag_e

Tags identify data in package headers.

Note:
  tags should not have value 0!

Enumerator:

  RPMTAG_HEADERIMAGE | internal Current image.
  RPMTAG_HEADERSIGNATURES | internal Signatures.
  RPMTAG_HEADERIMMUTABLE | x Original image.
  RPMTAG_HEADERREGIONS | internal Regions.
  RPMTAG_HEADERI18NTABLE | s[] I18N string locales.
  RPMTAG_SIG_BASE |
  RPMTAG_SIGSIZE |
  RPMTAG_SIGLEMD5_1 |
  RPMTAG_SIGPGP |
  RPMTAG_SIGLEMD5_2 |
  RPMTAG_SIGMD5 |
  RPMTAG_SIGGPG |
  RPMTAG_SIGPGP5 |
  RPMTAG_BADSHA1_1 |
  RPMTAG_BADSHA1_2 |
  RPMTAG_PUBKEYS |
  RPMTAG_DSAHEADER |
  RPMTAG_RSAHEADER |
  RPMTAG_SHA1HEADER |
  RPMTAG_NAME |
  RPMTAG_VERSION |
  RPMTAG_RELEASE |
  RPMTAG_EPOCH |
  RPMTAG_SUMMARY |
  RPMTAG_DESCRIPTION |
  RPMTAG_BUILDTIME |
  RPMTAG_BUILDHOST |
  RPMTAG_INSTALLTIME |
  RPMTAG_SIZE |
  RPMTAG_DISTRIBUTION |
  RPMTAG_VENDOR |
  RPMTAG_GIF |
  RPMTAG_XPM |
  RPMTAG_LICENSE |
  RPMTAG_PACKAGER |
  RPMTAG_GROUP |
  RPMTAG_CHANGELOG |
  RPMTAG_SOURCE |
  RPMTAG_PATCH |
  RPMTAG_URL |
  RPMTAG_OS |
  RPMTAG_ARCH |
  RPMTAG_PREIN |
  RPMTAG_POSTIN |
  RPMTAG_PREUN |
  RPMTAG_POSTUN |
  RPMTAG_OLDFILENAMES |
  RPMTAG_FILESIZES |
  RPMTAG_FILESTATES |
  RPMTAG_FILEMODES |
  RPMTAG_FILEUIDS |
  RPMTAG_FILEGIDS |
  RPMTAG_FILERDEVS |
  RPMTAG_FILEMTIMES |
  RPMTAG_FILEDIGESTS |
  RPMTAG_FILELINKTOS |
  RPMTAG_FILEFLAGS |
  RPMTAG_ROOT |
  RPMTAG_FILEUSERNAME |
  RPMTAG_FILEGROUPNAME |
  RPMTAG_EXCLUDE |
  RPMTAG_EXCLUSIVE |
  RPMTAG_ICON |
  RPMTAG_SOURCERPM |
  RPMTAG_FILEVERIFYFLAGS |
  RPMTAG_ARCHIVESIZE |
  RPMTAG_PROVIDENAME |
  RPMTAG_REQUIREFLAGS |
  RPMTAG_REQUIRENAME |
  RPMTAG_REQUIREVERSION |
  RPMTAG_NOSOURCE |
  RPMTAG_NOPATCH |
  RPMTAG_CONFLICTFLAGS |
  RPMTAG_CONFLICTNAME |
  RPMTAG_CONFLICTVERSION |
  RPMTAG_DEFAULTPREFIX |
  RPMTAG_BUILDROOT |
  RPMTAG_INSTALLPREFIX |
  RPMTAG_EXCLUDEARCH |
  RPMTAG_EXCLUDEOS |
  RPMTAG_EXCLUSIVEARCH |
  RPMTAG_EXCLUSIVEOS |
  RPMTAG_AUTOREQPROV |
  RPMTAG_RPMVERSION |
  RPMTAG_TRIGGERSCRIPTS |
  RPMTAG_TRIGGERNAME |
  RPMTAG_TRIGGERVERSION |
  RPMTAG_TRIGGERFLAGS |
  RPMTAG_TRIGGERINDEX |
  RPMTAG_VERIFYSCRIPT |
  RPMTAG_CHANGELOGTIME |
  RPMTAG_CHANGELOGNAME |
  RPMTAG_CHANGELOGTEXT |
  RPMTAG_BROKENMD5 |
  RPMTAG_PREREQ |
  RPMTAG_PREINPROG |
  RPMTAG_POSTINPROG |
  RPMTAG_PREUNPROG |
  RPMTAG_POSTUNPROG |
  RPMTAG_BUILDARCHS |
  RPMTAG_OBSOLETENAME |
  RPMTAG_VERIFYSCRIPTPROG |
  RPMTAG_TRIGGERSCRIPTPROG |
  RPMTAG_DOCDIR |
  RPMTAG_COOKIE |
  RPMTAG_FILEDEVICES |
  RPMTAG_FILEINODES |
  RPMTAG_FILELANGS |
  RPMTAG_PREFIXES |
  RPMTAG_INSTPREFIXES |
  RPMTAG_TRIGGERIN |
  RPMTAG_TRIGGERUN |
  RPMTAG_TRIGGERPOSTUN |
  RPMTAG_AUTOREQ |
  RPMTAG_AUTOPROV |
  RPMTAG_CAPABILITY |
  RPMTAG_SOURCEPACKAGE |
  RPMTAG_OLDORIGFILENAMES |
  RPMTAG_BUILDPREREQ |
  RPMTAG_BUILDREQUIRES |
  RPMTAG_BUILDCONFLICTS |
  RPMTAG_BUILDMACROS |
  RPMTAG_PROVIDEFLAGS |
  RPMTAG_PROVIDEVERSION |
  RPMTAG_OBSOLETEFLAGS |
  RPMTAG_OBSOLETEVERSION |
  RPMTAG_DIRINDEXES |
  RPMTAG_BASENAMES |
  RPMTAG_DIRNAMES |
  RPMTAG_ORIGDIRINDEXES |
  RPMTAG_ORIGBASENAMES |
  RPMTAG_ORIGDIRNAMES |
  RPMTAG_OPTFLAGS |
  RPMTAG_DISTURL |
  RPMTAG_PAYLOADFORMAT |
  RPMTAG_PAYLOADCOMPRESSOR |
  RPMTAG_PAYLOADFLAGS |
  RPMTAG_INSTALLCOLOR |
  RPMTAG_INSTALLTID |
  RPMTAG_REMOVETID |
  RPMTAG_SHA1RHN |
  RPMTAG_RHNPLATFORM |
  RPMTAG_PLATFORM |
  RPMTAG_PATCHESNAME |
  RPMTAG_PATCHESFLAGS |
  RPMTAG_PATCHESVERSION |
  RPMTAG_CACHECTIME |
  RPMTAG_CACHEPKGPATH |
  RPMTAG_CACHEPKGSIZE |
  RPMTAG_CACHEPKGMTIME |
  RPMTAG_FILECOLORS |
  RPMTAG_FILECLASS |
  RPMTAG_CLASSDICT |
  RPMTAG_FILEDEPENDSX |
  RPMTAG_FILEDEPENDSN |
  RPMTAG_DEPENDSDICT |
  RPMTAG_SOURCEPKGID |
  RPMTAG_FILECONTEXTS |
  RPMTAG_FSCONTEXTS |
  RPMTAG_RECONTEXTS |
  RPMTAG_POLICIES |
  RPMTAG_PRETRANS |
  RPMTAG_POSTTRANS |
  RPMTAG_PRETRANSPROG |
  RPMTAG_POSTTRANSPROG |
  RPMTAG_DISTTAG |
  RPMTAG_SUGGESTSNAME |
  RPMTAG_SUGGESTSVERSION |
  RPMTAG_SUGGESTSFLAGS |
  RPMTAG_ENHANCESNAME |
  RPMTAG_ENHANCESVERSION |
  RPMTAG_ENHANCESFLAGS |
  RPMTAG_PRIORITY |
  RPMTAG_CVSID |
  RPMTAG_BLINKPKGID |
  RPMTAG_BLINKHDRID |
  RPMTAG_BLINKNEVRA |
  RPMTAG_FLINKPKGID |
  RPMTAG_FLINKHDRID |
  RPMTAG_FLINKNEVRA |
  RPMTAG_PACKAGEORIGIN |
  RPMTAG_TRIGGERPREIN |
  RPMTAG_BUILDSUGGESTS |
  RPMTAG_BUILDENHANCES |
  RPMTAG_SCRIPTSTATES |
  RPMTAG_SCRIPTMETRICS |
  RPMTAG_BUILDCPUCLOCK |
  RPMTAG_FILEDIGESTALGOS |
  RPMTAG_VARIANTS |
  RPMTAG_XMAJOR |
  RPMTAG_XMINOR |
  RPMTAG_REPOTAG |
  RPMTAG_KEYWORDS |
  RPMTAG_BUILDPLATFORMS |
  RPMTAG_PACKAGECOLOR |
  RPMTAG_PACKAGEPREFCOLOR |
  RPMTAG_XATTRSDICT |
  RPMTAG_FILEXATTRSX |
  RPMTAG_DEPATTRSDICT |
  RPMTAG_CONFLICTATTRSX |
  RPMTAG_OBSOLETEATTRSX |
  RPMTAG_PROVIDEATTRSX |
  RPMTAG_REQUIREATTRSX |
  RPMTAG_BUILDPROVIDES |
  RPMTAG_BUILDOBSOLETES |
  RPMTAG_DBINSTANCE |
  RPMTAG_NVRA |
  RPMTAG_FILEPATHS |
  RPMTAG_ORIGPATHS |
  RPMTAG_RPMLIBVERSION |
  RPMTAG_RPMLIBTIMESTAMP |
  RPMTAG_RPMLIBVENDOR |
  RPMTAG_CLASS |
  RPMTAG_TRACK |
  RPMTAG_TRACKPROG |
  RPMTAG_SANITYCHECK |
  RPMTAG_SANITYCHECKPROG |
  RPMTAG_FIRSTFREE_TAG | internal

Definition at line 152 of file rpmtag.h.

enum rpmTagReturnType_e

Identify how to return the header data type.

Enumerator:

  RPM_ANY_RETURN_TYPE |
  RPM_SCALAR_RETURN_TYPE |
  RPM_ARRAY_RETURN_TYPE |
  RPM_MAPPING_RETURN_TYPE |
  RPM_PROBE_RETURN_TYPE |
  RPM_TREE_RETURN_TYPE |
  RPM_OPENPGP_RETURN_TYPE |
  RPM_X509_RETURN_TYPE |
  RPM_ASN1_RETURN_TYPE |
  RPM_OPAQUE_RETURN_TYPE |
  RPM_MASK_RETURN_TYPE |

Definition at line 95 of file rpmtag.h.

enum rpmTagType_e

The basic types of data in tags from headers.

Enumerator:

  RPM_UINT8_TYPE |
  RPM_UINT16_TYPE |
  RPM_UINT32_TYPE |
  RPM_UINT64_TYPE |
  RPM_STRING_TYPE |
  RPM_BIN_TYPE |
  RPM_STRING_ARRAY_TYPE |
  RPM_I18NSTRING_TYPE |

Definition at line 26 of file rpmtag.h.

## Function Documentation

static int copyEntry | ( | const indexEntry | entry,
|  | HE_t | he,
|  | int | minMem |
| ) |  |  | `[static]`

Retrieve data from header entry.

Todo:
  Permit retrieval of regions other than HEADER_IMUTABLE.

Parameters:

  | entry | header entry

Return values:

  | *he | tag container

Parameters:

  | minMem | string pointers refer to header memory?

Returns:
  1 on success, otherwise error.

Definition at line 1199 of file header.c.

References rpmDataType_u::argv, _HE_s::c, entryInfo_s::count, indexEntry_s::data, ENTRY_IS_REGION, HEADER_IMAGE, indexEntry_s::info, indexEntry_s::length, entryInfo_s::offset, _HE_s::p, rpmDataType_u::ptr, indexEntry_s::rdlen, REGION_TAG_COUNT, regionSwab(), RPM_BIN_TYPE, RPM_I18NSTRING_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, rpmDataType_u::str, _HE_s::t, entryInfo_s::tag, entryInfo_s::type, rpmDataType_u::ui32p, and xmalloc().

Referenced by headerNext(), and intGetEntry().

static int headerAddEntry | ( | Header | h,
|  | HE_t | he |
| ) |  |  | `[static]`

Add tag to header.

Duplicate tags are okay, but only defined for iteration (with the exceptions noted below). While you are allowed to add i18n string arrays through this function, you probably don't mean to. See headerAddI18NString() instead.

Parameters:

  | h | header
  | he | tag container

Returns:
  1 on success, 0 on failure

Definition at line 1545 of file header.c.

References _HE_s::c, entryInfo_s::count, indexEntry_s::data, headerToken_s::flags, grabData(), hdrchkData, hdrchkType, HEADERFLAG_SORTED, headerToken_s::index, INDEX_MALLOC_SIZE, headerToken_s::indexAlloced, headerToken_s::indexUsed, indexEntry_s::info, indexEntry_s::length, entryInfo_s::offset, _HE_s::p, rpmDataType_u::ptr, _HE_s::t, _HE_s::tag, entryInfo_s::tag, entryInfo_s::type, and xrealloc().

Referenced by headerAddI18NString(), headerAddOrAppendEntry(), headerCopy(), and headerPut().

int headerAddI18NString | ( | Header | h,
|  | rpmTag | tag,
|  | const char * | string,
|  | const char * | lang |
| ) |  |  |

Add locale specific tag to header.

A NULL lang is interpreted as the C locale. Here are the rules:

     *	- If the tag isn't in the header, it's added with the passed string
     *	   as new value.
     *	- If the tag occurs multiple times in entry, which tag is affected
     *	   by the operation is undefined.
     *	- If the tag is in the header w/ this language, the entry is
     *	   *replaced* (like headerModifyEntry()).
     *

This function is intended to just "do the right thing". If you need more fine grained control use headerAddEntry() and headerModifyEntry().

Parameters:

  | h | header
  | tag | tag
  | string | tag value
  | lang | locale

Returns:
  1 on success, 0 on failure

Definition at line 1654 of file header.c.

References _free(), alloca(), rpmDataType_u::argv, _HE_s::c, entryInfo_s::count, indexEntry_s::data, ENTRY_IN_REGION, findEntry(), HEADER_I18NTABLE, headerAddEntry(), indexEntry_s::info, indexEntry_s::length, entryInfo_s::offset, _HE_s::p, rpmDataType_u::ptr, RPM_I18NSTRING_TYPE, RPM_STRING_ARRAY_TYPE, _HE_s::t, _HE_s::tag, xmalloc(), and xrealloc().

Referenced by handlePreambleTag(), parseDescription(), rpmcliImportPubkey(), and rpmtsImportPubkey().

static int headerAddOrAppendEntry | ( | Header | h,
|  | HE_t | he |
| ) |  |  | `[static]`

Add or append element to tag array in header.

Parameters:

  | h | header
  | he | tag container

Returns:
  1 on success, 0 on failure

Definition at line 1646 of file header.c.

References findEntry(), headerAddEntry(), headerAppendEntry(), _HE_s::t, and _HE_s::tag.

Referenced by headerPut().

static int headerAppendEntry | ( | Header | h,
|  | HE_t | he |
| ) |  |  | `[static]`

Append element to tag array in header.

Appends item p to entry w/ tag and type as passed. Won't work on RPM_STRING_TYPE.

Parameters:

  | h | header
  | he | tag container

Returns:
  1 on success, 0 on failure

Definition at line 1599 of file header.c.

References _HE_s::c, copyData(), entryInfo_s::count, indexEntry_s::data, dataLength(), ENTRY_IN_REGION, findEntry(), indexEntry_s::info, indexEntry_s::length, entryInfo_s::offset, _HE_s::p, rpmDataType_u::ptr, RPM_I18NSTRING_TYPE, RPM_STRING_TYPE, _HE_s::t, _HE_s::tag, xmalloc(), and xrealloc().

Referenced by headerAddOrAppendEntry().

Header headerCopy | ( | Header | h | ) |

Duplicate a header.

Parameters:

  | h | header

Returns:
  new header instance

Definition at line 1966 of file header.c.

References _free(), alloca(), HEADER_IMAGE, headerAddEntry(), headerFini(), headerInit(), headerNew(), headerNext(), headerReload(), _HE_s::p, and rpmDataType_u::ptr.

Referenced by hdrUnload(), and rpmdbRebuild().

Header headerCopyLoad | ( | const void * | uh | ) |

Make a copy and convert header to in-memory representation.

Parameters:

  | uh | on-disk header blob (i.e. with offsets)

Returns:
  header

Definition at line 1161 of file header.c.

References _free(), headerToken_s::flags, hdrchkData, hdrchkTags, HEADERFLAG_ALLOCATED, headerLoad(), headerMaxbytes, and xmalloc().

Referenced by rpmdbNextIterator(), rpmpsmStage(), and rpmReSign().

void headerCopyTags | ( | Header | headerFrom,
|  | Header | headerTo,
|  | rpmTag * | tagstocopy |
| ) |  |  |

Duplicate tag values from one header into another.

Parameters:

  | headerFrom | source header
  | headerTo | destination header
  | tagstocopy | array of tags that are copied

Definition at line 1983 of file header.c.

References _free(), alloca(), headerGet(), headerIsEntry(), headerPut(), _HE_s::p, rpmDataType_u::ptr, and _HE_s::tag.

Referenced by packageBinaries(), and parsePreamble().

int headerDel | ( | Header | h,
|  | HE_t | he,
|  | unsigned int | flags |
| ) |  |  |

Remove tag container from header.

Parameters:

  | h | header
  | he | tag container
  | flags | (unused)

Returns:
  1 on success, 0 on failure

Definition at line 2084 of file header.c.

References headerRemoveEntry(), and _HE_s::tag.

Referenced by addFileToTag(), compressFilelist(), rpmdbAdd(), rpmfcGenerateDepends(), and rpmReSign().

HeaderIterator headerFini | ( | HeaderIterator | hi | ) |

Destroy header tag container iterator.

Parameters:

  | hi | header tag container iterator

Returns:
  NULL always

Definition at line 1910 of file header.c.

References _free(), headerIterator_s::h, and headerFree().

Referenced by checkForDuplicates(), hdrKeyList(), headerCopy(), headerMergeLegacySigs(), headerRegenSigHeader(), hsaFini(), initSourceHeader(), rpmpsmStage(), rpmReSign(), and rpmVerifySignatures().

Header headerFree | ( | Header | h | ) |

Dereference a header instance.

Parameters:

  | h | header

Returns:
  NULL always

Definition at line 124 of file header.c.

References _free(), _hdr_stats, headerToken_s::blob, indexEntry_s::data, ENTRY_IN_REGION, ENTRY_IS_REGION, headerToken_s::flags, HEADERFLAG_ALLOCATED, headerGetStats(), headerUnlink(), headerToken_s::index, headerToken_s::indexUsed, indexEntry_s::length, headerToken_s::nrefs, headerToken_s::origin, and rpmswAdd().

Referenced by ckHeader(), delTE(), freePackage(), freeSpec(), hdr_dealloc(), hdrLoad(), hdrUnload(), headerFini(), headerReload(), headerSprintf(), IDTXfree(), IDTXglob(), makeHDRSignature(), miFreeHeader(), rdSignature(), readFile(), rpmcliImportPubkey(), rpmdb_subscript(), rpmdbFindByFile(), rpmdbRebuild(), rpmdbRemove(), rpmdsFree(), rpmfiFree(), rpmfiNew(), rpmgiFree(), rpmgiLoadReadHeader(), rpmgiNext(), rpmgiReadHeader(), rpmgiWalkReadHeader(), rpmInstallSourcePackage(), rpmpsmStage(), rpmReadHeader(), rpmReadHeaders(), rpmReadPackageFile(), rpmReSign(), rpmRollback(), rpmSingleHeaderFromFD(), rpmteSetHeader(), rpmts_HdrFromFdno(), rpmtsImportPubkey(), rpmtsRun(), rpmtsSolve(), rpmVerifySignatures(), showVerifyPackage(), and writeRPM().

int headerGet | ( | Header | h,
|  | HE_t | he,
|  | unsigned int | flags |
| ) |  |  |

Retrieve extension or tag value from a header.

Parameters:

  | h | header
  | he | tag container
  | flags | tag retrieval flags

Returns:
  1 on success, 0 on failure

Definition at line 2003 of file header.c.

References _HE_s::c, _HE_s::freeData, headerCompoundFormats, HEADERGET_NOEXTENSION, headerGetStats(), intGetEntry(), _HE_s::p, rpmDataType_u::ptr, rpmheRealloc(), rpmswEnter(), rpmswExit(), _HE_s::t, _HE_s::tag, tagName(), and xstrcasecmp().

Referenced by addFileToTag(), addReqProv(), addTE(), checkPackageSet(), compressFilelist(), ensureOlder(), findErases(), formatValue(), fssizesTag(), getSignid(), handleInstInstalledFiles(), handleOneTrigger(), handlePreambleTag(), handleRmvdInstalledFiles(), hCopyTag(), hdr_subscript(), headerCopyTags(), headerMacrosLoad(), headerMacrosUnload(), headerNEVRA(), hGetColor(), hLoadTID(), i18nTag(), IDTXglob(), IDTXload(), instprefixTag(), isMemberInEntry(), localeTag(), lookupPackage(), makeHDRSignature(), markReplacedFiles(), mireSkip(), packageBinaries(), parsePreamble(), parseSpec(), printNewSpecfile(), processBinaryFiles(), processPackageFiles(), providePackageNVR(), rdSignature(), readFile(), relocateFileList(), rpmcliInstall(), rpmdbAdd(), rpmdbExportInfo(), rpmdbFindByFile(), rpmdbFindFpList(), rpmdbRemove(), rpmdsNew(), rpmdsNVRMatchesDep(), rpmdsThis(), rpmfcGenerateScriptletDeps(), rpmfiBuildFNames(), rpmfiNew(), rpmHeadersIdentical(), rpmInstallSourcePackage(), rpmpsmStage(), rpmReadPackageFile(), rpmReSign(), rpmteChain(), rpmteNew(), rpmtsAddInstallElement(), rpmtsCallback(), rpmtsFindPubkey(), rpmtsSolve(), rpmVerifySignatures(), rpmVersionCompare(), runImmedTriggers(), runInstScript(), runScript(), singleSprintf(), stashSt(), timeCheck(), triggercondsTag(), triggertypeTag(), and writeRPM().

uint32_t headerGetInstance | ( | Header | h | ) |

Return header instance (if from rpmdb).

Parameters:

  | h | header

Returns:
  header instance

Definition at line 1115 of file header.c.

References headerToken_s::instance.

Referenced by dbinstanceTag(), rpmgiNext(), rpmpsmStage(), and verifyDependencies().

int headerGetMagic | ( | Header | h,
|  | unsigned char ** | magicp,
|  | size_t * | nmagicp |
| ) |  |  |

Return header magic.

Parameters:

  | h | header
  | *magicp | magic array
  | *nmagicp | no. bytes of magic

Returns:
  0 always

Definition at line 1079 of file header.c.

References header_magic, and headerToken_s::magic.

Referenced by headerCheck(), makeHDRSignature(), miFreeHeader(), rdSignature(), readFile(), rpmdbAdd(), rpmReadHeader(), rpmReadPackageFile(), and rpmWriteHeader().

const char* headerGetOrigin | ( | Header | h | ) |

Return header origin (e.g path or URL).

Parameters:

  | h | header

Returns:
  header origin

Definition at line 1101 of file header.c.

References headerToken_s::origin.

Referenced by hdrGetOrigin(), IDTXglob(), and populateInstallHeader().

void* headerGetStats | ( | Header | h,
|  | int | opx |
| ) |  |  |

Return header stats accumulator structure.

Parameters:

  | h | header
  | opx | per-header accumulator index (aka rpmtsOpX)

Returns:
  per-header accumulator pointer

Definition at line 85 of file header.c.

References _hdr_stats, headerToken_s::h_getops, and headerToken_s::h_loadops.

Referenced by headerFree(), headerGet(), headerLoad(), headerNext(), and headerUnload().

HeaderIterator headerInit | ( | Header | h | ) |

Create header tag iterator.

Parameters:

  | h | header

Returns:
  header tag iterator

Definition at line 1919 of file header.c.

References headerIterator_s::h, headerLink(), headerSort(), headerIterator_s::next_index, and xmalloc().

Referenced by checkForDuplicates(), hdrKeyList(), headerCopy(), headerMergeLegacySigs(), headerRegenSigHeader(), hsaInit(), initSourceHeader(), rpmpsmStage(), rpmReSign(), and rpmVerifySignatures().

int headerIsEntry | ( | Header | h,
|  | rpmTag | tag |
| ) |  |  |

Check if tag is in header.

Parameters:

  | h | header
  | tag | tag

Returns:
  1 on success, 0 on failure

Definition at line 1184 of file header.c.

References findEntry().

Referenced by addTE(), checkForRequired(), compressFilelist(), fillOutMainPackage(), fsmMapAttrs(), headerCopyTags(), headerMergeLegacySigs(), headerNEVRA(), headerRegenSigHeader(), IDTXglob(), initSourceHeader(), makeHDRSignature(), parseDescription(), parseScript(), parseSpec(), readFile(), relocateFileList(), rpmdbAdd(), rpmdbNextIterator(), rpmdbRebuild(), rpmfiNew(), rpmInstallSourcePackage(), rpmpsmStage(), rpmReadPackageFile(), rpmtsAddInstallElement(), rpmVerifySignatures(), showVerifyPackage(), singleSprintf(), unsatisfiedDepend(), and writeRPM().

Header headerLink | ( | Header | h | ) |

Reference a header instance.

Parameters:

  | h | header

Returns:
  referenced header instance

Definition at line 96 of file header.c.

References _hdr_debug, and headerToken_s::nrefs.

Referenced by hdr_Wrap(), hdrUnload(), headerInit(), headerLoad(), headerNew(), headerSprintf(), IDTXglob(), IDTXload(), rdSignature(), relocateFileList(), rpmdbFindByFile(), rpmdbRemove(), rpmdsDup(), rpmfiNew(), rpmgiLoadReadHeader(), rpmgiNext(), rpmgiWalkReadHeader(), rpmInstallSourcePackage(), rpmpsmStage(), rpmReadHeader(), rpmReadPackageFile(), rpmReSign(), rpmteHeader(), rpmteSetHeader(), rpmtsSolve(), showVerifyPackage(), and writeRPM().

Header headerLoad | ( | void * | uh | ) |

Convert header to in-memory representation.

Parameters:

  | uh | on-disk header blob (i.e. with offsets)

Returns:
  header

Definition at line 904 of file header.c.

References _free(), alloca(), headerToken_s::blob, entryInfo_s::count, indexEntry_s::data, headerToken_s::flags, hdrchkData, hdrchkTags, hdrchkType, HEADER_BASENAMES, HEADER_I18NTABLE, HEADER_IMAGE, header_magic, HEADER_OLDFILENAMES, HEADERFLAG_LEGACY, HEADERFLAG_SORTED, headerGetStats(), headerLink(), headerRemoveEntry(), headerSort(), headerToken_s::index, headerToken_s::indexAlloced, headerToken_s::indexUsed, indexEntry_s::info, indexEntry_s::length, headerToken_s::magic, headerToken_s::nrefs, entryInfo_s::offset, indexEntry_s::rdlen, REGION_TAG_COUNT, REGION_TAG_TYPE, regionSwab(), rpmswEnter(), rpmswExit(), save(), entryInfo_s::tag, entryInfo_s::type, and xcalloc().

Referenced by ckHeader(), hdrLoad(), headerCopyLoad(), headerReload(), rdSignature(), rpmdbNextIterator(), and rpmReadHeader().

void headerMergeLegacySigs | ( | Header | h,
|  | const Header | sigh |
| ) |  |  |

Translate and merge legacy signature tags into header.

Todo:
  Remove headerSort() through headerInitIterator() modifies sig.

Parameters:

  | h | header
  | sigh | signature header

Definition at line 235 of file hdrNVR.c.

References _free(), alloca(), _HE_s::c, hdrchkData, hdrchkType, HEADER_SIGBASE, HEADER_TAGBASE, headerFini(), headerInit(), headerIsEntry(), headerNext(), headerPut(), _HE_s::p, rpmDataType_u::ptr, RPM_BIN_TYPE, RPM_I18NSTRING_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, RPM_UINT16_TYPE, RPM_UINT32_TYPE, RPM_UINT64_TYPE, RPM_UINT8_TYPE, RPMSIGTAG_DSA, RPMSIGTAG_MD5, RPMSIGTAG_PAYLOADSIZE, RPMSIGTAG_RSA, RPMSIGTAG_SHA1, RPMSIGTAG_SIZE, RPMTAG_ARCHIVESIZE, RPMTAG_SIGMD5, RPMTAG_SIGSIZE, _HE_s::t, and _HE_s::tag.

Referenced by rpmReadPackageFile(), and writeRPM().

int headerMod | ( | Header | h,
|  | HE_t | he,
|  | unsigned int | flags |
| ) |  |  |

Modify tag container in header.

If there are multiple entries with this tag, the first one gets replaced.

Parameters:

  | h | header
  | he | tag container
  | flags | (unused)

Returns:
  1 on success, 0 on failure

Definition at line 2090 of file header.c.

References headerModifyEntry().

Referenced by relocateFileList().

static int headerModifyEntry | ( | Header | h,
|  | HE_t | he |
| ) |  |  | `[static]`

Modify tag in header.

If there are multiple entries with this tag, the first one gets replaced.

Parameters:

  | h | header
  | he | tag container

Returns:
  1 on success, 0 on failure

Definition at line 1809 of file header.c.

References _free(), _HE_s::c, entryInfo_s::count, indexEntry_s::data, ENTRY_IN_REGION, findEntry(), grabData(), headerToken_s::index, indexEntry_s::info, indexEntry_s::length, entryInfo_s::offset, _HE_s::p, rpmDataType_u::ptr, _HE_s::t, entryInfo_s::tag, _HE_s::tag, and entryInfo_s::type.

Referenced by headerMod().

int headerNEVRA | ( | Header | h,
|  | const char ** | np,
|  | const char ** | ep,
|  | const char ** | vp,
|  | const char ** | rp,
|  | const char ** | ap |
| ) |  |  |

Return name, epoch, version, release, arch strings from header.

Parameters:

  | h | header

Return values:

  | *np | name pointer (or NULL)
  | *ep | epoch pointer (or NULL)
  | *vp | version pointer (or NULL)
  | *rp | release pointer (or NULL)
  | *ap | arch pointer (or NULL)

Returns:
  0 always

Definition at line 154 of file hdrNVR.c.

References _free(), alloca(), _HE_s::c, headerGet(), headerIsEntry(), _HE_s::p, rpmDataType_u::ptr, RPM_STRING_TYPE, RPMTAG_ARCH, RPMTAG_NAME, RPMTAG_RELEASE, RPMTAG_SOURCERPM, RPMTAG_VERSION, rpmDataType_u::str, _HE_s::t, _HE_s::tag, and xstrdup().

Referenced by doSetupMacro(), genSourceRpmName(), hGetNVRA(), providePackageNVR(), rpmdbRebuild(), rpmdsNVRMatchesDep(), rpmdsThis(), and writeRPM().

Header headerNew | ( | void |  | ) |

Create new (empty) header instance.

Returns:
  header

Definition at line 166 of file header.c.

References headerToken_s::blob, headerToken_s::flags, header_magic, HEADERFLAG_SORTED, headerLink(), headerToken_s::index, INDEX_MALLOC_SIZE, headerToken_s::indexAlloced, headerToken_s::indexUsed, headerToken_s::instance, headerToken_s::magic, headerToken_s::nrefs, headerToken_s::origin, and xcalloc().

Referenced by headerCopy(), headerRegenSigHeader(), newPackage(), newSpec(), rpmcliImportPubkey(), rpmpsmStage(), rpmReSign(), rpmtsImportPubkey(), and writeRPM().

int headerNext | ( | HeaderIterator | hi,
|  | HE_t | he,
|  | unsigned int | flags |
| ) |  |  |

Return next tag from header.

Parameters:

  | hi | header tag iterator
  | he | tag container
  | flags | (unused)

Returns:
  1 on success, 0 on failure

Definition at line 1930 of file header.c.

References copyEntry(), ENTRY_IS_REGION, headerIterator_s::h, headerGetStats(), headerToken_s::index, headerToken_s::indexUsed, indexEntry_s::info, headerIterator_s::next_index, rpmheRealloc(), rpmswEnter(), rpmswExit(), entryInfo_s::tag, and _HE_s::tag.

Referenced by checkForDuplicates(), hdrKeyList(), headerCopy(), headerMergeLegacySigs(), headerRegenSigHeader(), hsaNext(), initSourceHeader(), rpmpsmStage(), rpmReSign(), and rpmVerifySignatures().

int headerPut | ( | Header | h,
|  | HE_t | he,
|  | unsigned int | flags |
| ) |  |  |

Add or append tag container to header.

Parameters:

  | h | header
  | he | tag container
  | flags | (unused)

Returns:
  1 on success, 0 on failure

Definition at line 2065 of file header.c.

References _HE_s::append, headerAddEntry(), and headerAddOrAppendEntry().

Referenced by addChangelogEntry(), addFileToArrayTag(), addFileToTag(), addOrAppendListEntry(), addReqProv(), compressFilelist(), doIcon(), fillOutMainPackage(), genCpioListAndHeader(), handlePreambleTag(), hCopyTag(), headerCopyTags(), headerMergeLegacySigs(), headerRegenSigHeader(), hSaveBlinks(), hSaveFlinks(), initSourceHeader(), makeHDRSignature(), packageBinaries(), packageSources(), parsePreamble(), parseScript(), parseSpec(), populateInstallHeader(), postPopulateInstallHeader(), processMetadataFile(), processScriptFiles(), providePackageNVR(), relocateFileList(), rpmAddSignature(), rpmcliImportPubkey(), rpmdbAdd(), rpmdbRemove(), rpmfcGenerateDepends(), rpmlibMarkers(), rpmpsmStage(), rpmReSign(), rpmtsImportPubkey(), and writeRPM().

Header headerRegenSigHeader | ( | const Header | h,
|  | int | noArchiveSize |
| ) |  |  |

Regenerate signature header.

Todo:
  Remove headerSort() through headerInitIterator() modifies h.

Parameters:

  | h | header
  | noArchiveSize | don't copy archive size tag (pre rpm-4.1)

Returns:
  regenerated signature header

Definition at line 302 of file hdrNVR.c.

References _free(), alloca(), HEADER_SIGBASE, HEADER_TAGBASE, headerFini(), headerInit(), headerIsEntry(), headerNew(), headerNext(), headerPut(), _HE_s::p, rpmDataType_u::ptr, RPMSIGTAG_MD5, RPMSIGTAG_PAYLOADSIZE, RPMSIGTAG_SIZE, RPMTAG_ARCHIVESIZE, RPMTAG_DSAHEADER, RPMTAG_RSAHEADER, RPMTAG_SHA1HEADER, RPMTAG_SIGMD5, RPMTAG_SIGSIZE, and _HE_s::tag.

Referenced by rpmpsmStage().

Header headerReload | ( | Header | h,
|  | int | tag |
| ) |  |  |

Convert header to on-disk representation, and then reload.

This is used to insure that all header data is in one chunk.

Parameters:

  | h | header (with pointers)
  | tag | region tag

Returns:
  on-disk header (with offsets)

Definition at line 1127 of file header.c.

References _free(), ENTRY_IS_REGION, headerToken_s::flags, HEADER_IMMUTABLE, HEADER_SIGNATURES, HEADERFLAG_ALLOCATED, headerFree(), headerLoad(), headerSetInstance(), headerSetOrigin(), headerUnload(), headerToken_s::index, indexEntry_s::info, headerToken_s::instance, headerToken_s::origin, entryInfo_s::tag, and xstrdup().

Referenced by headerCopy(), rpmpsmStage(), rpmReSign(), and writeRPM().

static int headerRemoveEntry | ( | Header | h,
|  | rpmTag | tag |
| ) |  |  | `[static]`

Delete tag in header.

Removes all entries of type tag from the header, returns 1 if none were found.

Parameters:

  | h | header
  | tag | tag

Returns:
  0 on success, 1 on failure (INCONSISTENT)

Definition at line 866 of file header.c.

References _free(), indexEntry_s::data, ENTRY_IN_REGION, findEntry(), headerToken_s::index, headerToken_s::indexUsed, indexEntry_s::info, indexEntry_s::length, and entryInfo_s::tag.

Referenced by headerDel(), and headerLoad().

uint32_t headerSetInstance | ( | Header | h,
|  | uint32_t | instance |
| ) |  |  |

Store header instance (e.g path or URL).

Parameters:

  | h | header
  | origin | new header instance

Returns:
  0 always

Definition at line 1120 of file header.c.

References headerToken_s::instance.

Referenced by headerReload(), rpmdbAdd(), rpmdbNextIterator(), and rpmpsmStage().

int headerSetMagic | ( | Header | h,
|  | unsigned char * | magic,
|  | size_t | nmagic |
| ) |  |  |

Store header magic.

Parameters:

  | h | header
  | magic | magic array
  | nmagic | no. bytes of magic

Returns:
  0 always

Definition at line 1089 of file header.c.

References headerToken_s::magic.

int headerSetOrigin | ( | Header | h,
|  | const char * | origin |
| ) |  |  |

Store header origin (e.g path or URL).

Parameters:

  | h | header
  | origin | new header origin

Returns:
  0 always

Definition at line 1106 of file header.c.

References _free(), headerToken_s::origin, and xstrdup().

Referenced by hdrSetOrigin(), headerReload(), rpmdbNextIterator(), and rpmReadHeader().

size_t headerSizeof | ( | Header | h | ) |

Return size of on-disk header representation in bytes.

Parameters:

  | h | header

Returns:
  size of on-disk header

Definition at line 243 of file header.c.

References entryInfo_s::count, ENTRY_IS_REGION, headerToken_s::flags, header_magic, HEADERFLAG_LEGACY, headerSort(), headerToken_s::index, indexEntry_s::info, indexEntry_s::length, entryInfo_s::offset, entryInfo_s::type, and typeSizes.

Referenced by rdSignature(), readFile(), rpmdbAdd(), and wrSignature().

static void headerSort | ( | Header | h | ) | `[static]`

Sort tags in header.

Parameters:

  | h | header

Definition at line 204 of file header.c.

References headerToken_s::flags, HEADERFLAG_SORTED, headerToken_s::index, indexCmp(), and headerToken_s::indexUsed.

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

char* headerSprintf | ( | Header | h,
|  | const char * | fmt,
|  | headerTagTableEntry | tags,
|  | headerSprintfExtension | exts,
|  | errmsg_t * | errmsg |
| ) |  |  |

Return formatted output string from header tags.

The returned string must be free()d.

Parameters:

  | h | header
  | fmt | format to use
  | tags | array of tag name/value/type triples (NULL uses default)
  | exts | formatting extensions chained table (NULL uses default)

Return values:

  | errmsg | error message (if any)

Returns:
  formatted output string (malloc'ed)

Definition at line 3043 of file hdrfmt.c.

References _free(), _hdr_debug, alloca(), headerSprintfArgs_s::alloced, sprintfToken_s::array, headerSprintfArgs_s::ec, headerSprintfArgs_s::errmsg, headerSprintfArgs_s::exts, headerSprintfArgs_s::fmt, headerSprintfArgs_s::format, freeFormat(), headerSprintfArgs_s::h, headerFree(), headerLink(), hsaFini(), hsaInit(), hsaNext(), hsaReserve(), headerSprintfArgs_s::nec, headerSprintfArgs_s::numTokens, parseFormat(), PARSER_BEGIN, rpmecFree(), rpmecNew(), rpmTagTable, singleSprintf(), stpcpy(), sprintfToken_s::tag, sprintfTag_s::tagno, headerSprintfArgs_s::tags, sprintfTag_s::type, sprintfToken_s::type, sprintfToken_s::u, headerSprintfArgs_s::val, headerSprintfArgs_s::vallen, xrealloc(), and xstrdup().

Referenced by hdrSprintf(), packageBinaries(), parseForSimple(), printNewSpecfile(), queryHeader(), rpmcliImportPubkey(), rpmfiNew(), rpmpsmStage(), rpmShowProgress(), rpmtsImportPubkey(), and rpmtsSolve().

Header headerUnlink | ( | Header | h | ) |

Dereference a header instance.

Parameters:

  | h | header

Returns:
  NULL always

Definition at line 113 of file header.c.

References _hdr_debug, and headerToken_s::nrefs.

Referenced by headerFree().

void* headerUnload | ( | Header | h,
|  | size_t * | lenp |
| ) |  |  |

Parameters:

  | h | header

Return values:

  | *lenp | no. bytes in unloaded header blob

Returns:
  unloaded header blob (NULL on error)

Definition at line 529 of file header.c.

References _free(), entryInfo_s::count, indexEntry_s::data, ENTRY_IS_REGION, headerToken_s::flags, hdrchkData, hdrchkTags, HEADERFLAG_LEGACY, HEADERFLAG_SORTED, headerGetStats(), headerSort(), headerUnsort(), headerToken_s::index, headerToken_s::indexUsed, indexEntry_s::info, indexEntry_s::length, entryInfo_s::offset, indexEntry_s::rdlen, regionSwab(), RPM_UINT16_TYPE, RPM_UINT32_TYPE, RPM_UINT64_TYPE, rpmswEnter(), rpmswExit(), entryInfo_s::tag, entryInfo_s::type, typeSizes, and xmalloc().

Referenced by hdrUnload(), headerReload(), miFreeHeader(), rpmdbAdd(), and rpmWriteHeader().

static void headerUnsort | ( | Header | h | ) | `[static]`

Restore tags in header to original ordering.

Parameters:

  | h | header

Definition at line 237 of file header.c.

References headerToken_s::index, headerToken_s::indexUsed, and offsetCmp().

Referenced by headerUnload().

static int headerUsageCount | ( | Header | h | ) | `[inline, static]`

Return header reference count.

Parameters:

  | h | header

Returns:
  no. of references

Definition at line 129 of file header_internal.h.

References headerToken_s::nrefs.

static uint32_t regionSwab | ( | indexEntry | entry,
|  | uint32_t | il,
|  | uint32_t | dl,
|  | entryInfo | pe,
|  | unsigned char * | dataStart,
|  | const unsigned char * | dataEnd,
|  | int32_t | regionid |
| ) |  |  | `[static]`

Swap uint32_t and uint16_t arrays within header region.

This code is way more twisty than I would like.

A bug with RPM_I18NSTRING_TYPE in rpm-2.5.x (fixed in August 1998) causes the offset and length of elements in a header region to disagree regarding the total length of the region data.

The "fix" is to compute the size using both offset and length and return the larger of the two numbers as the size of the region. Kinda like computing left and right Riemann sums of the data elements to determine the size of a data structure, go figger :-).

There's one other twist if a header region tag is in the set to be swabbed, as the data for a header region is located after all other tag data.

Parameters:

  | entry | header entry
  | il | no. of entries
  | dl | start no. bytes of data
  | pe | header physical entry pointer (swapped)
  | dataStart | header data start
  | dataEnd | header data end
  | regionid | region offset

Returns:
  no. bytes of data in region, 0 on error

Definition at line 386 of file header.c.

References entryInfo_s::count, indexEntry_s::data, dataLength(), hdrchkAlign, hdrchkData, hdrchkType, HEADER_I18NTABLE, HEADER_IMAGE, indexEntry_s::info, indexEntry_s::length, entryInfo_s::offset, rpmDataType_u::ptr, indexEntry_s::rdlen, REGION_TAG_COUNT, RPM_I18NSTRING_TYPE, RPM_UINT16_TYPE, RPM_UINT32_TYPE, RPM_UINT64_TYPE, entryInfo_s::tag, entryInfo_s::type, typeSizes, and rpmDataType_u::ui8p.

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

static rpmRC rpmWriteHeader | ( | FD_t | fd,
|  | Header | h,
|  | const char ** | msg |
| ) |  |  | `[static]`

Write (with unload) header to file handle.

Parameters:

  | fd | file handle
  | h | header

Returns:
  RPMRC_OK on success

Definition at line 68 of file pkgio.c.

References _, _free(), _pkgio_debug, Ferror(), Fstrerror(), Fwrite(), headerGetMagic(), headerUnload(), RPMRC_FAIL, RPMRC_OK, and xstrdup().

Referenced by wrHeader(), and wrSignature().

## Variable Documentation

unsigned char header_magic[8]`[static]`

Initial value:

     {
            0x8e, 0xad, 0xe8, 0x01, 0x00, 0x00, 0x00, 0x00
    }

Definition at line 34 of file header.c.

Referenced by headerGetMagic(), headerLoad(), headerNew(), and headerSizeof().

headerSprintfExtension headerCompoundFormats

Supported default header extension/tag output formats.

Definition at line 1714 of file hdrfmt.c.

Referenced by headerGet(), and queryHeader().

headerSprintfExtension headerDefaultFormats

Supported default header tag output formats.

Definition at line 275 of file hdrfmt.c.

size_t headerMaxbytes = (1024*1024*1024)`[static]`

Maximum no.

of bytes permitted in a header.

Definition at line 66 of file header.c.

Referenced by headerCopyLoad().

int typeSizes[16]`[static]`

Initial value:

      {
        0,
        1,
        1,
        2,
        4,
        8,
        -1,
        1,
        -1,
        -1,
        0,
        0,
        0,
        0,
        0,
        0
    }

Size of header data types.

Definition at line 43 of file header.c.

Referenced by dataLength(), headerSizeof(), headerUnload(), and regionSwab().