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@*/
00047     void * data;                
00048     int length;                 
00049     int rdlen;                  
00050 };
00051 
00055 struct headerToken_s {
00056 /*@unused@*/
00057     struct HV_s hv;             
00058 /*@only@*/ /*@null@*/
00059     void * blob;                
00060 /*@owned@*/
00061     indexEntry index;           
00062     int indexUsed;              
00063     int indexAlloced;           
00064     int flags;
00065 #define HEADERFLAG_SORTED       (1 << 0) 
00066 #define HEADERFLAG_ALLOCATED    (1 << 1) 
00067 #define HEADERFLAG_LEGACY       (1 << 2) 
00068 #define HEADERFLAG_DEBUG        (1 << 3) 
00069 /*@refs@*/
00070     int nrefs;                  
00071 };
00072 
00075 typedef /*@abstract@*/ struct sprintfTag_s * sprintfTag;
00076 struct sprintfTag_s {
00077 /*@null@*/
00078     headerTagFormatFunction fmt;
00079 /*@null@*/
00080     headerTagTagFunction ext;   
00081     int extNum;
00082     int_32 tag;
00083     int justOne;
00084     int arrayCount;
00085 /*@kept@*/
00086     char * format;
00087 /*@kept@*/ /*@null@*/
00088     char * type;
00089     int pad;
00090 };
00091 
00095 typedef /*@abstract@*/ struct rpmec_s * rpmec;
00096 struct rpmec_s {
00097     int_32 type;
00098     int_32 count;
00099     int avail;
00100     int freeit;
00101 /*@owned@*/
00102     const void * data;
00103 };
00104 
00107 typedef /*@abstract@*/ struct sprintfToken_s * sprintfToken;
00108 /*@-fielduse@*/
00109 struct sprintfToken_s {
00110     enum {
00111         PTOK_NONE = 0,
00112         PTOK_TAG,
00113         PTOK_ARRAY,
00114         PTOK_STRING,
00115         PTOK_COND
00116     } type;
00117     union {
00118         struct sprintfTag_s tag;        
00119         struct {
00120         /*@only@*/
00121             sprintfToken format;
00122             int i;
00123             int numTokens;
00124         } array;                        
00125         struct {
00126         /*@dependent@*/
00127             char * string;
00128             int len;
00129         } string;                       
00130         struct {
00131         /*@only@*/ /*@null@*/
00132             sprintfToken ifFormat;
00133             int numIfTokens;
00134         /*@only@*/ /*@null@*/
00135             sprintfToken elseFormat;
00136             int numElseTokens;
00137             struct sprintfTag_s tag;
00138         } cond;                         
00139     } u;
00140 };
00141 /*@=fielduse@*/
00142 
00143 #ifdef __cplusplus
00144 extern "C" {
00145 #endif
00146 
00153 /*@unused@*/
00154 /*@only@*/ /*@null@*/ char ** headerGetLangs(Header h)
00155         /*@*/;
00156 
00169 /*@-exportlocal@*/
00170 /*@-incondefs@*/
00171 int headerGetRawEntry(Header h, int_32 tag,
00172                         /*@null@*/ /*@out@*/ hTYP_t type,
00173                         /*@null@*/ /*@out@*/ hPTR_t * p, 
00174                         /*@null@*/ /*@out@*/ hCNT_t c)
00175         /*@modifies *type, *p, *c @*/
00176         /*@requires maxSet(type) >= 0 /\ maxSet(p) >= 0 /\ maxSet(c) >= 0 @*/;
00177 /*@=incondefs@*/
00178 /*@=exportlocal@*/
00179 
00185 /*@-type@*/ /* FIX: cast? */
00186 /*@unused@*/ static inline int headerUsageCount(Header h) /*@*/ {
00187     return h->nrefs;
00188 }
00189 /*@=type@*/
00190 
00198 /*@unused@*/
00199 void headerDump(Header h, FILE *f, int flags,
00200                 const struct headerTagTableEntry_s * tags)
00201         /*@globals fileSystem @*/
00202         /*@modifies f, fileSystem @*/;
00203 #define HEADER_DUMP_INLINE   1
00204 
00205 /* XXX not perhaps the right place but.. */
00211 char * bin2hex(const char *data, size_t count);
00212 
00213 #ifdef __cplusplus
00214 }   
00215 #endif
00216 
00217 #endif  /* H_HEADER_INTERNAL */

Generated on Fri Oct 12 08:44:54 2007 for rpm by  doxygen 1.5.2