header_internal.h
Go to the documentation of this file.
#ifndef H_HEADER_INTERNAL
#define H_HEADER_INTERNAL
#include <rpmtag.h>
#include <yarn.h>
#if !defined(__LCLINT__)
#include <netinet/in.h>
#endif /* __LCLINT__ */
#define hdrchkTags(_ntags) ((_ntags) & 0xff000000)
#define hdrchkType(_type) ((_type) < RPM_MIN_TYPE || (_type) > RPM_MAX_TYPE)
#define hdrchkData(_nbytes) ((_nbytes) & 0xc0000000)
/*@unchecked@*/ /*@observer@*/
extern int rpm_typeAlign[16];
#define hdrchkAlign(_type, _off) ((_off) & (rpm_typeAlign[_type]-1))
#define hdrchkRange(_dl, _off) ((_off) < 0 || (_off) > (_dl))
#define INDEX_MALLOC_SIZE 8
/*
* Teach header.c about legacy tags.
*/
#define HEADER_OLDFILENAMES 1027
#define HEADER_BASENAMES 1117
typedef /*@abstract@*/ struct entryInfo_s * entryInfo;
struct entryInfo_s {
rpmTag tag;
rpmTagType type;
rpmint32_t offset;
rpmTagCount count;
};
#define REGION_TAG_TYPE RPM_BIN_TYPE
#define REGION_TAG_COUNT sizeof(struct entryInfo_s)
#define ENTRY_IS_REGION(_e) \
(((_e)->info.tag >= HEADER_IMAGE) && ((_e)->info.tag < HEADER_REGIONS))
#define ENTRY_IN_REGION(_e) ((_e)->info.offset < 0)
typedef /*@abstract@*/ struct indexEntry_s * indexEntry;
struct indexEntry_s {
struct entryInfo_s info;
/*@owned@*/
void * data;
size_t length;
size_t rdlen;
};
struct headerToken_s {
struct rpmioItem_s _item;
unsigned char magic[8];
/*@only@*/ /*@null@*/
void * blob;
size_t bloblen;
/*@only@*/ /*@null@*/
const char * origin;
/*@only@*/ /*@null@*/
const char * baseurl;
/*@only@*/ /*@null@*/
const char * digest;
/*@null@*/
void * rpmdb;
struct stat sb;
rpmuint32_t instance;
rpmuint32_t startoff;
rpmuint32_t endoff;
struct rpmop_s h_loadops;
struct rpmop_s h_getops;
/*@owned@*/
indexEntry index;
size_t indexUsed;
size_t indexAlloced;
rpmuint32_t flags;
#define HEADERFLAG_SORTED (1 << 0)
#define HEADERFLAG_ALLOCATED (1 << 1)
#define HEADERFLAG_LEGACY (1 << 2)
#define HEADERFLAG_DEBUG (1 << 3)
#define HEADERFLAG_SIGNATURE (1 << 4)
#define HEADERFLAG_MAPPED (1 << 5)
#define HEADERFLAG_RDONLY (1 << 6)
#if defined(__LCLINT__)
/*@refs@*/
int nrefs;
#endif
};
#ifdef __cplusplus
extern "C" {
#endif
int headerVerifyInfo(rpmuint32_t il, rpmuint32_t dl, const void * pev, void * iv, int negate)
/*@modifies *iv @*/;
/*@-type@*/ /* FIX: cast? */
/*@unused@*/ static inline
int headerUsageCount(Header h)
/*@globals fileSystem, internalState @*/
/*@modifies fileSystem, internalState @*/
{
int nrefs = 0;
yarnPossess(h->_item.use);
nrefs = (int)yarnPeekLock(h->_item.use);
yarnRelease(h->_item.use);
return nrefs;
}
/*@=type@*/
#ifdef __cplusplus
}
#endif
#endif /* H_HEADER_INTERNAL */