rpm
4.5
|
00001 #ifndef H_HEADER_INTERNAL 00002 #define H_HEADER_INTERNAL 00003 00008 #include <header.h> 00009 #include <argv.h> 00010 00011 #if !defined(__LCLINT__) 00012 #include <netinet/in.h> 00013 #endif /* __LCLINT__ */ 00014 00015 #define INDEX_MALLOC_SIZE 8 00016 00017 /* 00018 * Teach header.c about legacy tags. 00019 */ 00020 #define HEADER_OLDFILENAMES 1027 00021 #define HEADER_BASENAMES 1117 00022 00026 typedef /*@abstract@*/ struct entryInfo_s * entryInfo; 00027 struct entryInfo_s { 00028 int_32 tag; 00029 int_32 type; 00030 int_32 offset; 00031 int_32 count; 00032 }; 00033 00034 #define REGION_TAG_TYPE RPM_BIN_TYPE 00035 #define REGION_TAG_COUNT sizeof(struct entryInfo_s) 00036 00037 #define ENTRY_IS_REGION(_e) \ 00038 (((_e)->info.tag >= HEADER_IMAGE) && ((_e)->info.tag < HEADER_REGIONS)) 00039 #define ENTRY_IN_REGION(_e) ((_e)->info.offset < 0) 00040 00044 typedef /*@abstract@*/ struct indexEntry_s * indexEntry; 00045 struct indexEntry_s { 00046 struct entryInfo_s info; 00047 /*@owned@*/ 00048 void * data; 00049 int length; 00050 int rdlen; 00051 }; 00052 00056 struct headerToken_s { 00057 /*@unused@*/ 00058 struct HV_s hv; 00059 /*@only@*/ /*@null@*/ 00060 void * blob; 00061 /*@only@*/ /*@null@*/ 00062 const char * origin; 00063 const char * baseurl; 00064 const char * digest; 00065 struct stat sb; 00066 uint32_t instance; 00067 uint32_t startoff; 00068 uint32_t endoff; 00069 /*@owned@*/ 00070 indexEntry index; 00071 int indexUsed; 00072 int indexAlloced; 00073 int flags; 00074 #define HEADERFLAG_SORTED (1 << 0) 00075 #define HEADERFLAG_ALLOCATED (1 << 1) 00076 #define HEADERFLAG_LEGACY (1 << 2) 00077 #define HEADERFLAG_DEBUG (1 << 3) 00078 /*@refs@*/ 00079 int nrefs; 00080 }; 00081 00084 typedef /*@abstract@*/ struct sprintfTag_s * sprintfTag; 00085 struct sprintfTag_s { 00086 HE_s he; 00087 /*@null@*/ 00088 headerTagFormatFunction * fmtfuncs; 00089 /*@null@*/ 00090 headerTagTagFunction ext; 00091 int extNum; 00092 int_32 tagno; 00093 int justOne; 00094 int arrayCount; 00095 /*@kept@*/ 00096 char * format; 00097 /*@only@*/ /*@null@*/ 00098 ARGV_t av; 00099 ARGV_t params; 00100 int pad; 00101 }; 00102 00105 typedef /*@abstract@*/ struct sprintfToken_s * sprintfToken; 00106 /*@-fielduse@*/ 00107 struct sprintfToken_s { 00108 enum { 00109 PTOK_NONE = 0, 00110 PTOK_TAG = 1, 00111 PTOK_ARRAY = 2, 00112 PTOK_STRING = 3, 00113 PTOK_COND = 4 00114 } type; 00115 union { 00116 struct sprintfTag_s tag; 00117 struct { 00118 /*@only@*/ 00119 sprintfToken format; 00120 int numTokens; 00121 } array; 00122 struct { 00123 /*@dependent@*/ 00124 char * string; 00125 int len; 00126 } string; 00127 struct { 00128 /*@only@*/ /*@null@*/ 00129 sprintfToken ifFormat; 00130 int numIfTokens; 00131 /*@only@*/ /*@null@*/ 00132 sprintfToken elseFormat; 00133 int numElseTokens; 00134 struct sprintfTag_s tag; 00135 } cond; 00136 } u; 00137 }; 00138 /*@=fielduse@*/ 00139 00140 #ifdef __cplusplus 00141 extern "C" { 00142 #endif 00143 00150 /*@unused@*/ 00151 /*@only@*/ /*@null@*/ char ** headerGetLangs(Header h) 00152 /*@*/; 00153 00166 /*@-exportlocal@*/ 00167 /*@-incondefs@*/ 00168 int headerGetRawEntry(Header h, int_32 tag, 00169 /*@null@*/ /*@out@*/ rpmTagType * type, 00170 /*@null@*/ /*@out@*/ void * p, 00171 /*@null@*/ /*@out@*/ rpmTagCount * c) 00172 /*@modifies *type, *p, *c @*/ 00173 /*@requires maxSet(type) >= 0 /\ maxSet(p) >= 0 /\ maxSet(c) >= 0 @*/; 00174 /*@=incondefs@*/ 00175 /*@=exportlocal@*/ 00176 00182 /*@-type@*/ /* FIX: cast? */ 00183 /*@unused@*/ static inline int headerUsageCount(Header h) /*@*/ { 00184 return h->nrefs; 00185 } 00186 /*@=type@*/ 00187 00195 /*@unused@*/ 00196 void headerDump(Header h, FILE *f, int flags, 00197 const struct headerTagTableEntry_s * tags) 00198 /*@globals fileSystem @*/ 00199 /*@modifies f, fileSystem @*/; 00200 #define HEADER_DUMP_INLINE 1 00201 00202 #ifdef __cplusplus 00203 } 00204 #endif 00205 00206 #endif /* H_HEADER_INTERNAL */