rpm  4.5
header_internal.h
Go to the documentation of this file.
1 #ifndef H_HEADER_INTERNAL
2 #define H_HEADER_INTERNAL
3 
8 #include <header.h>
9 #include <argv.h>
10 
11 #if !defined(__LCLINT__)
12 #include <netinet/in.h>
13 #endif /* __LCLINT__ */
14 
15 #define INDEX_MALLOC_SIZE 8
16 
17 /*
18  * Teach header.c about legacy tags.
19  */
20 #define HEADER_OLDFILENAMES 1027
21 #define HEADER_BASENAMES 1117
22 
26 typedef /*@abstract@*/ struct entryInfo_s * entryInfo;
27 struct entryInfo_s {
32 };
33 
34 #define REGION_TAG_TYPE RPM_BIN_TYPE
35 #define REGION_TAG_COUNT sizeof(struct entryInfo_s)
36 
37 #define ENTRY_IS_REGION(_e) \
38  (((_e)->info.tag >= HEADER_IMAGE) && ((_e)->info.tag < HEADER_REGIONS))
39 #define ENTRY_IN_REGION(_e) ((_e)->info.offset < 0)
40 
44 typedef /*@abstract@*/ struct indexEntry_s * indexEntry;
45 struct indexEntry_s {
46  struct entryInfo_s info;
47 /*@owned@*/
48  void * data;
49  int length;
50  int rdlen;
51 };
52 
56 struct headerToken_s {
57 /*@unused@*/
58  struct HV_s hv;
59 /*@only@*/ /*@null@*/
60  void * blob;
61 /*@only@*/ /*@null@*/
62  const char * origin;
63  const char * baseurl;
64  const char * digest;
65  struct stat sb;
66  uint32_t instance;
67  uint32_t startoff;
68  uint32_t endoff;
69 /*@owned@*/
70  indexEntry index;
71  int indexUsed;
73  int flags;
74 #define HEADERFLAG_SORTED (1 << 0)
75 #define HEADERFLAG_ALLOCATED (1 << 1)
76 #define HEADERFLAG_LEGACY (1 << 2)
77 #define HEADERFLAG_DEBUG (1 << 3)
78 /*@refs@*/
79  int nrefs;
80 };
81 
84 typedef /*@abstract@*/ struct sprintfTag_s * sprintfTag;
85 struct sprintfTag_s {
87 /*@null@*/
89 /*@null@*/
91  int extNum;
93  int justOne;
95 /*@kept@*/
96  char * format;
97 /*@only@*/ /*@null@*/
100  int pad;
101 };
102 
105 typedef /*@abstract@*/ struct sprintfToken_s * sprintfToken;
106 /*@-fielduse@*/
108  enum {
110  PTOK_TAG = 1,
114  } type;
115  union {
116  struct sprintfTag_s tag;
117  struct {
118  /*@only@*/
119  sprintfToken format;
121  } array;
122  struct {
123  /*@dependent@*/
124  char * string;
125  int len;
126  } string;
127  struct {
128  /*@only@*/ /*@null@*/
129  sprintfToken ifFormat;
131  /*@only@*/ /*@null@*/
132  sprintfToken elseFormat;
134  struct sprintfTag_s tag;
135  } cond;
136  } u;
137 };
138 /*@=fielduse@*/
139 
140 #ifdef __cplusplus
141 extern "C" {
142 #endif
143 
150 /*@unused@*/
151 /*@only@*/ /*@null@*/ char ** headerGetLangs(Header h)
152  /*@*/;
153 
166 /*@-exportlocal@*/
167 /*@-incondefs@*/
168 int headerGetRawEntry(Header h, int_32 tag,
169  /*@null@*/ /*@out@*/ rpmTagType * type,
170  /*@null@*/ /*@out@*/ void * p,
171  /*@null@*/ /*@out@*/ rpmTagCount * c)
172  /*@modifies *type, *p, *c @*/
173  /*@requires maxSet(type) >= 0 /\ maxSet(p) >= 0 /\ maxSet(c) >= 0 @*/;
174 /*@=incondefs@*/
175 /*@=exportlocal@*/
176 
182 /*@-type@*/ /* FIX: cast? */
183 /*@unused@*/ static inline int headerUsageCount(Header h) /*@*/ {
184  return h->nrefs;
185 }
186 /*@=type@*/
187 
195 /*@unused@*/
196 void headerDump(Header h, FILE *f, int flags,
197  const struct headerTagTableEntry_s * tags)
198  /*@globals fileSystem @*/
199  /*@modifies f, fileSystem @*/;
200 #define HEADER_DUMP_INLINE 1
201 
202 #ifdef __cplusplus
203 }
204 #endif
205 
206 #endif /* H_HEADER_INTERNAL */