rpm 4.9.1
|
Files | |
file | header.h |
An rpm header carries all information about a package. | |
file | rpmlib.h |
In Memoriam: Steve Taylor <staylor@redhat.com> was here, now he's not. | |
Typedefs | |
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. | |
Enumerations | |
enum | hMagic { HEADER_MAGIC_NO = 0, HEADER_MAGIC_YES = 1 } |
Include calculation for 8 bytes of (magic, 0)? More... | |
enum | headerGetFlags_e { HEADERGET_DEFAULT = 0, HEADERGET_MINMEM = (1 << 0), HEADERGET_EXT = (1 << 1), HEADERGET_RAW = (1 << 2), HEADERGET_ALLOC = (1 << 3), HEADERGET_ARGV = (1 << 4) } |
Modifier flags for headerGet() operation. More... | |
enum | rpmTagType_e |
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... | |
enum | rpmTagReturnType_e { RPM_ANY_RETURN_TYPE = 0, RPM_SCALAR_RETURN_TYPE = 0x00010000, RPM_ARRAY_RETURN_TYPE = 0x00020000, RPM_MAPPING_RETURN_TYPE = 0x00040000, RPM_MASK_RETURN_TYPE = 0xffff0000 } |
* Identify how to return the header data type. More... | |
Functions | |
Header | headerNew (void) |
Create new (empty) header instance. | |
Header | headerFree (Header h) |
Dereference a header instance. | |
Header | headerLink (Header h) |
Reference a header instance. | |
void | headerSort (Header h) |
Sort tags in header. | |
void | headerUnsort (Header h) |
Restore tags in header to original ordering. | |
unsigned int | headerSizeof (Header h, int magicp) |
Return size of on-disk header representation in bytes. | |
int | headerVerifyInfo (int il, int dl, const void *pev, void *iv, int negate) |
Perform simple sanity and range checks on header tag(s). | |
void * | headerUnload (Header h) |
Convert header to on-disk representation. | |
Header | headerReload (Header h, rpmTagVal 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. | |
Header | headerRead (FD_t fd, int magicp) |
Read (and load) header from file handle. | |
int | headerWrite (FD_t fd, Header h, int magicp) |
Write (with unload) header to file handle. | |
int | headerIsEntry (Header h, rpmTagVal tag) |
Check if tag is in header. | |
int | headerGet (Header h, rpmTagVal tag, rpmtd td, headerGetFlags flags) |
Retrieve tag value. | |
int | headerPut (Header h, rpmtd td, headerPutFlags flags) |
Add or append tag to header. | |
int | headerAddI18NString (Header h, rpmTagVal tag, const char *string, const char *lang) |
Add locale specific tag to header. | |
int | headerMod (Header h, rpmtd td) |
Modify tag in header. | |
int | headerDel (Header h, rpmTagVal tag) |
Delete tag in header. | |
char * | headerFormat (Header h, const char *fmt, errmsg_t *errmsg) |
Return formatted output string from header tags. | |
void | headerCopyTags (Header headerFrom, Header headerTo, const rpmTagVal *tagstocopy) |
Duplicate tag values from one header into another. | |
HeaderIterator | headerFreeIterator (HeaderIterator hi) |
Destroy header tag iterator. | |
HeaderIterator | headerInitIterator (Header h) |
Create header tag iterator. | |
int | headerNext (HeaderIterator hi, rpmtd td) |
Return next tag contents from header. | |
rpmTagVal | headerNextTag (HeaderIterator hi) |
Return next tag number from header. | |
RPM_GNUC_DEPRECATED int | headerNVR (Header h, const char **np, const char **vp, const char **rp) |
Return name, version, release strings from header. | |
RPM_GNUC_DEPRECATED int | headerNEVRA (Header h, const char **np, uint32_t **ep, const char **vp, const char **rp, const char **ap) |
Return name, epoch, version, release, arch strings from header. | |
RPM_GNUC_DEPRECATED char * | headerGetNEVR (Header h, const char **np) |
Return (malloc'd) header name-version-release string. | |
RPM_GNUC_DEPRECATED char * | headerGetNEVRA (Header h, const char **np) |
Return (malloc'd) header name-version-release.arch string. | |
char * | headerGetAsString (Header h, rpmTagVal tag) |
Return any non-array tag from header, converted to string. | |
const char * | headerGetString (Header h, rpmTagVal tag) |
Return a simple string tag from header. | |
RPM_GNUC_DEPRECATED rpm_color_t | headerGetColor (Header h) |
Return header color. | |
int | headerIsSource (Header h) |
Check if header is a source or binary package header. | |
unsigned int | headerGetInstance (Header h) |
Return header instance, ie is the header from rpmdb. | |
int | headerConvert (Header h, int op) |
Convert header to/from (legacy) data presentation. | |
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 | |
const unsigned char | rpm_header_magic [8] |
Header magic value. | |
int | headerPutString (Header h, rpmTagVal tag, const char *val) |
Type-safe methods for inserting tag data to header. | |
int | headerPutStringArray (Header h, rpmTagVal tag, const char **val, rpm_count_t size) |
int | headerPutBin (Header h, rpmTagVal tag, const uint8_t *val, rpm_count_t size) |
int | headerPutChar (Header h, rpmTagVal tag, const char *val, rpm_count_t size) |
int | headerPutUint8 (Header h, rpmTagVal tag, const uint8_t *val, rpm_count_t size) |
int | headerPutUint16 (Header h, rpmTagVal tag, const uint16_t *val, rpm_count_t size) |
int | headerPutUint32 (Header h, rpmTagVal tag, const uint32_t *val, rpm_count_t size) |
int | headerPutUint64 (Header h, rpmTagVal tag, const uint64_t *val, rpm_count_t size) |
RPMRC | |
rpmRC | headerCheckPayloadFormat (Header h) |
Check for supported payload format in header. | |
rpmRC | headerCheck (rpmts ts, const void *uh, size_t uc, char **msg) |
Check header consistency, performing headerGetEntry() the hard way. | |
rpmRC | rpmReadHeader (rpmts ts, FD_t fd, Header *hdrp, char **msg) |
Return checked and loaded header. | |
rpmRC | rpmReadPackageFile (rpmts ts, FD_t fd, const char *fn, Header *hdrp) |
Return package header from file handle, verifying digests/signatures. |
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.
enum headerGetFlags_e |
Modifier flags for headerGet() operation.
For consistent behavior you'll probably want to use ALLOC to ensure the caller owns the data, but MINMEM is useful for avoiding extra copy of data when you are sure the header wont go away. Most of the time you'll probably want EXT too, but note that extensions tags don't generally honor the other flags, MINMEM, RAW, ALLOC and ARGV are only relevant for non-extension data.
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 rpmTagReturnType_e |
enum rpmTagType_e |
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 headerMod()). *
This function is intended to just "do the right thing". If you need more fine grained control use headerPut() and headerMod().
h | header |
tag | tag |
string | tag value |
lang | locale |
Check header consistency, performing headerGetEntry() the hard way.
Sanity checks on the header are performed while looking for a header-only digest or signature to verify the blob. If found, the digest or signature is verified.
ts | transaction set |
uh | unloaded header blob |
uc | no. of bytes in blob (or 0 to disable) |
*msg | verification error message (or NULL) |
Check for supported payload format in header.
h | header to check |
int headerConvert | ( | Header | h, |
int | op | ||
) |
Convert header to/from (legacy) data presentation.
h | header |
op | one of headerConvOps operations |
Header headerCopyLoad | ( | const void * | uh | ) |
Make a copy and convert header to in-memory representation.
uh | on-disk header blob (i.e. with offsets) |
Duplicate tag values from one header into another.
headerFrom | source header |
headerTo | destination header |
tagstocopy | array of tags that are copied |
Delete tag in header.
Removes all entries of type tag from the header, returns 1 if none were found.
h | header |
tag | tag |
Return formatted output string from header tags.
The returned string must be free()d.
h | header |
fmt | format to use |
errmsg | error message (if any) |
Dereference a header instance.
h | header |
HeaderIterator headerFreeIterator | ( | HeaderIterator | hi | ) |
Destroy header tag iterator.
hi | header tag iterator |
int headerGet | ( | Header | h, |
rpmTagVal | tag, | ||
rpmtd | td, | ||
headerGetFlags | flags | ||
) |
Retrieve tag value.
h | header |
tag | tag |
td | tag data container |
flags | retrieval modifier flags |
Return any non-array tag from header, converted to string.
h | header |
tag | tag to retrieve |
RPM_GNUC_DEPRECATED rpm_color_t headerGetColor | ( | Header | h | ) |
Return header color.
h | header |
unsigned int headerGetInstance | ( | Header | h | ) |
Return header instance, ie is the header from rpmdb.
h | header |
RPM_GNUC_DEPRECATED char* headerGetNEVR | ( | Header | h, |
const char ** | np | ||
) |
Return (malloc'd) header name-version-release string.
h | header |
np | name tag value |
RPM_GNUC_DEPRECATED char* headerGetNEVRA | ( | Header | h, |
const char ** | np | ||
) |
Return (malloc'd) header name-version-release.arch string.
h | header |
np | name tag value |
Return a simple string tag from header.
h | header |
tag | tag to retrieve |
Referenced by main().
HeaderIterator headerInitIterator | ( | Header | h | ) |
Create header tag iterator.
h | header |
Check if tag is in header.
h | header |
tag | tag |
int headerIsSource | ( | Header | h | ) |
Check if header is a source or binary package header.
h | header |
Reference a header instance.
h | header |
Header headerLoad | ( | void * | uh | ) |
Convert header to in-memory representation.
uh | on-disk header blob (i.e. with offsets) |
Translate and merge legacy signature tags into header.
h | header |
sigh | signature header |
Modify tag in header.
If there are multiple entries with this tag, the first one gets replaced.
h | header |
td | tag data container |
RPM_GNUC_DEPRECATED int headerNEVRA | ( | Header | h, |
const char ** | np, | ||
uint32_t ** | 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) |
Header headerNew | ( | void | ) |
Create new (empty) header instance.
int headerNext | ( | HeaderIterator | hi, |
rpmtd | td | ||
) |
Return next tag contents from header.
hi | header tag iterator |
td | tag data container |
rpmTagVal headerNextTag | ( | HeaderIterator | hi | ) |
Return next tag number from header.
hi | header tag iterator |
RPM_GNUC_DEPRECATED 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) |
int headerPut | ( | Header | h, |
rpmtd | td, | ||
headerPutFlags | flags | ||
) |
Add or append tag to header.
h | header |
td | tag data container |
flags | flags to control operation |
int headerPutBin | ( | Header | h, |
rpmTagVal | tag, | ||
const uint8_t * | val, | ||
rpm_count_t | size | ||
) |
int headerPutChar | ( | Header | h, |
rpmTagVal | tag, | ||
const char * | val, | ||
rpm_count_t | size | ||
) |
Type-safe methods for inserting tag data to header.
Tag data type is validated to match the function type, ie things like headerPutUint32(h, RPMTAG_NAME, ...) will return failure. For non-array types size must equal 1, and data is checked to be non-NULL. For array types, add-or-append mode is always used.
headerPutString() can be used on both RPM_STRING_TYPE and RPM_STRING_ARRAY_TYPE (to add a single string into the array) tags, for others the type must match exactly.
These are intended to "do the right thing" in the common case, if you need more fine grained control use headerPut() & friends instead.
h | header |
tag | tag to insert |
val | pointer to value(s) |
size | number of items in array (1 or larger) |
int headerPutStringArray | ( | Header | h, |
rpmTagVal | tag, | ||
const char ** | val, | ||
rpm_count_t | size | ||
) |
int headerPutUint16 | ( | Header | h, |
rpmTagVal | tag, | ||
const uint16_t * | val, | ||
rpm_count_t | size | ||
) |
int headerPutUint32 | ( | Header | h, |
rpmTagVal | tag, | ||
const uint32_t * | val, | ||
rpm_count_t | size | ||
) |
int headerPutUint64 | ( | Header | h, |
rpmTagVal | tag, | ||
const uint64_t * | val, | ||
rpm_count_t | size | ||
) |
int headerPutUint8 | ( | Header | h, |
rpmTagVal | tag, | ||
const uint8_t * | val, | ||
rpm_count_t | size | ||
) |
Read (and load) header from file handle.
fd | file handle |
magicp | read (and verify) 8 bytes of (magic, 0)? |
Regenerate signature header.
h | header |
noArchiveSize | don't copy archive size tag (pre rpm-4.1) |
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 |
unsigned int headerSizeof | ( | Header | h, |
int | magicp | ||
) |
Return size of on-disk header representation in bytes.
h | header |
magicp | include size of 8 bytes for (magic, 0)? |
void headerSort | ( | Header | h | ) |
Sort tags in header.
h | header |
void* headerUnload | ( | Header | h | ) |
Convert header to on-disk representation.
h | header (with pointers) |
void headerUnsort | ( | Header | h | ) |
Restore tags in header to original ordering.
h | header |
int headerVerifyInfo | ( | int | il, |
int | dl, | ||
const void * | pev, | ||
void * | iv, | ||
int | negate | ||
) |
Perform simple sanity and range checks on header tag(s).
il | no. of tags in header |
dl | no. of bytes in header data. |
pev | 1st element in tag array, big-endian |
iv | failing (or last) tag element, host-endian |
negate | negative offset expected? |
Write (with unload) header to file handle.
fd | file handle |
h | header |
magicp | prefix write with 8 bytes of (magic, 0)? |
Return checked and loaded header.
ts | transaction set |
fd | file handle |
hdrp | address of header (or NULL) |
*msg | verification error message (or NULL) |
Return package header from file handle, verifying digests/signatures.
ts | transaction set |
fd | file handle |
fn | file name |
hdrp | address of header (or NULL) |
Referenced by main().
const unsigned char rpm_header_magic[8] |
Header magic value.