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
00014
00015 #define INDEX_MALLOC_SIZE 8
00016
00017
00018
00019
00020 #define HEADER_OLDFILENAMES 1027
00021 #define HEADER_BASENAMES 1117
00022
00026 typedef 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 struct indexEntry_s * indexEntry;
00045 struct indexEntry_s {
00046 struct entryInfo_s info;
00047
00048 void * data;
00049 int length;
00050 int rdlen;
00051 };
00052
00056 struct headerToken_s {
00057
00058 struct HV_s hv;
00059
00060 void * blob;
00061
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
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
00079 int nrefs;
00080 };
00081
00084 typedef struct sprintfTag_s * sprintfTag;
00085 struct sprintfTag_s {
00086 HE_s he;
00087
00088 headerTagFormatFunction * fmtfuncs;
00089
00090 headerTagTagFunction ext;
00091 int extNum;
00092 int_32 tagno;
00093 int justOne;
00094 int arrayCount;
00095
00096 char * format;
00097
00098 ARGV_t av;
00099 ARGV_t params;
00100 int pad;
00101 };
00102
00105 typedef struct sprintfToken_s * sprintfToken;
00106
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
00119 sprintfToken format;
00120 int numTokens;
00121 } array;
00122 struct {
00123
00124 char * string;
00125 int len;
00126 } string;
00127 struct {
00128
00129 sprintfToken ifFormat;
00130 int numIfTokens;
00131
00132 sprintfToken elseFormat;
00133 int numElseTokens;
00134 struct sprintfTag_s tag;
00135 } cond;
00136 } u;
00137 };
00138
00139
00140 #ifdef __cplusplus
00141 extern "C" {
00142 #endif
00143
00150
00151 char ** headerGetLangs(Header h)
00152 ;
00153
00166
00167
00168 int headerGetRawEntry(Header h, int_32 tag,
00169 rpmTagType * type,
00170 void * p,
00171 rpmTagCount * c)
00172
00173 ;
00174
00175
00176
00182
00183 static inline int headerUsageCount(Header h) {
00184 return h->nrefs;
00185 }
00186
00187
00195
00196 void headerDump(Header h, FILE *f, int flags,
00197 const struct headerTagTableEntry_s * tags)
00198
00199 ;
00200 #define HEADER_DUMP_INLINE 1
00201
00202 #ifdef __cplusplus
00203 }
00204 #endif
00205
00206 #endif