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
00013
00014 #define INDEX_MALLOC_SIZE 8
00015
00016
00017
00018
00019 #define HEADER_OLDFILENAMES 1027
00020 #define HEADER_BASENAMES 1117
00021
00025 typedef 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 struct indexEntry_s * indexEntry;
00044 struct indexEntry_s {
00045 struct entryInfo_s info;
00046
00047 void * data;
00048 int length;
00049 int rdlen;
00050 };
00051
00055 struct headerToken_s {
00056
00057 struct HV_s hv;
00058
00059 void * blob;
00060
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
00070 int nrefs;
00071 };
00072
00075 typedef struct sprintfTag_s * sprintfTag;
00076 struct sprintfTag_s {
00077
00078 headerTagFormatFunction fmt;
00079
00080 headerTagTagFunction ext;
00081 int extNum;
00082 int_32 tag;
00083 int justOne;
00084 int arrayCount;
00085
00086 char * format;
00087
00088 char * type;
00089 int pad;
00090 };
00091
00095 typedef struct rpmec_s * rpmec;
00096 struct rpmec_s {
00097 int_32 type;
00098 int_32 count;
00099 int avail;
00100 int freeit;
00101
00102 const void * data;
00103 };
00104
00107 typedef struct sprintfToken_s * sprintfToken;
00108
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
00121 sprintfToken format;
00122 int i;
00123 int numTokens;
00124 } array;
00125 struct {
00126
00127 char * string;
00128 int len;
00129 } string;
00130 struct {
00131
00132 sprintfToken ifFormat;
00133 int numIfTokens;
00134
00135 sprintfToken elseFormat;
00136 int numElseTokens;
00137 struct sprintfTag_s tag;
00138 } cond;
00139 } u;
00140 };
00141
00142
00143 #ifdef __cplusplus
00144 extern "C" {
00145 #endif
00146
00153
00154 char ** headerGetLangs(Header h)
00155 ;
00156
00169
00170
00171 int headerGetRawEntry(Header h, int_32 tag,
00172 hTYP_t type,
00173 hPTR_t * p,
00174 hCNT_t c)
00175
00176 ;
00177
00178
00179
00185
00186 static inline int headerUsageCount(Header h) {
00187 return h->nrefs;
00188 }
00189
00190
00198
00199 void headerDump(Header h, FILE *f, int flags,
00200 const struct headerTagTableEntry_s * tags)
00201
00202 ;
00203 #define HEADER_DUMP_INLINE 1
00204
00205
00211 char * bin2hex(const char *data, size_t count);
00212
00213 #ifdef __cplusplus
00214 }
00215 #endif
00216
00217 #endif