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

lib/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 * entryInfo;
00026 struct entryInfo {
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)
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 * indexEntry;
00044 struct indexEntry {
00045     struct entryInfo info;      
00046 /*@owned@*/ void * data;        
00047     int length;                 
00048     int rdlen;                  
00049 };
00050 
00054 struct headerToken {
00055 /*@unused@*/ struct HV_s hv;    
00056     void * blob;                
00057 /*@owned@*/ indexEntry index;   
00058     int indexUsed;              
00059     int indexAlloced;           
00060     int flags;
00061 #define HEADERFLAG_SORTED       (1 << 0) 
00062 #define HEADERFLAG_ALLOCATED    (1 << 1) 
00063 #define HEADERFLAG_LEGACY       (1 << 2) 
00064 /*@refs@*/ int nrefs;   
00065 };
00066 
00069 typedef /*@abstract@*/ struct sprintfTag * sprintfTag;
00070 struct sprintfTag {
00071 /*@null@*/ headerTagTagFunction ext;   
00072     int extNum;
00073     int_32 tag;
00074     int justOne;
00075     int arrayCount;
00076 /*@kept@*/ char * format;
00077 /*@kept@*/ /*@null@*/ char * type;
00078     int pad;
00079 };
00080 
00083 typedef /*@abstract@*/ struct extensionCache * extensionCache;
00084 struct extensionCache {
00085     int_32 type;
00086     int_32 count;
00087     int avail;
00088     int freeit;
00089 /*@owned@*/ const void * data;
00090 };
00091 
00094 /*@-fielduse@*/
00095 typedef /*@abstract@*/ struct sprintfToken * sprintfToken;
00096 struct sprintfToken {
00097     enum {
00098         PTOK_NONE = 0,
00099         PTOK_TAG,
00100         PTOK_ARRAY,
00101         PTOK_STRING,
00102         PTOK_COND
00103     } type;
00104     union {
00105         struct {
00106         /*@only@*/ sprintfToken format;
00107             int numTokens;
00108         } array;
00109         struct sprintfTag tag;
00110         struct {
00111         /*@dependent@*/ char * string;
00112             int len;
00113         } string;
00114         struct {
00115         /*@only@*/ /*@null@*/ sprintfToken ifFormat;
00116             int numIfTokens;
00117         /*@only@*/ /*@null@*/ sprintfToken elseFormat;
00118             int numElseTokens;
00119             struct sprintfTag tag;
00120         } cond;
00121     } u;
00122 };
00123 /*@=fielduse@*/
00124 
00125 #ifdef __cplusplus
00126 extern "C" {
00127 #endif
00128 
00135 /*@unused@*/
00136 /*@only@*/ /*@null@*/ char ** headerGetLangs(Header h)
00137         /*@*/;
00138 
00151 /*@-exportlocal@*/
00152 int headerGetRawEntry(Header h, int_32 tag,
00153                         /*@null@*/ /*@out@*/ hTYP_t type,
00154                         /*@null@*/ /*@out@*/ hPTR_t * p, 
00155                         /*@null@*/ /*@out@*/ hCNT_t c)
00156         /*@modifies *type, *p, *c @*/;
00157 /*@=exportlocal@*/
00158 
00164 /*@unused@*/ static inline int headerUsageCount(Header h) /*@*/ {
00165     return h->nrefs;
00166 }
00167 
00174 /*@unused@*/
00175 void headerDump(Header h, FILE *f, int flags,
00176                 const struct headerTagTableEntry_s * tags)
00177         /*@modifies f, fileSystem @*/;
00178 #define HEADER_DUMP_INLINE   1
00179 
00180 #ifdef __cplusplus
00181 }   
00182 #endif
00183 
00184 #endif  /* H_HEADER_INTERNAL */

Generated on Sat Oct 23 07:55:34 2004 for rpm by doxygen 1.3.6