- Main Page
- Related Pages
- Modules
- Data Structures
- Files

# rpmdb/header_internal.h

Go to the documentation of this file.

    00001 #ifndef H_HEADER_INTERNAL
    00002 #define H_HEADER_INTERNAL
    00003
    00008 #include <rpmtag.h>
    00009
    00010 #if !defined(__LCLINT__)
    00011 #include <netinet/in.h>
    00012 #endif  /* __LCLINT__ */
    00013
    00018 #define hdrchkTags(_ntags)      ((_ntags) & 0xff000000)
    00019
    00023 #define hdrchkType(_type) ((_type) < RPM_MIN_TYPE || (_type) > RPM_MAX_TYPE)
    00024
    00029 #define hdrchkData(_nbytes) ((_nbytes) & 0xc0000000)
    00030
    00034 /*@unchecked@*/ /*@observer@*/
    00035 extern int rpm_typeAlign[16];
    00036 #define hdrchkAlign(_type, _off)        ((_off) & (rpm_typeAlign[_type]-1))
    00037
    00041 #define hdrchkRange(_dl, _off)          ((_off) < 0 || (_off) > (_dl))
    00042
    00043 #define INDEX_MALLOC_SIZE       8
    00044
    00045 /*
    00046  * Teach header.c about legacy tags.
    00047  */
    00048 #define HEADER_OLDFILENAMES     1027
    00049 #define HEADER_BASENAMES        1117
    00050
    00054 typedef /*@abstract@*/ struct entryInfo_s * entryInfo;
    00055 struct entryInfo_s {
    00056     rpmTag tag;
    00057     rpmTagType type;
    00058     int32_t offset;
    00059     rpmTagCount count;
    00060 };
    00061
    00062 #define REGION_TAG_TYPE         RPM_BIN_TYPE
    00063 #define REGION_TAG_COUNT        sizeof(struct entryInfo_s)
    00064
    00065 #define ENTRY_IS_REGION(_e) \
    00066         (((_e)->info.tag >= HEADER_IMAGE) && ((_e)->info.tag < HEADER_REGIONS))
    00067 #define ENTRY_IN_REGION(_e)     ((_e)->info.offset < 0)
    00068
    00072 typedef /*@abstract@*/ struct indexEntry_s * indexEntry;
    00073 struct indexEntry_s {
    00074     struct entryInfo_s info;
    00075 /*@owned@*/
    00076     void * data;
    00077     size_t length;
    00078     size_t rdlen;
    00079 };
    00080
    00084 struct headerToken_s {
    00085     unsigned char magic[8];
    00086 /*@only@*/ /*@null@*/
    00087     void * blob;
    00088 /*@only@*/ /*@null@*/
    00089     const char * origin;
    00090     uint32_t instance;
    00091     struct rpmop_s h_loadops;
    00092     struct rpmop_s h_getops;
    00093 /*@owned@*/
    00094     indexEntry index;
    00095     size_t indexUsed;
    00096     size_t indexAlloced;
    00097     uint32_t flags;
    00098 #define HEADERFLAG_SORTED       (1 << 0)
    00099 #define HEADERFLAG_ALLOCATED    (1 << 1)
    00100 #define HEADERFLAG_LEGACY       (1 << 2)
    00101 #define HEADERFLAG_DEBUG        (1 << 3)
    00102 #define HEADERFLAG_SIGNATURE    (1 << 4)
    00103 /*@refs@*/
    00104     int nrefs;
    00105 };
    00106
    00107 #ifdef __cplusplus
    00108 extern "C" {
    00109 #endif
    00110
    00120 int headerVerifyInfo(uint32_t il, uint32_t dl, const void * pev, void * iv, int negate)
    00121         /*@modifies *iv @*/;
    00122
    00128 /*@-type@*/ /* FIX: cast? */
    00129 /*@unused@*/ static inline int headerUsageCount(Header h) /*@*/ {
    00130     return h->nrefs;
    00131 }
    00132 /*@=type@*/
    00133
    00134 #ifdef __cplusplus
    00135 }
    00136 #endif
    00137
    00138 #endif  /* H_HEADER_INTERNAL */