The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Интерактивная система просмотра системных руководств (man-ов)

 ТемаНаборКатегория 
 
 [Cписок руководств | Печать]

header.c (3)
  • >> header.c (3) ( Linux man: Библиотечные вызовы )
  •  

    NAME

    lib/header.c -  
     
    

    SYNOPSIS


    #include 'system.h'
    #include <langinfo.h>
    #include <iconv.h>
    #include <header_internal.h>
    #include 'debug.h'
     

    Data Structures


    struct headerIteratorS
    Header tag iterator data structure.  

    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 hdrchkData(_nbytes) ((_nbytes) & 0xff000000)
    Sanity check on data size and/or offset.  

    Functions


    const char *const tagName (int tag)
    Return name of tag from value.
    void * _free (const void *p)
    Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
    Header headerLink (Header h)

    Header headerUnlink (Header h)

    Header headerFree (Header h)

    Header headerNew (void)

    int indexCmp (const void *avp, const void *bvp)

    void headerSort (Header h)

    int offsetCmp (const void *avp, const void *bvp)

    void headerUnsort (Header h)

    unsigned int headerSizeof (Header h, enum hMagic magicp)

    int dataLength (int_32 type, hPTR_t p, int_32 count, int onDisk)
    Return length of entry data.
    int regionSwab (indexEntry entry, int il, int dl, entryInfo pe, char *dataStart, int regionid)

    void * doHeaderUnload (Header h, int *lengthPtr)

    void * headerUnload (Header h)

    indexEntry findEntry (Header h, int_32 tag, int_32 type)
    Find matching (tag,type) entry in header.
    int headerRemoveEntry (Header h, int_32 tag)

    Header headerLoad (void *uh)

    Header headerReload (Header h, int tag)

    Header headerCopyLoad (const void *uh)

    Header headerRead (FD_t fd, enum hMagic magicp)

    int headerWrite (FD_t fd, Header h, enum hMagic magicp)

    int headerIsEntry (Header h, int_32 tag)

    int copyEntry (const indexEntry entry, hTYP_t type, hPTR_t *p, hCNT_t c, int minMem)

    int locale_match (const char *sample, const char *l_b, const char *l_e, char delim)

    int headerMatchLocale (const char *td, const char *l, const char *le, int strip_lang)
    Does locale match entry in header i18n table?
    char * convert (char *ed, const char *td, const char *lang)

    char * headerFindI18NString (Header h, indexEntry entry)
    Return i18n string from header that matches locale.
    int intGetEntry (Header h, int_32 tag, hTAG_t type, hPTR_t *p, hCNT_t c, int minMem)
    Retrieve tag data from header.
    void * headerFreeTag (Header h, const void *data, rpmTagType type)

    int headerGetEntry (Header h, int_32 tag, hTYP_t type, void **p, hCNT_t c)

    int headerGetEntryMinMemory (Header h, int_32 tag, hTYP_t type, hPTR_t *p, hCNT_t c)

    int headerGetRawEntry (Header h, int_32 tag, int_32 *type, hPTR_t *p, int_32 *c)

    void copyData (int_32 type, void *dstPtr, const void *srcPtr, int_32 c, int dataLength)

    void * grabData (int_32 type, hPTR_t p, int_32 c, int *lengthPtr)
    Return (malloc'ed) copy of entry data.
    int headerAddEntry (Header h, int_32 tag, int_32 type, const void *p, int_32 c)

    int headerAppendEntry (Header h, int_32 tag, int_32 type, const void *p, int_32 c)

    int headerAddOrAppendEntry (Header h, int_32 tag, int_32 type, const void *p, int_32 c)

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

    int headerModifyEntry (Header h, int_32 tag, int_32 type, const void *p, int_32 c)

    char escapedChar (const char ch)

    sprintfToken freeFormat (sprintfToken format, int num)
    Destroy headerSprintf format array.
    void findTag (char *name, const headerTagTableEntry tags, const headerSprintfExtension extensions, headerTagTableEntry *tagMatch, headerSprintfExtension *extMatch)

    int parseExpression (sprintfToken token, char *str, const headerTagTableEntry tags, const headerSprintfExtension extensions, char **endPtr, errmsg_t *errmsg)

    int parseFormat (char *str, const headerTagTableEntry tags, const headerSprintfExtension extensions, sprintfToken *formatPtr, int *numTokensPtr, char **endPtr, int state, errmsg_t *errmsg)

    int getExtension (Header h, headerTagTagFunction fn, hTYP_t typeptr, hPTR_t *data, hCNT_t countptr, extensionCache ext)

    char * formatValue (sprintfTag tag, Header h, const headerSprintfExtension extensions, extensionCache extCache, int element, char **valp, int *vallenp, int *allocedp)

    char * singleSprintf (Header h, sprintfToken token, const headerSprintfExtension extensions, extensionCache extCache, int element, char **valp, int *vallenp, int *allocedp)

    extensionCache allocateExtensionCache (const headerSprintfExtension extensions)

    extensionCache freeExtensionCache (const headerSprintfExtension extensions, extensionCache cache)

    char * headerSprintf (Header h, const char *fmt, const struct headerTagTableEntry_s *tbltags, const struct headerSprintfExtension_s *extensions, errmsg_t *errmsg)

    char * octalFormat (int_32 type, hPTR_t data, char *formatPrefix, int padding, int element)

    char * hexFormat (int_32 type, hPTR_t data, char *formatPrefix, int padding, int element)

    char * realDateFormat (int_32 type, hPTR_t data, char *formatPrefix, int padding, int element, const char *strftimeFormat)

    char * dateFormat (int_32 type, hPTR_t data, char *formatPrefix, int padding, int element)

    char * dayFormat (int_32 type, hPTR_t data, char *formatPrefix, int padding, int element)

    char * shescapeFormat (int_32 type, hPTR_t data, char *formatPrefix, int padding, int element)

    void headerCopyTags (Header headerFrom, Header headerTo, hTAG_t tagstocopy)

    HeaderIterator headerFreeIterator (HeaderIterator hi)

    HeaderIterator headerInitIterator (Header h)

    int headerNextIterator (HeaderIterator hi, hTAG_t tag, hTYP_t type, hPTR_t *p, hCNT_t c)

    Header headerCopy (Header h)
     

    Variables


    unsigned char header_magic [8]

    size_t headerMaxbytes = (32*1024*1024)

    int typeSizes []

    HV_t hdrVec = &hdrVec1

    const struct headerSprintfExtension_s headerDefaultFormats []

    HV_s hdrVec1
     

    DETAILED DESCRIPTION

    Definition in file header.c.  

    DEFINE DOCUMENTATION

     

    #define __HEADER_PROTOTYPES__

    Definition at line 15 of file header.c.  

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

    Sanity check on data size and/or offset.

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

    Definition at line 60 of file header.c.

    Referenced by doHeaderUnload(), headerCopyLoad(), headerLoad(), and headerRead().  

    #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 54 of file header.c.

    Referenced by doHeaderUnload(), headerCopyLoad(), headerLoad(), and headerRead().  

    #define PARSER_BEGIN 0

    Definition at line 33 of file header.c.

    Referenced by headerSprintf().  

    #define PARSER_IN_ARRAY 1

    Definition at line 34 of file header.c.

    Referenced by parseFormat().  

    #define PARSER_IN_EXPR 2

    Definition at line 35 of file header.c.

    Referenced by parseExpression(), and parseFormat().  

    FUNCTION DOCUMENTATION

     

    void* _free (const void * p) [inline, static]

    Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.

    Parameters:

    p
    memory to free

    Returns: NULL always

    Definition at line 88 of file header.c.  

    extensionCache allocateExtensionCache (const headerSprintfExtension extensions) [static]

    Definition at line 2852 of file header.c.

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

    Referenced by headerSprintf().  

    char* convert (char * ed, const char * td, const char * lang) [static]

    Definition at line 1412 of file header.c.

    References setlocale.

    Referenced by headerFindI18NString().  

    void copyData (int_32 type, void * dstPtr, const void * srcPtr, int_32 c, int dataLength) [static]

    Definition at line 1647 of file header.c.

    References dataLength(), int_32, RPM_I18NSTRING_TYPE, and RPM_STRING_ARRAY_TYPE.

    Referenced by grabData(), and headerAppendEntry().  

    int dataLength (int_32 type, hPTR_t p, int_32 count, int onDisk) [static]

    Return length of entry data.

    Todo: Remove sanity check exit's.

    Parameters:

    type
    entry data type
    p
    entry data
    count
    entry item count
    onDisk
    data is concatenated strings (with NUL's))?

    Returns: no. bytes in data

    Definition at line 321 of file header.c.

    References _, EXIT_FAILURE, hPTR_t, int_32, RPM_I18NSTRING_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, and typeSizes.

    Referenced by copyData(), grabData(), headerAppendEntry(), and regionSwab().  

    char* dateFormat (int_32 type, hPTR_t data, char * formatPrefix, int padding, int element) [static]

    Definition at line 3034 of file header.c.

    References hPTR_t, int_32, and realDateFormat().  

    char* dayFormat (int_32 type, hPTR_t data, char * formatPrefix, int padding, int element) [static]

    Definition at line 3043 of file header.c.

    References hPTR_t, int_32, and realDateFormat().  

    char escapedChar (const char ch) [static]

    Definition at line 2018 of file header.c.

    Referenced by parseFormat().  

    indexEntry findEntry (Header h, int_32 tag, int_32 type) [static]

    Find matching (tag,type) entry in header.

    Parameters:

    h
    header
    tag
    entry tag
    type
    entry type

    Returns: header entry

    Definition at line 773 of file header.c.

    References HEADERFLAG_SORTED, headerSort(), indexCmp(), indexEntry::info, int_32, RPM_NULL_TYPE, entryInfo::tag, and entryInfo::type.  

    void findTag (char * name, const headerTagTableEntry tags, const headerSprintfExtension extensions, headerTagTableEntry * tagMatch, headerSprintfExtension * extMatch) [static]

    Definition at line 2073 of file header.c.

    References alloca(), HEADER_EXT_LAST, HEADER_EXT_MORE, HEADER_EXT_TAG, headerTagTableEntry_s::name, headerSprintfExtension_s::name, stpcpy(), headerSprintfExtension_s::type, headerSprintfExtension_s::u, and xstrcasecmp().

    Referenced by parseExpression(), and parseFormat().  

    char* formatValue (sprintfTag tag, Header h, const headerSprintfExtension extensions, extensionCache extCache, int element, char ** valp, int * vallenp, int * allocedp) [static]

    Definition at line 2530 of file header.c.

    References _free(), getExtension(), HEADER_EXT_FORMAT, HEADER_EXT_LAST, HEADER_EXT_MORE, headerFreeData(), headerGetEntry(), headerTagFormatFunction, hPTR_t, int_32, int_8, headerSprintfExtension_s::name, RPM_BIN_TYPE, RPM_CHAR_TYPE, RPM_INT16_TYPE, RPM_INT32_TYPE, RPM_INT8_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, stpcpy(), headerSprintfExtension_s::type, headerSprintfExtension_s::u, uint_16, xmalloc(), xrealloc(), and xstrdup().

    Referenced by singleSprintf().  

    extensionCache freeExtensionCache (const headerSprintfExtension extensions, extensionCache cache) [static]

    Returns: NULL always

    Definition at line 2875 of file header.c.

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

    Referenced by headerSprintf().  

    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 2039 of file header.c.

    References _free(), and sprintfToken::u.

    Referenced by parseExpression(), and parseFormat().  

    int getExtension (Header h, headerTagTagFunction fn, hTYP_t typeptr, hPTR_t * data, hCNT_t countptr, extensionCache ext) [static]

    Returns: 0 on success, 1 on failure

    Definition at line 2508 of file header.c.

    References hCNT_t, headerTagTagFunction, hPTR_t, and hTYP_t.

    Referenced by formatValue(), and singleSprintf().  

    void* grabData (int_32 type, hPTR_t p, int_32 c, int * lengthPtr) [static]

    Return (malloc'ed) copy of entry data.

    Parameters:

    type
    entry data type
    p
    entry data
    c
    entry item count

    Return values:

    lengthPtr
    no. bytes in returned data

    Returns: (malloc'ed) copy of entry data

    Definition at line 1686 of file header.c.

    References copyData(), dataLength(), hPTR_t, int_32, and xmalloc().

    Referenced by headerAddEntry(), and headerModifyEntry().  

    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 1459 of file header.c.

    References convert(), indexEntry::data, findEntry(), getenv(), HEADER_I18NTABLE, headerMatchLocale(), and RPM_STRING_ARRAY_TYPE.

    Referenced by intGetEntry().  

    int headerGetRawEntry (Header h, int_32 tag, int_32 * type, hPTR_t * p, int_32 * c)

    Definition at line 1621 of file header.c.

    References copyEntry(), findEntry(), headerIsEntry(), hPTR_t, int_32, and RPM_NULL_TYPE.  

    int headerMatchLocale (const char * td, const char * l, const char * le, int strip_lang) [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 1386 of file header.c.

    References locale_match().

    Referenced by headerFindI18NString().  

    char* hexFormat (int_32 type, hPTR_t data, char * formatPrefix, int padding, int element) [static]

    Definition at line 2980 of file header.c.

    References _, hPTR_t, int_32, RPM_INT32_TYPE, xmalloc(), and xstrdup().  

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

    Definition at line 190 of file header.c.

    References indexEntry::info, and entryInfo::tag.

    Referenced by findEntry(), and headerSort().  

    int intGetEntry (Header h, int_32 tag, hTAG_t type, hPTR_t * p, hCNT_t c, int minMem) [static]

    Retrieve tag data from header.

    Parameters:

    h
    header
    tag
    tag to retrieve

    Return values:

    type
    address of type (or NULL)
    p
    address of data (or NULL)
    c
    address of count (or NULL)

    Parameters:

    minMem
    string pointers reference header memory?

    Returns: 1 on success, 0 on not found

    Definition at line 1514 of file header.c.

    References copyEntry(), findEntry(), hCNT_t, headerFindI18NString(), hPTR_t, hTAG_t, indexEntry::info, int_32, RPM_I18NSTRING_TYPE, RPM_NULL_TYPE, RPM_STRING_TYPE, and entryInfo::type.

    Referenced by headerGetEntry(), and headerGetEntryMinMemory().  

    int locale_match (const char * sample, const char * l_b, const char * l_e, char delim) [static]

    Definition at line 1356 of file header.c.

    Referenced by headerMatchLocale().  

    char* octalFormat (int_32 type, hPTR_t data, char * formatPrefix, int padding, int element) [static]

    Definition at line 2959 of file header.c.

    References _, hPTR_t, int_32, RPM_INT32_TYPE, xmalloc(), and xstrdup().  

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

    Definition at line 214 of file header.c.

    References indexEntry::data, indexEntry::info, entryInfo::offset, and entryInfo::tag.

    Referenced by headerUnsort().  

    int parseExpression (sprintfToken token, char * str, const headerTagTableEntry tags, const headerSprintfExtension extensions, char ** endPtr, errmsg_t * errmsg) [static]

    Definition at line 2382 of file header.c.

    References _, errmsg_t, findTag(), freeFormat(), parseFormat(), PARSER_IN_EXPR, sprintfToken::type, headerSprintfExtension_s::u, sprintfToken::u, headerTagTableEntry_s::val, and xstrdup().

    Referenced by parseFormat().  

    int parseFormat (char * str, const headerTagTableEntry tags, const headerSprintfExtension extensions, sprintfToken * formatPtr, int * numTokensPtr, char ** endPtr, int state, errmsg_t * errmsg) [static]

    Definition at line 2132 of file header.c.

    References _, sprintfToken::array, errmsg_t, escapedChar(), findTag(), freeFormat(), parseExpression(), PARSER_IN_ARRAY, PARSER_IN_EXPR, sprintfToken::string, sprintfToken::type, headerSprintfExtension_s::u, sprintfToken::u, headerTagTableEntry_s::val, xcalloc(), and xisdigit().

    Referenced by headerSprintf(), and parseExpression().  

    char* realDateFormat (int_32 type, hPTR_t data, char * formatPrefix, int padding, int element, const char * strftimeFormat) [static]

    Definition at line 3001 of file header.c.

    References _, hPTR_t, int_32, RPM_INT32_TYPE, xmalloc(), and xstrdup().

    Referenced by dateFormat(), and dayFormat().  

    char* shescapeFormat (int_32 type, hPTR_t data, char * formatPrefix, int padding, int element) [static]

    Definition at line 3053 of file header.c.

    References alloca(), hPTR_t, int_32, RPM_INT32_TYPE, and xmalloc().  

    char* singleSprintf (Header h, sprintfToken token, const headerSprintfExtension extensions, extensionCache extCache, int element, char ** valp, int * vallenp, int * allocedp) [static]

    Definition at line 2726 of file header.c.

    References formatValue(), getExtension(), headerGetEntry(), headerIsEntry(), stpcpy(), sprintfToken::u, and xrealloc().

    Referenced by headerSprintf().  

    const char* const tagName (int tag)

    Return name of tag from value.

    Parameters:

    tag
    tag value

    Returns: name of tag

    Definition at line 10 of file tagName.c.  

    VARIABLE DOCUMENTATION

     

    HV_t hdrVec = &hdrVec1

    Header methods for rpm headers.

    Definition at line 3279 of file header.c.  

    struct HV_s hdrVec1 [static]

    Definition at line 3243 of file header.c.  

    AUTHOR

    Generated automatically by Doxygen for rpm from the source code.


     

    Index

    NAME
    SYNOPSIS
    Data Structures
    Defines
    Functions
    Variables
    DETAILED DESCRIPTION
    DEFINE DOCUMENTATION
    #define __HEADER_PROTOTYPES__
    #define hdrchkData(_nbytes) ((_nbytes) & 0xff000000)
    #define hdrchkTags(_ntags) ((_ntags) & 0xffff0000)
    #define PARSER_BEGIN 0
    #define PARSER_IN_ARRAY 1
    #define PARSER_IN_EXPR 2
    FUNCTION DOCUMENTATION
    void* _free (const void * p) [inline, static]
    extensionCache allocateExtensionCache (const headerSprintfExtension extensions) [static]
    char* convert (char * ed, const char * td, const char * lang) [static]
    void copyData (int_32 type, void * dstPtr, const void * srcPtr, int_32 c, int dataLength) [static]
    int dataLength (int_32 type, hPTR_t p, int_32 count, int onDisk) [static]
    char* dateFormat (int_32 type, hPTR_t data, char * formatPrefix, int padding, int element) [static]
    char* dayFormat (int_32 type, hPTR_t data, char * formatPrefix, int padding, int element) [static]
    char escapedChar (const char ch) [static]
    indexEntry findEntry (Header h, int_32 tag, int_32 type) [static]
    void findTag (char * name, const headerTagTableEntry tags, const headerSprintfExtension extensions, headerTagTableEntry * tagMatch, headerSprintfExtension * extMatch) [static]
    char* formatValue (sprintfTag tag, Header h, const headerSprintfExtension extensions, extensionCache extCache, int element, char ** valp, int * vallenp, int * allocedp) [static]
    extensionCache freeExtensionCache (const headerSprintfExtension extensions, extensionCache cache) [static]
    sprintfToken freeFormat (sprintfToken format, int num) [static]
    int getExtension (Header h, headerTagTagFunction fn, hTYP_t typeptr, hPTR_t * data, hCNT_t countptr, extensionCache ext) [static]
    void* grabData (int_32 type, hPTR_t p, int_32 c, int * lengthPtr) [static]
    char* headerFindI18NString (Header h, indexEntry entry) [static]
    int headerGetRawEntry (Header h, int_32 tag, int_32 * type, hPTR_t * p, int_32 * c)
    int headerMatchLocale (const char * td, const char * l, const char * le, int strip_lang) [static]
    char* hexFormat (int_32 type, hPTR_t data, char * formatPrefix, int padding, int element) [static]
    int indexCmp (const void * avp, const void * bvp) [static]
    int intGetEntry (Header h, int_32 tag, hTAG_t type, hPTR_t * p, hCNT_t c, int minMem) [static]
    int locale_match (const char * sample, const char * l_b, const char * l_e, char delim) [static]
    char* octalFormat (int_32 type, hPTR_t data, char * formatPrefix, int padding, int element) [static]
    int offsetCmp (const void * avp, const void * bvp) [static]
    int parseExpression (sprintfToken token, char * str, const headerTagTableEntry tags, const headerSprintfExtension extensions, char ** endPtr, errmsg_t * errmsg) [static]
    int parseFormat (char * str, const headerTagTableEntry tags, const headerSprintfExtension extensions, sprintfToken * formatPtr, int * numTokensPtr, char ** endPtr, int state, errmsg_t * errmsg) [static]
    char* realDateFormat (int_32 type, hPTR_t data, char * formatPrefix, int padding, int element, const char * strftimeFormat) [static]
    char* shescapeFormat (int_32 type, hPTR_t data, char * formatPrefix, int padding, int element) [static]
    char* singleSprintf (Header h, sprintfToken token, const headerSprintfExtension extensions, extensionCache extCache, int element, char ** valp, int * vallenp, int * allocedp) [static]
    const char* const tagName (int tag)
    VARIABLE DOCUMENTATION
    HV_t hdrVec = &hdrVec1
    struct HV_s hdrVec1 [static]
    AUTHOR


    Поиск по тексту MAN-ов: 




    Партнёры:
    PostgresPro
    Inferno Solutions
    Hosting by Hoster.ru
    Хостинг:

    Закладки на сайте
    Проследить за страницей
    Created 1996-2024 by Maxim Chirkov
    Добавить, Поддержать, Вебмастеру