Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

rpmdb/header.c File Reference

#include "system.h"
#include <rpmio_internal.h>
#include <header_internal.h>
#include <rpmmacro.h>
#include "debug.h"

Include dependency graph for header.c:

Go to the source code of this file.

Data Structures

struct  headerIterator_s
 Header tag iterator data structure. More...
struct  headerSprintfArgs_s

Defines

#define __HEADER_PROTOTYPES__
#define PARSER_BEGIN   0
#define PARSER_IN_ARRAY   1
#define PARSER_IN_EXPR   2
#define hdrchkTags(_ntags)   ((_ntags) & 0xffff0000)
 Sanity check on no.
#define hdrchkType(_type)   ((_type) < RPM_MIN_TYPE || (_type) > RPM_MAX_TYPE)
 Sanity check on type values.
#define hdrchkData(_nbytes)   ((_nbytes) & 0xff000000)
 Sanity check on data size and/or offset and/or count.
#define hdrchkAlign(_type, _off)   ((_off) & (typeAlign[_type]-1))
 Sanity check on alignment for data type.
#define hdrchkRange(_dl, _off)   ((_off) < 0 || (_off) > (_dl))
 Sanity check on range of data offset.
#define isSEP(_c)   ((_c) == ':' || (_c) == '|')

Typedefs

typedef headerSprintfArgs_sheaderSprintfArgs

Functions

static void * headerGetStats (Header h, int opx)
 Return header stats accumulator structure.
static Header headerLink (Header h)
 Reference a header instance.
static Header headerUnlink (Header h)
 Dereference a header instance.
static Header headerFree (Header h)
 Dereference a header instance.
static Header headerNew (void)
 Create new (empty) header instance.
static int indexCmp (const void *avp, const void *bvp)
static void headerSort (Header h)
 Sort tags in header.
static int offsetCmp (const void *avp, const void *bvp)
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 int dataLength (rpmTagType type, rpmTagData *p, rpmTagCount count, int onDisk, rpmTagData *pend)
 Return length of entry data.
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, size_t *lenp)
static void * headerUnload (Header h)
 Convert header to on-disk representation.
static indexEntry findEntry (Header h, int_32 tag, rpmTagType type)
 Find matching (tag,type) entry in header.
static int headerRemoveEntry (Header h, int_32 tag)
 Delete tag in header.
static Header headerLoad (void *uh)
 Convert header to in-memory representation.
static const char * headerGetOrigin (Header h)
 Return header origin (e.g path or URL).
static int headerSetOrigin (Header h, const char *origin)
 Store header origin (e.g path or URL).
const char * headerGetBaseURL (Header h)
int headerSetBaseURL (Header h, const char *baseurl)
stat * headerGetStatbuf (Header h)
int headerSetStatbuf (Header h, struct stat *st)
const char * headerGetDigest (Header h)
int headerSetDigest (Header h, const char *digest)
static uint32_t headerGetInstance (Header h)
static uint32_t headerSetInstance (Header h, uint32_t instance)
uint32_t headerGetStartOff (Header h)
uint32_t headerSetStartOff (Header h, uint32_t startoff)
uint32_t headerGetEndOff (Header h)
uint32_t headerSetEndOff (Header h, uint32_t endoff)
static Header headerReload (Header h, int tag)
 Convert header to on-disk representation, and then reload.
static Header headerCopyLoad (const void *uh)
 Make a copy and convert header to in-memory representation.
static Header headerRead (void *_fd, enum hMagic magicp)
 Read (and load) header from file handle.
static int headerWrite (void *_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 int copyEntry (const indexEntry entry, rpmTagType *type, rpmTagData *p, rpmTagCount *c, int minMem)
 Retrieve data from header entry.
static int headerMatchLocale (const char *td, const char *l, const char *le)
 Does locale match entry in header i18n table?
static char * headerFindI18NString (Header h, indexEntry entry)
 Return i18n string from header that matches locale.
static int intGetEntry (Header h, int_32 tag, rpmTagType *type, rpmTagData *p, rpmTagCount *c, int minMem)
 Retrieve tag data from 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, void *p, hCNT_t c)
 Retrieve tag value using header internal array.
int headerGetRawEntry (Header h, int_32 tag, rpmTagType *type, void *p, rpmTagCount *c)
 Retrieve tag value with type match.
