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@*/
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 /*@only@*/ /*@null@*/
00061     const char * origin;        
00062     int_32 instance;            
00063 /*@owned@*/
00064     indexEntry index;           
00065     int indexUsed;              
00066     int indexAlloced;           
00067     int flags;
00068 #define HEADERFLAG_SORTED       (1 << 0) 
00069 #define HEADERFLAG_ALLOCATED    (1 << 1) 
00070 #define HEADERFLAG_LEGACY       (1 << 2) 
00071 #define HEADERFLAG_DEBUG        (1 << 3) 
00072 /*@refs@*/
00073     int nrefs;                  
00074 };
00075 
00078 typedef /*@abstract@*/ struct sprintfTag_s * sprintfTag;
00079 struct sprintfTag_s {
00080 /*@null@*/
00081     headerTagFormatFunction fmt;
00082 /*@null@*/
00083     headerTagTagFunction ext;   
00084     int extNum;
00085     int_32 tag;
00086     int justOne;
00087     int arrayCount;
00088 /*@kept@*/
00089     char * format;
00090 /*@kept@*/ /*@null@*/
00091     char * type;
00092     int pad;
00093 };
00094 
00098 typedef /*@abstract@*/ struct rpmec_s * rpmec;
00099 struct rpmec_s {
00100     int_32 type;
00101     int_32 count;
00102     int avail;
00103     int freeit;
00104 /*@owned@*/
00105     const void * data;
00106 };
00107 
00110 typedef /*@abstract@*/ struct sprintfToken_s * sprintfToken;
00111 /*@-fielduse@*/
00112 struct sprintfToken_s {
00113     enum {
00114         PTOK_NONE = 0,
00115         PTOK_TAG,
00116         PTOK_ARRAY,
00117         PTOK_STRING,
00118         PTOK_COND
00119     } type;
00120     union {
00121         struct sprintfTag_s tag;        
00122         struct {
00123         /*@only@*/
00124             sprintfToken format;
00125             int i;
00126             int numTokens;
00127         } array;                        
00128         struct {
00129         /*@dependent@*/
00130             char * string;
00131             int len;
00132         } string;                       
00133         struct {
00134         /*@only@*/ /*@null@*/
00135             sprintfToken ifFormat;
00136             int numIfTokens;
00137         /*@only@*/ /*@null@*/
00138             sprintfToken elseFormat;
00139             int numElseTokens;
00140             struct sprintfTag_s tag;
00141         } cond;                         
00142     } u;
00143 };
00144 /*@=fielduse@*/
00145 
00146 #ifdef __cplusplus
00147 extern "C" {
00148 #endif
00149 
00156 /*@unused@*/
00157 /*@only@*/ /*@null@*/ char ** headerGetLangs(Header h)
00158         /*@*/;
00159 
00172 /*@-exportlocal@*/
00173 /*@-incondefs@*/
00174 int headerGetRawEntry(Header h, int_32 tag,
00175                         /*@null@*/ /*@out@*/ hTYP_t type,
00176                         /*@null@*/ /*@out@*/ hPTR_t * p, 
00177                         /*@null@*/ /*@out@*/ hCNT_t c)
00178         /*@modifies *type, *p, *c @*/
00179         /*@requires maxSet(type) >= 0 /\ maxSet(p) >= 0 /\ maxSet(c) >= 0 @*/;
00180 /*@=incondefs@*/
00181 /*@=exportlocal@*/
00182 
00188 /*@-type@*/ /* FIX: cast? */
00189 /*@unused@*/ static inline int headerUsageCount(Header h) /*@*/ {
00190     return h->nrefs;
00191 }
00192 /*@=type@*/
00193 
00201 /*@unused@*/
00202 void headerDump(Header h, FILE *f, int flags,
00203                 const struct headerTagTableEntry_s * tags)
00204         /*@globals fileSystem @*/
00205         /*@modifies f, fileSystem @*/;
00206 #define HEADER_DUMP_INLINE   1
00207 
00208 #ifdef __cplusplus
00209 }   
00210 #endif
00211 
00212 #endif  /* H_HEADER_INTERNAL */

Generated on Sat Oct 1 16:24:10 2011 for rpm by  doxygen 1.4.4