Files | ||||
file | formats.c | |||
file | package.c | |||
file | rpmlib.h | |||
In Memoriam: Steve Taylor <[email protected]> was here, now he's not. | ||||
file | hdrinline.h | |||
file | header.c | |||
file | header.h | |||
An rpm header carries all information about a package. | ||||
file | header_internal.c | |||
file | header_internal.h | |||
Data Structures | ||||
struct | headerToken_s | |||
The Header data structure. More... | ||||
Typedefs | ||||
typedef const char * | errmsg_t | |||
typedef int_32 * | hTAG_t | |||
typedef headerToken_s * | Header | |||
typedef headerIterator_s * | HeaderIterator | |||
typedef headerTagTableEntry_s * | headerTagTableEntry | |||
Associate tag names with numeric values. | ||||
typedef char *(*) | headerTagFormatFunction (int_32 type, const void *data, char *formatPrefix, int padding, int element) | |||
HEADER_EXT_TAG format function prototype. | ||||
typedef int(*) | headerTagTagFunction (Header h, hTYP_t type, hPTR_t *data, hCNT_t count, int *freeData) | |||
HEADER_EXT_FORMAT format function prototype. | ||||
typedef headerSprintfExtension_s * | headerSprintfExtension | |||
Define header tag output formats. | ||||
typedef enum rpmTagType_e | rpmTagType | |||
The basic types of data in tags from headers. | ||||
typedef enum rpmSubTagType_e | rpmSubTagType | |||
New rpm data types under consideration/development. | ||||
typedef Header(*) | HDRnew (void) | |||
Create new (empty) header instance. | ||||
typedef Header(*) | HDRfree (Header h) | |||
Dereference a header instance. | ||||
typedef Header(*) | HDRlink (Header h) | |||
Reference a header instance. | ||||
typedef Header(*) | HDRunlink (Header h) | |||
Dereference a header instance. | ||||
typedef void(*) | HDRsort (Header h) | |||
Sort tags in header. | ||||
typedef void(*) | HDRunsort (Header h) | |||
Restore tags in header to original ordering. | ||||
typedef unsigned int(*) | HDRsizeof (Header h, enum hMagic magicp) | |||
Return size of on-disk header representation in bytes. | ||||
typedef void *(*) | HDRunload (Header h) | |||
Convert header to on-disk representation. | ||||
typedef Header(*) | HDRreload (Header h, int tag) | |||
Convert header to on-disk representation, and then reload. | ||||
typedef Header(*) | HDRcopy (Header h) | |||
Duplicate a header. | ||||
typedef Header(*) | HDRload (void *uh) | |||
Convert header to in-memory representation. | ||||
typedef Header(*) | HDRcopyload (const void *uh) | |||
Make a copy and convert header to in-memory representation. | ||||
typedef Header(*) | HDRread (FD_t fd, enum hMagic magicp) | |||
Read (and load) header from file handle. | ||||
typedef int(*) | HDRwrite (FD_t fd, Header h, enum hMagic magicp) | |||
Write (with unload) header to file handle. | ||||
typedef int(*) | HDRisentry (Header h, int_32 tag) | |||
Check if tag is in header. | ||||
typedef void *(*) | HDRfreetag (Header h, const void *data, rpmTagType type) | |||
Free data allocated when retrieved from header. | ||||
typedef int(*) | HDRget (Header h, int_32 tag, hTYP_t type, void **p, hCNT_t c) | |||
Retrieve tag value. | ||||
typedef int(*) | HDRgetmin (Header h, int_32 tag, hTYP_t type, hPTR_t *p, hCNT_t c) | |||
Retrieve tag value using header internal array. | ||||
typedef int(*) | HDRadd (Header h, int_32 tag, int_32 type, const void *p, int_32 c) | |||
Add tag to header. | ||||
typedef int(*) | HDRappend (Header h, int_32 tag, int_32 type, const void *p, int_32 c) | |||
Append element to tag array in header. | ||||
typedef int(*) | HDRaddorappend (Header h, int_32 tag, int_32 type, const void *p, int_32 c) | |||
Add or append element to tag array in header. | ||||
typedef int(*) | HDRaddi18n (Header h, int_32 tag, const char *string, const char *lang) | |||
Add locale specific tag to header. | ||||
typedef int(*) | HDRmodify (Header h, int_32 tag, int_32 type, const void *p, int_32 c) | |||
Modify tag in header. | ||||
typedef int(*) | HDRremove (Header h, int_32 tag) | |||
Delete tag in header. | ||||
typedef char *(*) | HDRsprintf (Header h, const char *fmt, const struct headerTagTableEntry_s *tags, const struct headerSprintfExtension_s *extensions, errmsg_t *errmsg) | |||
Return formatted output string from header tags. | ||||
typedef void(*) | HDRcopytags (Header headerFrom, Header headerTo, hTAG_t tagstocopy) | |||
Duplicate tag values from one header into another. | ||||
typedef HeaderIterator(*) | HDRfreeiter (HeaderIterator hi) | |||
Destroy header tag iterator. | ||||
typedef HeaderIterator(*) | HDRinititer (Header h) | |||
Create header tag iterator. | ||||
typedef int(*) | HDRnextiter (HeaderIterator hi, hTAG_t tag, hTYP_t type, hPTR_t *p, hCNT_t c) | |||
Return next tag from header. | ||||
typedef HV_s * | HV_t | |||
Header method vectors. | ||||
typedef entryInfo_s * | entryInfo | |||
Description of tag data. | ||||
typedef indexEntry_s * | indexEntry | |||
A single tag from a Header. | ||||
typedef sprintfTag_s * | sprintfTag | |||
typedef rpmec_s * | rpmec | |||
Extension cache. | ||||
typedef sprintfToken_s * | sprintfToken | |||
Enumerations | ||||
enum | headerSprintfExtensionType { HEADER_EXT_LAST = 0, HEADER_EXT_FORMAT, HEADER_EXT_MORE, HEADER_EXT_TAG } | |||
enum | hMagic { HEADER_MAGIC_NO = 0, HEADER_MAGIC_YES = 1 } | |||
Include calculation for 8 bytes of (magic, 0)? More... | ||||
enum | rpmTagType_e { RPM_NULL_TYPE = 0, RPM_CHAR_TYPE = 1, RPM_INT8_TYPE = 2, RPM_INT16_TYPE = 3, RPM_INT32_TYPE = 4, RPM_STRING_TYPE = 6, RPM_BIN_TYPE = 7, RPM_STRING_ARRAY_TYPE = 8, RPM_I18NSTRING_TYPE } | |||
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 } | |||
New rpm data types under consideration/development. More... | ||||
Functions | ||||
int | headerNVR (Header h, const char **np, const char **vp, const char **rp) | |||
Return name, version, release strings from header. | ||||
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. | ||||
int | rpmHeaderGetEntry (Header h, int_32 tag, int_32 *type, void **p, int_32 *c) | |||
Retrieve tag info from header. | ||||
static HV_t | h2hv (Header h) | |||
static Header | headerNew (void) | |||
Create new (empty) header instance. | ||||
static Header | headerFree (Header h) | |||
Dereference a header instance. | ||||
static Header | headerLink (Header h) | |||
Reference a header instance. | ||||
static Header | headerUnlink (Header h) | |||
Dereference a header instance. | ||||
static void | headerSort (Header h) | |||
Sort tags in header. | ||||
static void | headerUnsort (Header h) | |||
Restore tags in header to original ordering. | ||||
static unsigned int | headerSizeof (Header h, enum hMagic magicp) | |||
Return size of on-disk header representation in bytes. | ||||
static void * | headerUnload (Header h) | |||
Convert header to on-disk representation. | ||||
static Header | headerReload (Header h, int tag) | |||
Convert header to on-disk representation, and then reload. | ||||
static Header | headerCopy (Header h) | |||
Duplicate a header. | ||||
static Header | headerLoad (void *uh) | |||
Convert header to in-memory representation. | ||||
static Header | headerCopyLoad (const void *uh) | |||
Make a copy and convert header to in-memory representation. | ||||
static Header | headerRead (FD_t fd, enum hMagic magicp) | |||
Read (and load) header from file handle. | ||||
static int | headerWrite (FD_t fd, Header h, enum hMagic magicp) | |||
Write (with unload) header to file handle. | ||||
static int | headerIsEntry (Header h, int_32 tag) | |||
Check if tag is in header. | ||||
static void * | headerFreeTag (Header h, const void *data, rpmTagType type) | |||
Free data allocated when retrieved from header. | ||||
static int | headerGetEntry (Header h, int_32 tag, hTYP_t type, void **p, hCNT_t c) | |||
Retrieve tag value. | ||||
static int | headerGetEntryMinMemory (Header h, int_32 tag, hTYP_t type, hPTR_t *p, hCNT_t c) | |||
Retrieve tag value using header internal array. | ||||
static int | headerAddEntry (Header h, int_32 tag, int_32 type, const void *p, int_32 c) | |||
Add tag to header. | ||||
static int | headerAppendEntry (Header h, int_32 tag, int_32 type, const void *p, int_32 c) | |||
Append element to tag array in header. | ||||
static int | headerAddOrAppendEntry (Header h, int_32 tag, int_32 type, const void *p, int_32 c) | |||
Add or append element to tag array in header. | ||||
static int | headerAddI18NString (Header h, int_32 tag, const char *string, const char *lang) | |||
Add locale specific tag to header. | ||||
static int | headerModifyEntry (Header h, int_32 tag, int_32 type, const void *p, int_32 c) | |||
Modify tag in header. | ||||
static int | headerRemoveEntry (Header h, int_32 tag) | |||
Delete tag in header. | ||||
static char * | headerSprintf (Header h, const char *fmt, const struct headerTagTableEntry_s *tbltags, const struct headerSprintfExtension_s *extensions, errmsg_t *errmsg) | |||
Return formatted output string from header tags. | ||||
static void | headerCopyTags (Header headerFrom, Header headerTo, hTAG_t tagstocopy) | |||
Duplicate tag values from one header into another. | ||||
static HeaderIterator | headerFreeIterator (HeaderIterator hi) | |||
Destroy header tag iterator. | ||||
static HeaderIterator | headerInitIterator (Header h) | |||
Create header tag iterator. | ||||
static int | headerNextIterator (HeaderIterator hi, hTAG_t tag, hTYP_t type, hPTR_t *p, hCNT_t c) | |||
Return next tag from header. | ||||
static int | regionSwab (indexEntry entry, int il, int dl, entryInfo pe, unsigned char *dataStart, const unsigned char *dataEnd, int regionid) | |||
Swap int_32 and int_16 arrays within header region. | ||||
static void * | doHeaderUnload (Header h, int *lengthPtr) | |||
| ||||
static int | copyEntry (const indexEntry entry, hTYP_t type, hPTR_t *p, hCNT_t c, int minMem) | |||
Retrieve data from header entry. | ||||
static void * | headerFreeData (const void *data, rpmTagType type) | |||
Free data allocated when retrieved from header. | ||||
char ** | headerGetLangs (Header h) | |||
Return array of locales found in header. | ||||
int | headerGetRawEntry (Header h, int_32 tag, hTYP_t type, hPTR_t *p, hCNT_t c) | |||
Retrieve tag value with type match. | ||||
static int | headerUsageCount (Header h) | |||
Return header reference count. | ||||
void | headerDump (Header h, FILE *f, int flags, const struct headerTagTableEntry_s *tags) | |||
Dump a header in human readable format (for debugging). | ||||
char * | bin2hex (const char *data, size_t count) | |||
Convert binary blob to printable hex string. | ||||
Variables | ||||
HV_s * | hdrVec | |||
Header methods for rpm headers. | ||||
static unsigned char | header_magic [8] | |||
static int | typeAlign [16] | |||
Alignment needed for header data types. | ||||
static int | typeSizes [16] | |||
Size of header data types. | ||||
static size_t | headerMaxbytes = (32*1024*1024) | |||
Maximum no. | ||||
headerSprintfExtension_s | headerDefaultFormats [] | |||
Supported default header tag output formats. |
typedef struct entryInfo_s* entryInfo |
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.
h | header | |
tag | tag | |
type | tag value data type | |
p | pointer to tag value(s) | |
c | number of values |
typedef int(*) HDRaddi18n(Header h, int_32 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()). *
h | header | |
tag | tag | |
string | tag value | |
lang | locale |
typedef int(*) HDRaddorappend(Header h, int_32 tag, int_32 type, const void *p, int_32 c) |
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. Any pointers into header memory returned from headerGetEntryMinMemory() for this entry are invalid after this call has been made!
h | header | |
tag | tag | |
type | tag value data type | |
p | pointer to tag value(s) | |
c | number of values |
typedef Header(*) HDRcopyload(const void *uh) |
typedef void(*) HDRcopytags(Header headerFrom, Header headerTo, hTAG_t tagstocopy) |
typedef HeaderIterator(*) HDRfreeiter(HeaderIterator hi) |
typedef void*(*) HDRfreetag(Header h,const void *data, rpmTagType type) |
Retrieve tag value.
Will never return RPM_I18NSTRING_TYPE! RPM_STRING_TYPE elements with RPM_I18NSTRING_TYPE equivalent entries are translated (if HEADER_I18NTABLE entry is present).
h | header | |
tag | tag |
type | address of tag value data type (or NULL) | |
p | address of pointer to tag value(s) (or NULL) | |
c | address of number of values (or NULL) |
Retrieve tag value using header internal array.
Get an entry using as little extra RAM as possible to return the tag value. This is only an issue for RPM_STRING_ARRAY_TYPE.
h | header | |
tag | tag |
type | address of tag value data type (or NULL) | |
p | address of pointer to tag value(s) (or NULL) | |
c | address of number of values (or NULL) |
typedef HeaderIterator(*) HDRinititer(Header h) |
typedef int(*) HDRisentry(Header h, int_32 tag) |
typedef int(*) HDRnextiter(HeaderIterator hi,hTAG_t tag,hTYP_t type,hPTR_t *p,hCNT_t c) |
typedef char*(*) HDRsprintf(Header h, const char *fmt, const struct headerTagTableEntry_s *tags, const struct headerSprintfExtension_s *extensions,errmsg_t *errmsg) |
Return formatted output string from header tags.
The returned string must be free()d.
h | header | |
fmt | format to use | |
tags | array of tag name/value pairs | |
extensions | chained table of formatting extensions. |
errmsg | error message (if any) |
typedef struct headerToken_s* Header |
typedef struct headerIterator_s* HeaderIterator |
typedef struct headerSprintfExtension_s* headerSprintfExtension |
typedef char*(*) headerTagFormatFunction(int_32 type, const void *data, char *formatPrefix, int padding, int element) |
HEADER_EXT_TAG format function prototype.
This will only ever be passed RPM_INT32_TYPE or RPM_STRING_TYPE to help keep things simple.
type | tag type | |
data | tag value | |
formatPrefix | ||
padding | ||
element | RPM_BIN_TYPE: no. bytes of data |
typedef struct headerTagTableEntry_s* headerTagTableEntry |
typedef int(*) headerTagTagFunction(Header h,hTYP_t type,hPTR_t *data,hCNT_t count,int *freeData) |
HEADER_EXT_FORMAT format function prototype.
This is allowed to fail, which indicates the tag doesn't exist.
h | header |
*type | tag type | |
*data | tag value | |
*count | no. of data items | |
*freedata | data-was-malloc'ed indicator |
typedef struct indexEntry_s* indexEntry |
typedef enum rpmSubTagType_e rpmSubTagType |
New rpm data types under consideration/development.
These data types may (or may not) be added to rpm at some point. In order to avoid incompatibility with legacy versions of rpm, these data (sub-)types are introduced into the header by overloading RPM_BIN_TYPE, with the binary value of the tag a 16 byte image of what should/will be in the header index, followed by per-tag private data.
typedef enum rpmTagType_e rpmTagType |
The basic types of data in tags from headers.
typedef struct sprintfTag_s* sprintfTag |
Definition at line 75 of file header_internal.h.
typedef struct sprintfToken_s* sprintfToken |
Definition at line 107 of file header_internal.h.
HEADER_EXT_LAST | End of extension chain. |
HEADER_EXT_FORMAT | headerTagFormatFunction() extension |
HEADER_EXT_MORE | Chain to next table. |
HEADER_EXT_TAG | headerTagTagFunction() extension |
enum hMagic |
enum rpmSubTagType_e |
New rpm data types under consideration/development.
These data types may (or may not) be added to rpm at some point. In order to avoid incompatibility with legacy versions of rpm, these data (sub-)types are introduced into the header by overloading RPM_BIN_TYPE, with the binary value of the tag a 16 byte image of what should/will be in the header index, followed by per-tag private data.
enum rpmTagType_e |
char* bin2hex | ( | const char * | data, | |
size_t | count | |||
) |
Convert binary blob to printable hex string.
data | binary data | |
size | size of data in bytes |
Definition at line 176 of file header_internal.c.
References headerTagTableEntry_s::val, and xmalloc().
Referenced by formatValue().
static int copyEntry | ( | const indexEntry | entry, | |
hTYP_t | type, | |||
hPTR_t * | p, | |||
hCNT_t | c, | |||
int | minMem | |||
) | [static] |
Retrieve data from header entry.
entry | header entry |
type | address of type (or NULL) | |
p | address of data (or NULL) | |
c | address of count (or NULL) |
minMem | string pointers refer to header memory? |
Definition at line 1400 of file header.c.
References entryInfo_s::count, ENTRY_IS_REGION, HEADER_IMAGE, indexEntry_s::info, REGION_TAG_COUNT, regionSwab(), RPM_BIN_TYPE, RPM_I18NSTRING_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, entryInfo_s::type, and xmalloc().
Referenced by headerGetRawEntry(), and intGetEntry().
static void* doHeaderUnload | ( | Header | h, | |
int * | lengthPtr | |||
) | [static] |
h | header |
*lengthPtr | no. bytes in unloaded header blob |
Definition at line 608 of file header.c.
References _free(), entryInfo_s::count, indexEntry_s::data, ENTRY_IS_REGION, headerToken_s::flags, hdrchkData, hdrchkTags, HEADERFLAG_LEGACY, HEADERFLAG_SORTED, headerSort(), headerUnsort(), headerToken_s::index, headerToken_s::indexUsed, indexEntry_s::info, indexEntry_s::length, entryInfo_s::offset, indexEntry_s::rdlen, regionSwab(), RPM_INT16_TYPE, RPM_INT32_TYPE, entryInfo_s::tag, entryInfo_s::type, typeSizes, and xmalloc().
Definition at line 22 of file hdrinline.h.
Referenced by headerAddEntry(), headerAddI18NString(), headerAddOrAppendEntry(), headerAppendEntry(), headerCopy(), headerFree(), headerFreeTag(), headerGetEntry(), headerGetEntryMinMemory(), headerIsEntry(), headerLink(), headerModifyEntry(), headerReload(), headerRemoveEntry(), headerSizeof(), headerSort(), headerSprintf(), headerUnlink(), headerUnload(), headerUnsort(), and headerWrite().
static int headerAddEntry | ( | Header | h, | |
int_32 | tag, | |||
int_32 | type, | |||
const void * | p, | |||
int_32 | c | |||
) | [inline, 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.
h | header | |
tag | tag | |
type | tag value data type | |
p | pointer to tag value(s) | |
c | number of values |
Definition at line 315 of file hdrinline.h.
References h2hv(), and HV_s::hdradd.
Referenced by addChangelogEntry(), addFileToTag(), compressFilelist(), expandFilelist(), fillOutMainPackage(), genCpioListAndHeader(), handlePreambleTag(), headerCopyWithConvert(), headerInject(), headerMergeLegacySigs(), headerRegenSigHeader(), initSourceHeader(), legacyRetrofit(), makeHDRSignature(), mungeFilelist(), packageBinaries(), packageSources(), parsePreamble(), parseScript(), parseSpec(), readIcon(), rhnLoad(), rhnUnload(), rpmAddSignature(), rpmcliImportPubkey(), rpmdbAdd(), rpmdbRemove(), rpmfcGenerateDepends(), rpmfiNew(), rpmMergeHeaders(), rpmpsmStage(), rpmReSign(), rpmxpProcess(), and writeRPM().
static int headerAddI18NString | ( | Header | h, | |
int_32 | tag, | |||
const char * | string, | |||
const char * | lang | |||
) | [inline, static] |
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()). *
h | header | |
tag | tag | |
string | tag value | |
lang | locale |
Definition at line 382 of file hdrinline.h.
References h2hv(), and HV_s::hdraddi18n.
Referenced by handlePreambleTag(), parseDescription(), and rpmxpProcess().
static int headerAddOrAppendEntry | ( | Header | h, | |
int_32 | tag, | |||
int_32 | type, | |||
const void * | p, | |||
int_32 | c | |||
) | [inline, static] |
Add or append element to tag array in header.
h | header | |
tag | tag | |
type | tag value data type | |
p | pointer to tag value(s) | |
c | number of values |
Definition at line 354 of file hdrinline.h.
References h2hv(), and HV_s::hdraddorappend.
Referenced by addFileToArrayTag(), addOrAppendListEntry(), addReqProv(), ftsCacheUpdate(), genCpioListAndHeader(), processMetadataFile(), processScriptFiles(), processSourceFiles(), providePackageNVR(), rpmcliImportPubkey(), and rpmxpProcess().
static int headerAppendEntry | ( | Header | h, | |
int_32 | tag, | |||
int_32 | type, | |||
const void * | p, | |||
int_32 | c | |||
) | [inline, 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. Any pointers into header memory returned from headerGetEntryMinMemory() for this entry are invalid after this call has been made!
h | header | |
tag | tag | |
type | tag value data type | |
p | pointer to tag value(s) | |
c | number of values |
Definition at line 336 of file hdrinline.h.
References h2hv(), and HV_s::hdrappend.
Referenced by addChangelogEntry().
Duplicate a header.
h | header |
Definition at line 163 of file hdrinline.h.
References h2hv(), and HV_s::hdrcopy.
Referenced by hdrUnload(), and rpmdbRebuild().
static Header headerCopyLoad | ( | const void * | uh | ) | [inline, static] |
Make a copy and convert header to in-memory representation.
uh | on-disk header blob (i.e. with offsets) |
Definition at line 187 of file hdrinline.h.
References HV_s::hdrcopyload, and hdrVec.
Referenced by rpmdbNextIterator(), rpmpsmStage(), and rpmReSign().
static void headerCopyTags | ( | Header | headerFrom, | |
Header | headerTo, | |||
hTAG_t | tagstocopy | |||
) | [inline, static] |
Duplicate tag values from one header into another.
headerFrom | source header | |
headerTo | destination header | |
tagstocopy | array of tags that are copied |
Definition at line 451 of file hdrinline.h.
References HV_s::hdrcopytags, and hdrVec.
Referenced by headerInject(), packageBinaries(), and parsePreamble().
void headerDump | ( | Header | h, | |
FILE * | f, | |||
int | flags, | |||
const struct headerTagTableEntry_s * | tags | |||
) |
Dump a header in human readable format (for debugging).
h | header | |
f | file handle | |
flags | 0 or HEADER_DUMP_INLINE | |
tags | array of tag name/value pairs |
Definition at line 35 of file header_internal.c.
References _, entryInfo_s::count, indexEntry_s::data, HEADER_DUMP_INLINE, headerToken_s::index, headerToken_s::indexUsed, indexEntry_s::info, headerTagTableEntry_s::name, entryInfo_s::offset, RPM_BIN_TYPE, RPM_CHAR_TYPE, RPM_I18NSTRING_TYPE, RPM_INT16_TYPE, RPM_INT32_TYPE, RPM_INT8_TYPE, RPM_NULL_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, entryInfo_s::tag, entryInfo_s::type, headerTagTableEntry_s::type, and headerTagTableEntry_s::val.
Referenced by main(), and spewHeader().
Dereference a header instance.
h | header |
Definition at line 47 of file hdrinline.h.
References h2hv(), and HV_s::hdrfree.
Referenced by _rpmtsAddRollbackElement(), delTE(), freeItem(), freePackage(), freeSpec(), ftsStashLatest(), getRepackageHeaderFromTE(), hdr_dealloc(), hdrLoad(), hdrUnload(), headerInject(), IDTXfree(), IDTXglob(), main(), makeHDRSignature(), miFreeHeader(), readFile(), readRPM(), rhnLoad(), rhnUnload(), rpmcliImportPubkey(), rpmdb_subscript(), rpmdbFindByFile(), rpmdbRebuild(), rpmdsFree(), rpmfiFree(), rpmFreeSignature(), rpmgiFree(), rpmgiLoadReadHeader(), rpmgiNext(), rpmgiReadHeader(), rpmgiWalkReadHeader(), rpmGraph(), rpmInstall(), rpmInstallSourcePackage(), rpmMergeHeaders(), rpmpsmStage(), rpmReadHeader(), rpmReadHeaders(), rpmReadPackageFile(), rpmReadSignature(), rpmReSign(), rpmRollback(), rpmSingleHeaderFromFD(), rpmteSetHeader(), rpmts_HdrFromFdno(), rpmtsRun(), rpmtsSolve(), rpmxpProcess(), and writeRPM().
static void* headerFreeData | ( | const void * | data, | |
rpmTagType | type | |||
) | [inline, static] |
Free data allocated when retrieved from header.
data | address of data (or NULL) | |
type | type of data (or -1 to force free) |
Definition at line 704 of file header.h.
References RPM_BIN_TYPE, RPM_I18NSTRING_TYPE, and RPM_STRING_ARRAY_TYPE.
Referenced by addReqProv(), compressFilelist(), formatValue(), getSignid(), handleOneTrigger(), handlePreambleTag(), headerMergeLegacySigs(), headerRegenSigHeader(), initSourceHeader(), instprefixTag(), isMemberInEntry(), makeHDRSignature(), mireSkip(), providePackageNVR(), readFile(), relocateFileList(), rhnUnload(), rpmdbAdd(), rpmdbFindByFile(), rpmdbFindFpList(), rpmdbRemove(), rpmdsFree(), rpmfiBuildFNames(), rpmfiFree(), rpmfiNew(), rpmInstall(), rpmMergeHeaders(), rpmpsmStage(), rpmReadPackageFile(), rpmReSign(), rpmtsCleanDig(), rpmtsFindPubkey(), rpmtsSetSig(), rpmVerifySignatures(), runImmedTriggers(), runInstScript(), runScript(), timeCheck(), triggercondsTag(), and triggertypeTag().
static HeaderIterator headerFreeIterator | ( | HeaderIterator | hi | ) | [inline, static] |
Destroy header tag iterator.
hi | header tag iterator |
Definition at line 466 of file hdrinline.h.
References HV_s::hdrfreeiter, and hdrVec.
Referenced by checkForDuplicates(), hdrKeyList(), headerCopyWithConvert(), headerMergeLegacySigs(), headerRegenSigHeader(), hsaFini(), initSourceHeader(), rpmMergeHeaders(), rpmpsmStage(), rpmReSign(), and rpmVerifySignatures().
static void * headerFreeTag | ( | Header | h, | |
const void * | data, | |||
rpmTagType | type | |||
) | [inline, static] |
Free data allocated when retrieved from header.
h | header | |
data | pointer to tag value(s) | |
type | type of data (or -1 to force free) |
Definition at line 247 of file hdrinline.h.
References h2hv(), and HV_s::hdrfreetag.
static int headerGetEntry | ( | Header | h, | |
int_32 | tag, | |||
hTYP_t | type, | |||
void ** | p, | |||
hCNT_t | c | |||
) | [inline, static] |
Retrieve tag value.
Will never return RPM_I18NSTRING_TYPE! RPM_STRING_TYPE elements with RPM_I18NSTRING_TYPE equivalent entries are translated (if HEADER_I18NTABLE entry is present).
h | header | |
tag | tag |
*type | tag value data type (or NULL) | |
*p | pointer to tag value(s) (or NULL) | |
*c | number of values (or NULL) |
Definition at line 268 of file hdrinline.h.
References h2hv(), and HV_s::hdrget.
Referenced by formatValue(), ftsStashLatest(), getRepackageHeaderFromTE(), getSignid(), headerCheckPayloadFormat(), headerNEVRA(), headerNVR(), hGetNEVRA(), IDTXglob(), IDTXload(), legacyRetrofit(), main(), makeHDRSignature(), readFile(), rhnLoad(), rhnUnload(), rpmdsNew(), rpmfiNew(), rpmHeaderGetEntry(), rpmInstall(), rpmMergeHeaders(), rpmpsmStage(), rpmReadPackageFile(), rpmReadSignature(), rpmReSign(), rpmteNew(), rpmtsFindPubkey(), rpmtsSolve(), rpmVerifySignatures(), rpmVersionCompare(), singleSprintf(), and writeRPM().
static int headerGetEntryMinMemory | ( | Header | h, | |
int_32 | tag, | |||
hTYP_t | type, | |||
hPTR_t * | p, | |||
hCNT_t | c | |||
) | [inline, static] |
Retrieve tag value using header internal array.
Get an entry using as little extra RAM as possible to return the tag value. This is only an issue for RPM_STRING_ARRAY_TYPE.
h | header | |
tag | tag |
*type | tag value data type (or NULL) | |
*p | pointer to tag value(s) (or NULL) | |
*c | number of values (or NULL) |
Definition at line 290 of file hdrinline.h.
References h2hv(), and HV_s::hdrgetmin.
Referenced by addFileToTag(), addReqProv(), addTE(), compressFilelist(), fssizesTag(), ftsCacheUpdate(), handlePreambleTag(), hGetColor(), i18nTag(), instprefixTag(), isMemberInEntry(), mireSkip(), processPackageFiles(), providePackageNVR(), rpmdbAdd(), rpmdbFindByFile(), rpmdbFindFpList(), rpmdbRemove(), rpmdsNew(), rpmdsNVRMatchesDep(), rpmdsThis(), rpmfiBuildFNames(), rpmfiNew(), rpmtsAddInstallElement(), stashSt(), timeCheck(), triggercondsTag(), triggertypeTag(), and writeRPM().
char** headerGetLangs | ( | Header | h | ) |
Return array of locales found in header.
The array is terminated with a NULL sentinel.
h | header |
Definition at line 13 of file header_internal.c.
References HEADER_I18NTABLE, headerGetRawEntry(), and xcalloc().
Retrieve tag value with type match.
If *type is RPM_NULL_TYPE any type will match, otherwise only *type will match.
h | header | |
tag | tag |
type | address of tag value data type (or NULL) | |
p | address of pointer to tag value(s) (or NULL) | |
c | address of number of values (or NULL) |
static HeaderIterator headerInitIterator | ( | Header | h | ) | [inline, static] |
Create header tag iterator.
h | header |
Definition at line 478 of file hdrinline.h.
References HV_s::hdrinititer, and hdrVec.
Referenced by checkForDuplicates(), hdrKeyList(), headerCopyWithConvert(), headerMergeLegacySigs(), headerRegenSigHeader(), hsaInit(), initSourceHeader(), rpmMergeHeaders(), rpmpsmStage(), rpmReSign(), and rpmVerifySignatures().
Check if tag is in header.
h | header | |
tag | tag |
Definition at line 230 of file hdrinline.h.
References h2hv(), and HV_s::hdrisentry.
Referenced by addChangelogEntry(), addTE(), checkForRequired(), checkSpec(), compressFilelist(), expandFilelist(), fillOutMainPackage(), headerGetRawEntry(), headerInject(), headerMergeLegacySigs(), headerRegenSigHeader(), IDTXglob(), legacyRetrofit(), makeHDRSignature(), mungeFilelist(), parseDescription(), parseScript(), parseSpec(), readFile(), relocateFileList(), rhnLoad(), rhnUnload(), rpmdbAdd(), rpmdbNextIterator(), rpmdbRebuild(), rpmInstall(), rpmInstallSourcePackage(), rpmpsmStage(), rpmReadPackageFile(), rpmtsAddInstallElement(), rpmVerifySignatures(), showVerifyPackage(), singleSprintf(), and spewHeader().
Reference a header instance.
h | header |
Definition at line 62 of file hdrinline.h.
References h2hv(), and HV_s::hdrlink.
Referenced by _rpmtsAddRollbackElement(), ftsStashLatest(), getRepackageHeaderFromTE(), hdr_Wrap(), hdrUnload(), IDTXglob(), IDTXload(), relocateFileList(), rhnUnload(), rpmdbFindByFile(), rpmdbRemove(), rpmdsDup(), rpmdsNew(), rpmfiNew(), rpmgiLoadReadHeader(), rpmgiNext(), rpmgiWalkReadHeader(), rpmInstallSourcePackage(), rpmpsmStage(), rpmReadHeader(), rpmReadPackageFile(), rpmReadSignature(), rpmReSign(), rpmteHeader(), rpmteSetHeader(), rpmtsSolve(), and writeRPM().
static Header headerLoad | ( | void * | uh | ) | [inline, static] |
Convert header to in-memory representation.
uh | on-disk header blob (i.e. with offsets) |
Definition at line 175 of file hdrinline.h.
References HV_s::hdrload, and hdrVec.
Referenced by hdrLoad(), rhnLoad(), rhnUnload(), rpmdbNextIterator(), rpmReadHeader(), and rpmReadSignature().
Translate and merge legacy signature tags into header.
h | header | |
sigh | signature header |
Definition at line 98 of file package.c.
References hdrchkData, hdrchkType, HEADER_SIGBASE, HEADER_TAGBASE, headerAddEntry(), headerFreeData(), headerFreeIterator(), headerInitIterator(), headerIsEntry(), headerNextIterator(), RPM_BIN_TYPE, RPM_CHAR_TYPE, RPM_I18NSTRING_TYPE, RPM_INT16_TYPE, RPM_INT32_TYPE, RPM_INT8_TYPE, RPM_NULL_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, RPMSIGTAG_DSA, RPMSIGTAG_GPG, RPMSIGTAG_LEMD5_1, RPMSIGTAG_LEMD5_2, RPMSIGTAG_MD5, RPMSIGTAG_PAYLOADSIZE, RPMSIGTAG_PGP, RPMSIGTAG_PGP5, RPMSIGTAG_RSA, RPMSIGTAG_SHA1, RPMSIGTAG_SIZE, RPMTAG_ARCHIVESIZE, RPMTAG_SIGGPG, RPMTAG_SIGLEMD5_1, RPMTAG_SIGLEMD5_2, RPMTAG_SIGMD5, RPMTAG_SIGPGP, RPMTAG_SIGPGP5, and RPMTAG_SIGSIZE.
Referenced by rpmReadPackageFile(), and writeRPM().
static int headerModifyEntry | ( | Header | h, | |
int_32 | tag, | |||
int_32 | type, | |||
const void * | p, | |||
int_32 | c | |||
) | [inline, static] |
Modify tag in header.
If there are multiple entries with this tag, the first one gets replaced.
h | header | |
tag | tag | |
type | tag value data type | |
p | pointer to tag value(s) | |
c | number of values |
Definition at line 400 of file hdrinline.h.
References h2hv(), and HV_s::hdrmodify.
Referenced by rpmfiNew().
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.
h | header |
*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) |
Definition at line 34 of file hdrNVR.c.
References headerGetEntry(), RPM_STRING_TYPE, RPMTAG_ARCH, RPMTAG_NAME, RPMTAG_RELEASE, and RPMTAG_VERSION.
static Header headerNew | ( | void | ) | [inline, static] |
Create new (empty) header instance.
Definition at line 35 of file hdrinline.h.
References HV_s::hdrnew, and hdrVec.
Referenced by headerCopyWithConvert(), initSourceHeader(), newPackage(), newSpec(), rpmcliImportPubkey(), rpmNewSignature(), rpmpsmStage(), rpmReSign(), and rpmxpProcess().
static int headerNextIterator | ( | HeaderIterator | hi, | |
hTAG_t | tag, | |||
hTYP_t | type, | |||
hPTR_t * | p, | |||
hCNT_t | c | |||
) | [inline, static] |
Return next tag from header.
hi | header tag iterator |
*tag | tag | |
*type | tag value data type | |
*p | pointer to tag value(s) | |
*c | number of values |
Definition at line 494 of file hdrinline.h.
References HV_s::hdrnextiter, and hdrVec.
Referenced by checkForDuplicates(), hdrKeyList(), headerCopyWithConvert(), headerMergeLegacySigs(), headerRegenSigHeader(), hsaNext(), initSourceHeader(), rpmMergeHeaders(), rpmpsmStage(), rpmReSign(), and rpmVerifySignatures().
int headerNVR | ( | Header | h, | |
const char ** | np, | |||
const char ** | vp, | |||
const char ** | rp | |||
) |
Return name, version, release strings from header.
h | header |
*np | name pointer (or NULL) | |
*vp | version pointer (or NULL) | |
*rp | release pointer (or NULL) |
Definition at line 9 of file hdrNVR.c.
References headerGetEntry(), RPM_STRING_TYPE, RPMTAG_NAME, RPMTAG_RELEASE, and RPMTAG_VERSION.
Referenced by doSetupMacro(), genSourceRpmName(), handleOneTrigger(), hGetNEVR(), hGetNEVRA(), i18nTag(), lookupPackage(), packageBinaries(), parsePreamble(), parseSpec(), printNewSpecfile(), processBinaryFiles(), providePackageNVR(), rpmdbRebuild(), rpmdbRemove(), rpmdsNVRMatchesDep(), rpmdsThis(), rpmInstall(), rpmtsCallback(), runScript(), and writeRPM().
Read (and load) header from file handle.
fd | file handle | |
magicp | read (and verify) 8 bytes of (magic, 0)? |
Definition at line 200 of file hdrinline.h.
References HV_s::hdrread, and hdrVec.
Referenced by main(), makeHDRSignature(), readFile(), rpmgiNext(), rpmMergeHeaders(), rpmReadHeaders(), rpmSingleHeaderFromFD(), and writeRPM().
Regenerate signature header.
h | header | |
noArchiveSize | don't copy archive size tag (pre rpm-4.1) |
Definition at line 178 of file package.c.
References HEADER_SIGBASE, HEADER_TAGBASE, headerAddEntry(), headerFreeData(), headerFreeIterator(), headerInitIterator(), headerIsEntry(), headerNextIterator(), rpmNewSignature(), RPMSIGTAG_GPG, RPMSIGTAG_LEMD5_1, RPMSIGTAG_LEMD5_2, RPMSIGTAG_MD5, RPMSIGTAG_PAYLOADSIZE, RPMSIGTAG_PGP, RPMSIGTAG_PGP5, RPMSIGTAG_SIZE, RPMTAG_ARCHIVESIZE, RPMTAG_DSAHEADER, RPMTAG_RSAHEADER, RPMTAG_SHA1HEADER, RPMTAG_SIGGPG, RPMTAG_SIGLEMD5_1, RPMTAG_SIGLEMD5_2, RPMTAG_SIGMD5, RPMTAG_SIGPGP, RPMTAG_SIGPGP5, and RPMTAG_SIGSIZE.
Referenced by rpmpsmStage().
Convert header to on-disk representation, and then reload.
This is used to insure that all header data is in one chunk.
h | header (with pointers) | |
tag | region tag |
Definition at line 149 of file hdrinline.h.
References h2hv(), and HV_s::hdrreload.
Referenced by rhnUnload(), rpmpsmStage(), rpmReSign(), and writeRPM().
Delete tag in header.
Removes all entries of type tag from the header, returns 1 if none were found.
h | header | |
tag | tag |
Definition at line 417 of file hdrinline.h.
References h2hv(), and HV_s::hdrremove.
Referenced by addFileToTag(), compressFilelist(), expandFilelist(), legacyRetrofit(), rpmdbAdd(), rpmfcGenerateDepends(), rpmfiNew(), rpmMergeHeaders(), and rpmReSign().
Return size of on-disk header representation in bytes.
h | header | |
magicp | include size of 8 bytes for (magic, 0)? |
Definition at line 120 of file hdrinline.h.
References h2hv(), and HV_s::hdrsizeof.
Referenced by hdrUnload(), miFreeHeader(), readFile(), rhnUnload(), rpmdbAdd(), rpmReadSignature(), and rpmWriteSignature().
static void headerSort | ( | Header | h | ) | [inline, static] |
Sort tags in header.
h | header |
Definition at line 89 of file hdrinline.h.
References h2hv(), and HV_s::hdrsort.
Referenced by doHeaderUnload(), findEntry(), and headerInject().
static char * headerSprintf | ( | Header | h, | |
const char * | fmt, | |||
const struct headerTagTableEntry_s * | tbltags, | |||
const struct headerSprintfExtension_s * | extensions, | |||
errmsg_t * | errmsg | |||
) | [inline, static] |
Return formatted output string from header tags.
The returned string must be free()d.
h | header | |
fmt | format to use | |
tbltags | array of tag name/value pairs | |
extensions | chained table of formatting extensions. |
errmsg | error message (if any) |
Definition at line 435 of file hdrinline.h.
References h2hv(), and HV_s::hdrsprintf.
Referenced by hdrSprintf(), main(), packageBinaries(), printNewSpecfile(), queryHeader(), rpmcliImportPubkey(), rpmHeaderGetEntry(), rpmpsmStage(), rpmShowProgress(), rpmtsSolve(), runScript(), and spewHeader().
Dereference a header instance.
h | header |
Definition at line 74 of file hdrinline.h.
References h2hv(), and HV_s::hdrunlink.
static void * headerUnload | ( | Header | h | ) | [inline, static] |
Convert header to on-disk representation.
h | header (with pointers) |
Definition at line 135 of file hdrinline.h.
References h2hv(), and HV_s::hdrunload.
Referenced by hdrUnload(), miFreeHeader(), rhnUnload(), and rpmdbAdd().
static void headerUnsort | ( | Header | h | ) | [inline, static] |
Restore tags in header to original ordering.
h | header |
Definition at line 103 of file hdrinline.h.
References h2hv(), and HV_s::hdrunsort.
Referenced by doHeaderUnload().
static int headerUsageCount | ( | Header | h | ) | [inline, static] |
Return header reference count.
h | header |
Definition at line 186 of file header_internal.h.
References headerToken_s::nrefs.
Write (with unload) header to file handle.
fd | file handle | |
h | header | |
magicp | prefix write with 8 bytes of (magic, 0)? |
Definition at line 214 of file hdrinline.h.
References h2hv(), and HV_s::hdrwrite.
Referenced by makeHDRSignature(), rpmpsmStage(), rpmWriteSignature(), rpmxpProcess(), spewHeader(), and writeRPM().
static int regionSwab | ( | indexEntry | entry, | |
int | il, | |||
int | dl, | |||
entryInfo | pe, | |||
unsigned char * | dataStart, | |||
const unsigned char * | dataEnd, | |||
int | regionid | |||
) | [static] |
Swap int_32 and int_16 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.
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 |
Definition at line 473 of file header.c.
References entryInfo_s::count, dataLength(), hdrchkAlign, hdrchkData, hdrchkType, HEADER_I18NTABLE, HEADER_IMAGE, indexEntry_s::info, entryInfo_s::offset, REGION_TAG_COUNT, RPM_I18NSTRING_TYPE, RPM_INT16_TYPE, RPM_INT32_TYPE, entryInfo_s::tag, entryInfo_s::type, and typeSizes.
Referenced by copyEntry(), and doHeaderUnload().
Retrieve tag info from header.
This is a "dressed" entry to headerGetEntry to do: 1) DIRNAME/BASENAME/DIRINDICES -> FILENAMES tag conversions. 2) i18n lookaside (if enabled).
h | header | |
tag | tag |
type | address of tag value data type | |
p | address of pointer to tag value(s) | |
c | address of number of values |
Definition at line 248 of file misc.c.
References headerGetEntry(), headerSprintf(), RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, rpmfiBuildFNames(), rpmHeaderFormats, RPMTAG_BASENAMES, RPMTAG_DESCRIPTION, RPMTAG_GROUP, RPMTAG_OLDFILENAMES, RPMTAG_SUMMARY, rpmTagTable, stpcpy(), and tagName().
Referenced by hdr_subscript().
Header methods for rpm headers.
Definition at line 121 of file header.c.
Referenced by headerCopyLoad(), headerCopyTags(), headerFreeIterator(), headerInitIterator(), headerLoad(), headerNew(), headerNextIterator(), and headerRead().
unsigned char header_magic[8] [static] |
size_t headerMaxbytes = (32*1024*1024) [static] |
int typeAlign[16] [static] |
int typeSizes[16] [static] |
Initial value:
{ 0, 1, 1, 2, 4, -1, -1, 1, -1, -1, 0, 0, 0, 0, 0, 0 }
Definition at line 68 of file header.c.
Referenced by dataLength(), doHeaderUnload(), and regionSwab().