static void copyData (rpmTagType type, rpmTagData *dest, rpmTagData *src, rpmTagCount cnt, size_t len)
static void * grabData (rpmTagType type, rpmTagData *p, rpmTagCount c, int *lenp)
 Return (malloc'ed) copy of entry data.
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 char escapedChar (const char ch)
static HE_t rpmheMark (HE_t he)
 Mark a tag container with headerGetEntry() freeData.
static HE_t rpmheClean (HE_t he)
 Clean a tag container, free'ing attached malloc's.
static sprintfToken freeFormat (sprintfToken format, int num)
 Destroy headerSprintf format array.
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 Header headerCopy (Header h)
 Duplicate a header.
static headerSprintfArgs hsaInit (headerSprintfArgs hsa)
 Initialize an hsa iteration.
static sprintfToken hsaNext (headerSprintfArgs hsa)
 Return next hsa iteration item.
static headerSprintfArgs hsaFini (headerSprintfArgs hsa)
 Finish an hsa iteration.
static char * hsaReserve (headerSprintfArgs hsa, size_t need)
 Reserve sufficient buffer space for next output value.
static const char * myTagName (headerTagTableEntry tbl, int val, int *typep)
 Return tag name from value.
static int myTagType (headerTagTableEntry tbl, int val)
static int myTagValue (headerTagTableEntry tbl, const char *name)
 Return tag value from name.
static int findTag (headerSprintfArgs hsa, sprintfToken token, const char *name)
 Search extensions and tags for a name.
char * intFormat (HE_t he, const char **av, const char *fmt)
 Convert tag data representation.
static char * octFormat (HE_t he, const char **av)
 Return octal formatted data.
static char * hexFormat (HE_t he, const char **av)
 Return hex formatted data.
static char * decFormat (HE_t he, const char **av)
 Return decimal formatted data.
static char * realDateFormat (HE_t he, const char **av, const char *strftimeFormat)
 Return strftime formatted data.
static char * dateFormat (HE_t he, const char **av)
 Return date formatted data.
static char * dayFormat (HE_t he, const char **av)
 Return day formatted data.
static char * shescapeFormat (HE_t he, const char **av)
 Return shell escape formatted data.
static int parseExpression (headerSprintfArgs hsa, sprintfToken token, char *str, char **endPtr)
 Parse a headerSprintf expression.
static int parseFormat (headerSprintfArgs hsa, char *str, sprintfToken *formatPtr, int *numTokensPtr, char **endPtr, int state)
 Parse a headerSprintf term.
static int getExtension (headerSprintfArgs hsa, headerTagTagFunction fn, HE_t he, HE_t ec)
 Call a header extension only once, saving results.
static char * formatValue (headerSprintfArgs hsa, sprintfTag tag, int element)
 Format a single item's value.
static char * singleSprintf (headerSprintfArgs hsa, sprintfToken token, int element)
 Format a single headerSprintf item.
static HE_t rpmecNew (const headerSprintfExtension exts, int *necp)
 Create an extension cache.
static HE_t rpmecFree (const headerSprintfExtension exts, HE_t ec)
 Destroy an extension cache.
static char * headerSprintf (Header h, const char *fmt, const struct headerTagTableEntry_s *tags, const struct headerSprintfExtension_s *exts, 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.

Variables

int _hdr_debug = 0
int _tagcache = 1
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.
HV_t hdrVec = &hdrVec1
 Header methods for rpm headers.
const struct headerSprintfExtension_s headerDefaultFormats []
 Supported default header tag output formats.
const struct headerTagTableEntry_srpmTagTable
 Automatically generated table of tag name/value pairs.
static struct HV_s hdrVec1


Detailed Description

Definition in file header.c.


Define Documentation

#define __HEADER_PROTOTYPES__
 

Definition at line 13 of file header.c.

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

Sanity check on alignment for data type.

Definition at line 117 of file header.c.

#define hdrchkData _nbytes   )     ((_nbytes) & 0xff000000)
 

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

This check imposes a limit of 16Mb, more than enough.

Definition at line 112 of file header.c.

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

Sanity check on range of data offset.

Definition at line 122 of file header.c.

#define hdrchkTags _ntags   )     ((_ntags) & 0xffff0000)
 

Sanity check on no.

of tags. This check imposes a limit of 65K tags, more than enough.

Definition at line 101 of file header.c.

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

Sanity check on type values.

Definition at line 106 of file header.c.

#define isSEP _c   )     ((_c) == ':' || (_c) == '|')
 

Referenced by parseFormat().

#define PARSER_BEGIN   0
 

Definition at line 34 of file header.c.

#define PARSER_IN_ARRAY   1
 

Definition at line 35 of file header.c.

Referenced by parseFormat().

#define PARSER_IN_EXPR   2
 

Definition at line 36 of file header.c.

Referenced by parseExpression(), and parseFormat().


Typedef Documentation

typedef struct headerSprintfArgs_s * headerSprintfArgs
 


Function Documentation

static void copyData rpmTagType  type,
rpmTagData dest,
rpmTagData src,
rpmTagCount  cnt,
size_t  len
[static]
 

Definition at line 1924 of file header.c.

References RPM_I18NSTRING_TYPE, and RPM_STRING_ARRAY_TYPE.

Referenced by grabData().

static int dataLength rpmTagType  type,
rpmTagData p,
rpmTagCount  count,
int  onDisk,
rpmTagData pend
[static]
 

Return length of entry data.

Parameters:
type entry data type
*p tag container data
count entry item count
onDisk data is concatenated strings (with NUL's))?
*pend pointer to end of tag container data (or NULL)
Returns:
no. bytes in data, -1 on failure

Definition at line 389 of file header.c.

References RPM_I18NSTRING_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, typeSizes, and rpmDataType_u::ui8p.

Referenced by grabData(), and regionSwab().

static char* dateFormat HE_t  he,
const char **  av
[static]
 

Return date formatted data.

Parameters:
he tag container
av parameter array (or NULL)
Returns:
formatted string

Definition at line 2953 of file header.c.

References _, and realDateFormat().

static char* dayFormat HE_t  he,
const char **  av
[static]
 

Return day formatted data.

Parameters:
he tag container
av parameter array (or NULL)
Returns:
formatted string

Definition at line 2965 of file header.c.

References _, and realDateFormat().

static char* decFormat HE_t  he,
const char **  av
[static]
 

Return decimal formatted data.

Parameters:
he tag container
av parameter array (or NULL)
Returns:
formatted string

Definition at line 2908 of file header.c.

References intFormat().

static char escapedChar const char  ch  )  [static]
 

Definition at line 2318 of file header.c.

References _hdr_debug.

Referenced by parseFormat().

static indexEntry findEntry Header  h,
int_32  tag,
rpmTagType  type
[static]
 

Find matching (tag,type) entry in header.

Parameters:
h header
tag entry tag
type entry type
Returns:
header entry

Definition at line 905 of file header.c.

References headerToken_s::flags, HEADERFLAG_SORTED, headerSort(), indexCmp(), indexEntry_s::info, RPM_NULL_TYPE, entryInfo_s::tag, and entryInfo_s::type.

Referenced by addMacro(), delMacro(), delMacroAll(), expandMacro(), headerFindI18NString(), headerGetRawEntry(), htGetEntry(), htHasEntry(), and intGetEntry().

static int findTag headerSprintfArgs  hsa,
sprintfToken  token,
const char *  name
[static]
 

Search extensions and tags for a name.

Parameters:
hsa headerSprintf args
token parsed fields
name name to find
Returns:
0 on success, 1 on not found

Definition at line 2736 of file header.c.

References alloca(), argvCount(), sprintfTag_s::av, sprintfTag_s::ext, sprintfTag_s::extNum, headerSprintfArgs_s::exts, sprintfTag_s::fmtfuncs, HEADER_EXT_FORMAT, HEADER_EXT_LAST, HEADER_EXT_MORE, HEADER_EXT_TAG, myTagValue(), headerSprintfExtension_s::name, stpcpy(), sprintfTag_s::tagno, headerSprintfArgs_s::tags, headerSprintfExtension_s::type, sprintfToken_s::type, headerSprintfExtension_s::u, sprintfToken_s::u, xcalloc(), and xstrcasecmp().

Referenced by parseExpression(), and parseFormat().

static char* formatValue headerSprintfArgs  hsa,
sprintfTag  tag,
int  element
[static]
 

Format a single item's value.

Parameters:
hsa headerSprintf args
tag tag
element element index
Returns:
end of formatted string (NULL on error)

Definition at line 3515 of file header.c.

References _free(), _hdr_debug, _tagcache, alloca(), rpmDataType_u::argv, argvFree(), argvSplit(), sprintfTag_s::arrayCount, sprintfTag_s::av, _HE_s::avail, _HE_s::c, headerSprintfArgs_s::ec, sprintfTag_s::ext, sprintfTag_s::extNum, sprintfTag_s::fmtfuncs, sprintfTag_s::format, _HE_s::freeData, getExtension(), headerSprintfArgs_s::h, sprintfTag_s::he, headerGetEntry(), hsaReserve(), rpmDataType_u::i32p, rpmDataType_u::i64p, rpmDataType_u::i8p, intFormat(), myTagType(), _HE_s::p, sprintfTag_s::pad, sprintfTag_s::params, rpmDataType_u::ptr, RPM_ARRAY_RETURN_TYPE, RPM_ASN1_TYPE, RPM_BIN_TYPE, RPM_CHAR_TYPE, RPM_I18NSTRING_TYPE, RPM_INT16_TYPE, RPM_INT32_TYPE, RPM_INT64_TYPE, RPM_INT8_TYPE, RPM_MASK_RETURN_TYPE, RPM_OPENPGP_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, rpmExpand(), rpmheClean(), rpmheMark(), snprintf(), stpcpy(), rpmDataType_u::str, _HE_s::t, _HE_s::tag, sprintfTag_s::tagno, headerSprintfArgs_s::tags, rpmDataType_u::ui16p, headerSprintfArgs_s::val, headerSprintfArgs_s::vallen, xmalloc(), and xstrdup().

Referenced by singleSprintf().

static sprintfToken freeFormat sprintfToken  format,
int  num
[static]
 

Destroy headerSprintf format array.

Parameters:
format sprintf format array
num number of elements
Returns:
NULL always

Definition at line 2380 of file header.c.

References _free(), _tagcache, argvFree(), sprintfToken_s::array, sprintfTag_s::av, sprintfToken_s::cond, sprintfTag_s::fmtfuncs, sprintfTag_s::he, sprintfTag_s::params, rpmheClean(), sprintfToken_s::tag, and sprintfToken_s::u.

Referenced by parseExpression(), and parseFormat().

static int getExtension headerSprintfArgs  hsa,
headerTagTagFunction  fn,
HE_t  he,
HE_t  ec
[static]
 

Call a header extension only once, saving results.

Parameters:
hsa headerSprintf args
fn function
Return values:
he tag container
ec extension cache
Returns:
0 on success, 1 on failure

Definition at line 3490 of file header.c.

References _HE_s::avail, _HE_s::freeData, headerSprintfArgs_s::h, and rpmheClean().

Referenced by formatValue(), and singleSprintf().

static void* grabData rpmTagType  type,
rpmTagData p,
rpmTagCount  c,
int *  lenp
[static]
 

Return (malloc'ed) copy of entry data.

Parameters:
type entry data type
*p tag container data
c entry item count
Return values:
*lenp no. bytes in returned data
Returns:
(malloc'ed) copy of entry data, NULL on error

Definition at line 1959 of file header.c.

References copyData(), dataLength(), rpmDataType_u::ptr, and xmalloc().

static char* headerFindI18NString Header  h,
indexEntry  entry
[static]
 

Return i18n string from header that matches locale.

Parameters:
h header
entry i18n string data
Returns:
matching i18n string (or 1st string if no match)

Definition at line 1720 of file header.c.

References _, indexEntry_s::data, findEntry(), getenv(), HEADER_I18NTABLE, headerMatchLocale(), lang, and RPM_STRING_ARRAY_TYPE.

Referenced by intGetEntry().

const char* headerGetBaseURL Header  h  ) 
 

const char* headerGetDigest Header  h  ) 
 

uint32_t headerGetEndOff Header  h  ) 
 

static uint32_t headerGetInstance Header  h  )  [static]
 

