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

# rpmdb/header_internal.h

Go to the documentation of this file.

    00001 #ifndef H_HEADER_INTERNAL
    00002 #define H_HEADER_INTERNAL
    00003
    00008 #include <header.h>
    00009
    00010 #if !defined(__LCLINT__)
    00011 #include <netinet/in.h>
    00012 #endif  /* __LCLINT__ */
    00013
    00014 #define INDEX_MALLOC_SIZE       8
    00015
    00016 /*
    00017  * Teach header.c about legacy tags.
    00018  */
    00019 #define HEADER_OLDFILENAMES     1027
    00020 #define HEADER_BASENAMES        1117
    00021
    00025 typedef /*@abstract@*/ struct entryInfo_s * entryInfo;
    00026 struct entryInfo_s {
    00027     int_32 tag;
    00028     int_32 type;
    00029     int_32 offset;
    00030     int_32 count;
    00031 };
    00032
    00033 #define REGION_TAG_TYPE         RPM_BIN_TYPE
    00034 #define REGION_TAG_COUNT        sizeof(struct entryInfo_s)
    00035
    00036 #define ENTRY_IS_REGION(_e) \
    00037         (((_e)->info.tag >= HEADER_IMAGE) && ((_e)->info.tag < HEADER_REGIONS))
    00038 #define ENTRY_IN_REGION(_e)     ((_e)->info.offset < 0)
    00039
    00043 typedef /*@abstract@*/ struct indexEntry_s * indexEntry;
    00044 struct indexEntry_s {
    00045     struct entryInfo_s info;
    00046 /*@owned@*/ void * data;
    00047     int length;
    00048     int rdlen;
    00049 };
    00050
    00054 struct headerToken {
    00055 /*@unused@*/ struct HV_s hv;
    00056 /*@only@*/ /*@null@*/
    00057     void * blob;
    00058 /*@owned@*/ indexEntry index;
    00059     int indexUsed;
    00060     int indexAlloced;
    00061     int flags;
    00062 #define HEADERFLAG_SORTED       (1 << 0)
    00063 #define HEADERFLAG_ALLOCATED    (1 << 1)
    00064 #define HEADERFLAG_LEGACY       (1 << 2)
    00065 #define HEADERFLAG_DEBUG        (1 << 3)
    00066 /*@refs@*/ int nrefs;
    00067 };
    00068
    00071 typedef /*@abstract@*/ struct sprintfTag_s * sprintfTag;
    00072 struct sprintfTag_s {
    00073 /*@null@*/ headerTagTagFunction ext;
    00074     int extNum;
    00075     int_32 tag;
    00076     int justOne;
    00077     int arrayCount;
    00078 /*@kept@*/ char * format;
    00079 /*@kept@*/ /*@null@*/ char * type;
    00080     int pad;
    00081 };
    00082
    00085 typedef /*@abstract@*/ struct extensionCache_s * extensionCache;
    00086 struct extensionCache_s {
    00087     int_32 type;
    00088     int_32 count;
    00089     int avail;
    00090     int freeit;
    00091 /*@owned@*/ const void * data;
    00092 };
    00093
    00096 typedef /*@abstract@*/ struct sprintfToken * sprintfToken;
    00097 /*@-fielduse@*/
    00098 struct sprintfToken {
    00099     enum {
    00100         PTOK_NONE = 0,
    00101         PTOK_TAG,
    00102         PTOK_ARRAY,
    00103         PTOK_STRING,
    00104         PTOK_COND
    00105     } type;
    00106     union {
    00107         struct {
    00108         /*@only@*/ sprintfToken format;
    00109             int numTokens;
    00110         } array;
    00111         struct sprintfTag_s tag;
    00112         struct {
    00113         /*@dependent@*/ char * string;
    00114             int len;
    00115         } string;
    00116         struct {
    00117         /*@only@*/ /*@null@*/ sprintfToken ifFormat;
    00118             int numIfTokens;
    00119         /*@only@*/ /*@null@*/ sprintfToken elseFormat;
    00120             int numElseTokens;
    00121             struct sprintfTag_s tag;
    00122         } cond;
    00123     } u;
    00124 };
    00125 /*@=fielduse@*/
    00126
    00127 #ifdef __cplusplus
    00128 extern "C" {
    00129 #endif
    00130
    00137 /*@unused@*/
    00138 /*@only@*/ /*@null@*/ char ** headerGetLangs(Header h)
    00139         /*@*/;
    00140
    00153 /*@-exportlocal@*/
    00154 /*@-incondefs@*/
    00155 int headerGetRawEntry(Header h, int_32 tag,
    00156                         /*@null@*/ /*@out@*/ hTYP_t type,
    00157                         /*@null@*/ /*@out@*/ hPTR_t * p,
    00158                         /*@null@*/ /*@out@*/ hCNT_t c)
    00159         /*@modifies *type, *p, *c @*/
    00160         /*@requires maxSet(type) >= 0 /\ maxSet(p) >= 0 /\ maxSet(c) >= 0 @*/;
    00161 /*@=incondefs@*/
    00162 /*@=exportlocal@*/
    00163
    00169 /*@-type@*/ /* FIX: cast? */
    00170 /*@unused@*/ static inline int headerUsageCount(Header h) /*@*/ {
    00171     return h->nrefs;
    00172 }
    00173 /*@=type@*/
    00174
    00182 /*@unused@*/
    00183 void headerDump(Header h, FILE *f, int flags,
    00184                 const struct headerTagTableEntry_s * tags)
    00185         /*@globals fileSystem @*/
    00186         /*@modifies f, fileSystem @*/;
    00187 #define HEADER_DUMP_INLINE   1
    00188
    00189 #ifdef __cplusplus
    00190 }
    00191 #endif
    00192
    00193 #endif  /* H_HEADER_INTERNAL */