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 const char * origin;
00062 int_32 instance;
00063
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
00073 int nrefs;
00074 };
00075
00078 typedef struct sprintfTag_s * sprintfTag;
00079 struct sprintfTag_s {
00080
00081 headerTagFormatFunction fmt;
00082
00083 headerTagTagFunction ext;
00084 int extNum;
00085 int_32 tag;
00086 int justOne;
00087 int arrayCount;
00088
00089 char * format;
00090
00091 char * type;
00092 int pad;
00093 };
00094
00098 typedef struct rpmec_s * rpmec;
00099 struct rpmec_s {
00100 int_32 type;
00101 int_32 count;
00102 int avail;
00103 int freeit;
00104
00105 const void * data;
00106 };
00107
00110 typedef struct sprintfToken_s * sprintfToken;
00111
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
00124 sprintfToken format;
00125 int i;
00126 int numTokens;
00127 } array;
00128 struct {
00129
00130 char * string;
00131 int len;
00132 } string;
00133 struct {
00134
00135 sprintfToken ifFormat;
00136 int numIfTokens;
00137
00138 sprintfToken elseFormat;
00139 int numElseTokens;
00140 struct sprintfTag_s tag;
00141 } cond;
00142 } u;
00143 };
00144
00145
00146 #ifdef __cplusplus
00147 extern "C" {
00148 #endif
00149
00156
00157 char ** headerGetLangs(Header h)
00158 ;
00159
00172
00173
00174 int headerGetRawEntry(Header h, int_32 tag,
00175 hTYP_t type,
00176 hPTR_t * p,
00177 hCNT_t c)
00178
00179 ;
00180
00181
00182
00188
00189 static inline int headerUsageCount(Header h) {
00190 return h->nrefs;
00191 }
00192
00193
00201
00202 void headerDump(Header h, FILE *f, int flags,
00203 const struct headerTagTableEntry_s * tags)
00204
00205 ;
00206 #define HEADER_DUMP_INLINE 1
00207
00208 #ifdef __cplusplus
00209 }
00210 #endif
00211
00212 #endif