Definition at line 1248 of file header.c.

References headerToken_s::instance.

uint32_t headerGetStartOff Header  h  ) 
 

struct stat* headerGetStatbuf Header  h  ) 
 

static int headerMatchLocale const char *  td,
const char *  l,
const char *  le
[static]
 

Does locale match entry in header i18n table?

 * The range [l,le) contains the next locale to match:
 *    ll[_CC][.EEEEE][@dddd]
 * where
 *    ll	ISO language code (in lowercase).
 *    CC	(optional) ISO coutnry code (in uppercase).
 *    EEEEE	(optional) encoding (not really standardized).
 *    dddd	(optional) dialect.
 * 

Parameters:
td header i18n table data, NUL terminated
l start of locale to match
le end of locale to match
Returns:
1 on match, 0 on no match

Definition at line 1647 of file header.c.

References alloca().

Referenced by headerFindI18NString().

int headerSetBaseURL Header  h,
const char *  baseurl
 

int headerSetDigest Header  h,
const char *  digest
 

uint32_t headerSetEndOff Header  h,
uint32_t  endoff
 

static uint32_t headerSetInstance Header  h,
uint32_t  instance
[static]
 

Definition at line 1255 of file header.c.

References headerToken_s::instance.

uint32_t headerSetStartOff Header  h,
uint32_t  startoff
 

int headerSetStatbuf Header  h,
struct stat *  st
 

static char* hexFormat HE_t  he,
const char **  av
[static]
 

Return hex formatted data.

Parameters:
he tag container
av parameter array (or NULL)
Returns:
formatted string

Definition at line 2896 of file header.c.

References intFormat().

static headerSprintfArgs hsaFini headerSprintfArgs  hsa  )  [static]
 

Finish an hsa iteration.

Parameters:
hsa headerSprintf args
Returns:
headerSprintf args

Definition at line 2637 of file header.c.

References headerFreeIterator(), headerSprintfArgs_s::hi, and headerSprintfArgs_s::i.

static headerSprintfArgs hsaInit headerSprintfArgs  hsa  )  [static]
 

Initialize an hsa iteration.

Parameters:
hsa headerSprintf args
Returns:
headerSprintf args

Definition at line 2573 of file header.c.

References headerSprintfArgs_s::format, headerSprintfArgs_s::h, headerInitIterator(), headerSprintfArgs_s::hi, headerSprintfArgs_s::i, sprintfTag_s::tagno, sprintfToken_s::type, and sprintfToken_s::u.

static sprintfToken hsaNext headerSprintfArgs  hsa  )  [static]
 

Return next hsa iteration item.

Parameters:
hsa headerSprintf args
Returns:
next sprintfToken (or NULL)

Definition at line 2599 of file header.c.

References _HE_s::avail, _HE_s::c, headerSprintfArgs_s::format, sprintfTag_s::he, headerNextIterator(), headerSprintfArgs_s::hi, headerSprintfArgs_s::i, headerSprintfArgs_s::numTokens, _HE_s::p, rpmDataType_u::ptr, rpmheClean(), rpmheMark(), _HE_s::t, _HE_s::tag, sprintfTag_s::tagno, sprintfToken_s::type, and sprintfToken_s::u.

static char* hsaReserve headerSprintfArgs  hsa,
size_t  need
[static]
 

Reserve sufficient buffer space for next output value.

Parameters:
hsa headerSprintf args
need no. of bytes to reserve
Returns:
pointer to reserved space

Definition at line 2656 of file header.c.

References headerSprintfArgs_s::alloced, headerSprintfArgs_s::val, headerSprintfArgs_s::vallen, and xrealloc().

Referenced by formatValue(), and singleSprintf().

static int indexCmp const void *  avp,
const void *  bvp
[static]
 

Definition at line 258 of file header.c.

References indexEntry_s::info, and entryInfo_s::tag.

Referenced by findEntry().

char* intFormat HE_t  he,
const char **  av,
const char *  fmt
 

Convert tag data representation.

Parameters:
he tag container
av parameter array (or NULL)
fmt output radix (NULL or "" assumes d)
Returns:
formatted string

Definition at line 2809 of file header.c.

References _, alloca(), rpmDataType_u::argv, _HE_s::c, rpmDataType_u::i32p, rpmDataType_u::i64p, rpmDataType_u::i8p, _HE_s::ix, _HE_s::p, RPM_ASN1_TYPE, RPM_BIN_TYPE, RPM_CHAR_TYPE, RPM_INT16_TYPE, RPM_INT32_TYPE, RPM_INT64_TYPE, RPM_INT8_TYPE, RPM_OPENPGP_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, snprintf(), rpmDataType_u::str, _HE_s::t, rpmDataType_u::ui16p, and xstrdup().

Referenced by decFormat(), formatValue(), hexFormat(), octFormat(), and rpnFormat().

static int intGetEntry Header  h,
int_32  tag,
rpmTagType type,
rpmTagData p,
rpmTagCount c,
int  minMem
[static]
 

Retrieve tag data from header.

Parameters:
h header
tag tag to retrieve
Return values:
*type type (or NULL)
*p data (or NULL)
*c count (or NULL)
Parameters:
minMem string pointers reference header memory?
Returns:
1 on success, 0 on not found

Definition at line 1775 of file header.c.

References copyEntry(), findEntry(), headerFindI18NString(), indexEntry_s::info, RPM_I18NSTRING_TYPE, RPM_NULL_TYPE, RPM_STRING_TYPE, and entryInfo_s::type.

static const char* myTagName headerTagTableEntry  tbl,
int  val,
int *  typep
[static]
 

Return tag name from value.

Todo:
bsearch on sorted value table.
Parameters:
tbl tag table
val tag value to find
Return values:
*typep tag type (or NULL)
Returns:
tag name, NULL on not found

Definition at line 2677 of file header.c.

References headerTagTableEntry_s::name, name, headerTagTableEntry_s::type, headerTagTableEntry_s::val, and xtolower().

Referenced by singleSprintf().

static int myTagType headerTagTableEntry  tbl,
int  val
[static]
 

Definition at line 2703 of file header.c.

References headerTagTableEntry_s::name, headerTagTableEntry_s::type, and headerTagTableEntry_s::val.

Referenced by formatValue().

static int myTagValue headerTagTableEntry  tbl,
const char *  name
[static]
 

Return tag value from name.

Todo:
bsearch on sorted name table.
Parameters:
tbl tag table
name tag name to find
Returns:
tag value, 0 on not found

Definition at line 2719 of file header.c.

References headerTagTableEntry_s::name, headerTagTableEntry_s::val, and xstrcasecmp().

Referenced by findTag().

static char* octFormat HE_t  he,
const char **  av
[static]
 

Return octal formatted data.

Parameters:
he tag container
av parameter array (or NULL)
Returns:
formatted string

Definition at line 2884 of file header.c.

References intFormat().

static int offsetCmp const void *  avp,
const void *  bvp
[static]
 

Definition at line 283 of file header.c.

References indexEntry_s::data, indexEntry_s::info, entryInfo_s::offset, and entryInfo_s::tag.

static int parseExpression headerSprintfArgs  hsa,
sprintfToken  token,
char *  str,
char **  endPtr
[static]
 

Parse a headerSprintf expression.

Parameters:
hsa headerSprintf args
token 
str 
Return values:
*endPtr 
Returns:
0 on success

Definition at line 3379 of file header.c.

References _, _hdr_debug, headerSprintfArgs_s::errmsg, findTag(), freeFormat(), parseFormat(), PARSER_IN_EXPR, sprintfToken_s::type, and sprintfToken_s::u.

Referenced by parseFormat().

static int parseFormat headerSprintfArgs  hsa,
char *  str,
sprintfToken formatPtr,
int *  numTokensPtr,
char **  endPtr,
int  state
[static]
 

Parse a headerSprintf term.

Parameters:
hsa headerSprintf args
str 
Return values:
*formatPtr 
*numTokensPtr 
*endPtr 
Parameters:
state 
Returns:
0 on success

Definition at line 3070 of file header.c.

References _, _hdr_debug, argvAdd(), headerSprintfArgs_s::errmsg, escapedChar(), findTag(), freeFormat(), isSEP, next, parseExpression(), PARSER_IN_ARRAY, PARSER_IN_EXPR, sprintfToken_s::type, sprintfToken_s::u, xcalloc(), and xisdigit().

Referenced by parseExpression().

static char* realDateFormat HE_t  he,
const char **  av,
const char *  strftimeFormat
[static]
 

Return strftime formatted data.

Parameters:
he tag container
av parameter array (or NULL)
strftimeFormat strftime(3) format
Returns:
formatted string

Definition at line 2921 of file header.c.

References _, _HE_s::p, rpmDataType_u::ptr, RPM_INT64_TYPE, _HE_s::t, rpmDataType_u::ui64p, and xstrdup().

Referenced by dateFormat(), and dayFormat().

static HE_t rpmecFree const headerSprintfExtension  exts,
HE_t  ec
[static]
 

Destroy an extension cache.

Parameters:
exts headerSprintf extensions
ec extension cache
Returns:
NULL always

Definition at line 3958 of file header.c.

References _free(), HEADER_EXT_LAST, HEADER_EXT_MORE, rpmheClean(), headerSprintfExtension_s::type, and headerSprintfExtension_s::u.

static HE_t rpmecNew const headerSprintfExtension  exts,
int *  necp
[static]
 

Create an extension cache.

Parameters:
exts headerSprintf extensions
Return values:
*necp no. of elements (or NULL)
Returns:
new extension cache

Definition at line 3932 of file header.c.

References HEADER_EXT_LAST, HEADER_EXT_MORE, headerSprintfExtension_s::type, headerSprintfExtension_s::u, and xcalloc().

static HE_t rpmheClean HE_t  he  )  [static]
 

Clean a tag container, free'ing attached malloc's.

Parameters:
he tag container

Definition at line 2362 of file header.c.

References _free(), _HE_s::freeData, _HE_s::p, and rpmDataType_u::ptr.

Referenced by formatValue(), freeFormat(), getExtension(), hsaNext(), rpmecFree(), and singleSprintf().

static HE_t rpmheMark HE_t  he  )  [static]
 

Mark a tag container with headerGetEntry() freeData.

Parameters:
he tag container

Definition at line 2340 of file header.c.

References _HE_s::freeData, RPM_BIN_TYPE, RPM_I18NSTRING_TYPE, RPM_STRING_ARRAY_TYPE, and _HE_s::t.

Referenced by formatValue(), hsaNext(), and singleSprintf().

static char* shescapeFormat HE_t  he,
const char **  av
[static]
 

Return shell escape formatted data.

Parameters:
he tag container
av parameter array (or NULL)
Returns:
formatted string

Definition at line 2977 of file header.c.

References _, rpmDataType_u::i32p, rpmDataType_u::i64p, _HE_s::p, RPM_INT32_TYPE, RPM_INT64_TYPE, RPM_STRING_TYPE, snprintf(), rpmDataType_u::str, _HE_s::t, xmalloc(), and xstrdup().

static char* singleSprintf headerSprintfArgs  hsa,
sprintfToken  token,
int  element
[static]
 

Format a single headerSprintf item.

Parameters:
hsa headerSprintf args
token item to format
element element index
Returns:
end of formatted string (NULL on error)

Definition at line 3711 of file header.c.

References _, _tagcache, sprintfTag_s::arrayCount, sprintfTag_s::av, _HE_s::avail, _HE_s::c, headerSprintfArgs_s::ec, headerSprintfArgs_s::errmsg, sprintfTag_s::ext, sprintfTag_s::extNum, formatValue(), _HE_s::freeData, getExtension(), headerSprintfArgs_s::h, sprintfTag_s::he, headerGetEntry(), headerIsEntry(), hsaReserve(), sprintfTag_s::justOne, myTagName(), _HE_s::p, RPM_ARRAY_RETURN_TYPE, RPM_ASN1_TYPE, RPM_BIN_TYPE, RPM_MASK_RETURN_TYPE, RPM_OPENPGP_TYPE, RPM_SCALAR_RETURN_TYPE, RPM_STRING_TYPE, rpmheClean(), rpmheMark(), snprintf(), stpcpy(), _HE_s::t, _HE_s::tag, sprintfTag_s::tagno, headerSprintfArgs_s::tags, sprintfToken_s::type, headerSprintfExtension_s::u, sprintfToken_s::u, headerSprintfArgs_s::val, and headerSprintfArgs_s::vallen.


Variable Documentation

int _hdr_debug = 0
 

Definition at line 22 of file header.c.

Referenced by escapedChar(), formatValue(), parseExpression(), and parseFormat().

int _tagcache = 1
 

Definition at line 25 of file header.c.

Referenced by formatValue(), freeFormat(), and singleSprintf().

struct HV_s hdrVec1 [static]
 

Definition at line 4121 of file header.c.

const struct headerTagTableEntry_s* rpmTagTable
 

Automatically generated table of tag name/value pairs.

Definition at line 205 of file tagtbl.c.


Generated on Wed Dec 28 16:58:15 2016 for rpm by  doxygen 1.4.4