rpm 4.11.90

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

header.h
Go to the documentation of this file.
1 #ifndef H_HEADER
2 #define H_HEADER
3
13 /* RPM - Copyright (C) 1995-2001 Red Hat Software */
14
15 #include <rpm/rpmio.h>
16 #include <rpm/rpmtypes.h>
17 #include <rpm/rpmtd.h>
18 #include <rpm/rpmutil.h>
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
27 extern const unsigned char rpm_header_magic[8];
28
32 enum hMagic {
33 HEADER_MAGIC_NO = 0,
34 HEADER_MAGIC_YES = 1
35 };
36
41 Header headerNew(void);
42
48 Header headerFree( Header h);
49
55 Header headerLink(Header h);
56
61 void headerSort(Header h);
62
67 void headerUnsort(Header h);
68
75 unsigned int headerSizeof(Header h, int magicp);
76
86 int headerVerifyInfo(int il, int dl, const void * pev, void * iv, int negate);
87
94 void * headerUnload(Header h);
95
102 void * headerExport(Header h, unsigned int * bsize);
103
111 Header headerReload(Header h, rpmTagVal tag);
112
118 Header headerCopy(Header h);
119
126 Header headerLoad(void * uh);
127
134 Header headerCopyLoad(const void * uh);
135
136 enum headerImportFlags_e {
137 HEADERIMPORT_COPY = (1 << 0), /* Make copy of blob on import? */
138 HEADERIMPORT_FAST = (1 << 1), /* Faster but less safe? */
139 };
140
141 typedef rpmFlags headerImportFlags;
142
150 Header headerImport(void *blob, unsigned int bsize, headerImportFlags flags);
151
158 Header headerRead(FD_t fd, int magicp);
159
167 int headerWrite(FD_t fd, Header h, int magicp);
168
175 int headerIsEntry(Header h, rpmTagVal tag);
176
186 enum headerGetFlags_e {
187 HEADERGET_DEFAULT = 0, /* legacy headerGetEntry() behavior */
188 HEADERGET_MINMEM = (1 << 0), /* pointers can refer to header memory */
189 HEADERGET_EXT = (1 << 1), /* lookup extension types too */
190 HEADERGET_RAW = (1 << 2), /* return raw contents (no i18n lookups) */
191 HEADERGET_ALLOC = (1 << 3), /* always allocate memory for all data */
192 HEADERGET_ARGV = (1 << 4), /* return string arrays NULL-terminated */
193 };
194
195 typedef rpmFlags headerGetFlags;
196
205 int headerGet(Header h, rpmTagVal tag, rpmtd td, headerGetFlags flags);
206
207
208 enum headerPutFlags_e {
209 HEADERPUT_DEFAULT = 0,
210 HEADERPUT_APPEND = (1 << 0),
211 };
212
213 typedef rpmFlags headerPutFlags;
214
223 int headerPut(Header h, rpmtd td, headerPutFlags flags);
224
248 int headerPutString(Header h, rpmTagVal tag, const char *val);
249 int headerPutStringArray(Header h, rpmTagVal tag, const char **val, rpm_count_t size);
250 int headerPutBin(Header h, rpmTagVal tag, const uint8_t *val, rpm_count_t size);
251 int headerPutChar(Header h, rpmTagVal tag, const char *val, rpm_count_t size);
252 int headerPutUint8(Header h, rpmTagVal tag, const uint8_t *val, rpm_count_t size);
253 int headerPutUint16(Header h, rpmTagVal tag, const uint16_t *val, rpm_count_t size);
254 int headerPutUint32(Header h, rpmTagVal tag, const uint32_t *val, rpm_count_t size);
255 int headerPutUint64(Header h, rpmTagVal tag, const uint64_t *val, rpm_count_t size);
278 int headerAddI18NString(Header h, rpmTagVal tag, const char * string,
279 const char * lang);
280
288 int headerMod(Header h, rpmtd td);
289
299 int headerDel(Header h, rpmTagVal tag);
300
310 char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
311
318 void headerCopyTags(Header headerFrom, Header headerTo,
319 const rpmTagVal * tagstocopy);
320
326 HeaderIterator headerFreeIterator(HeaderIterator hi);
327
333 HeaderIterator headerInitIterator(Header h);
334
341 int headerNext(HeaderIterator hi, rpmtd td);
342
348 rpmTagVal headerNextTag(HeaderIterator hi);
349
358 RPM_GNUC_DEPRECATED
359 int headerNVR(Header h,
360 const char ** np,
361 const char ** vp,
362 const char ** rp);
363
374 RPM_GNUC_DEPRECATED
375 int headerNEVRA(Header h,
376 const char ** np,
377 uint32_t ** ep,
378 const char ** vp,
379 const char ** rp,
380 const char ** ap);
381
388 RPM_GNUC_DEPRECATED
389 char * headerGetNEVR(Header h, const char ** np );
390
397 RPM_GNUC_DEPRECATED
398 char * headerGetNEVRA(Header h, const char ** np );
399
400 /* \ingroup header
401 * Return (malloc'd) header (epoch:)version-release string.
402 * @param h header
403 * @retval np name tag value (or NULL)
404 * @return (epoch:)version-release string
405 */
406 RPM_GNUC_DEPRECATED
407 char * headerGetEVR(Header h, const char **np);
408
415 char * headerGetAsString(Header h, rpmTagVal tag);
416
423 const char * headerGetString(Header h, rpmTagVal tag);
424
425 /* \ingroup header
426 * Return a simple number tag (or extension) from header
427 * @param h header
428 * @param tag tag to retrieve
429 * @return numeric tag value or 0 on failure
430 */
431 uint64_t headerGetNumber(Header h, rpmTagVal tag);
432
438 RPM_GNUC_DEPRECATED
439 rpm_color_t headerGetColor(Header h);
440
446 int headerIsSource(Header h);
447
453 unsigned int headerGetInstance(Header h);
454
455 typedef enum headerConvOps_e {
456 HEADERCONV_EXPANDFILELIST = 0,
457 HEADERCONV_COMPRESSFILELIST = 1,
458 HEADERCONV_RETROFIT_V3 = 2,
459 } headerConvOps;
460
467 int headerConvert(Header h, int op);
468
469 #ifdef __cplusplus
470 }
471 #endif
472
473 #endif /* H_HEADER */
headerExport
void * headerExport(Header h, unsigned int *bsize)
Export header to on-disk representation.
headerGetNEVRA
RPM_GNUC_DEPRECATED char * headerGetNEVRA(Header h, const char **np)
Return (malloc'd) header name-version-release.arch string.
headerNew
Header headerNew(void)
Create new (empty) header instance.
headerPutBin
int headerPutBin(Header h, rpmTagVal tag, const uint8_t *val, rpm_count_t size)
headerInitIterator
HeaderIterator headerInitIterator(Header h)
Create header tag iterator.
headerNVR
RPM_GNUC_DEPRECATED int headerNVR(Header h, const char **np, const char **vp, const char **rp)
Return name, version, release strings from header.
headerGetEVR
RPM_GNUC_DEPRECATED char * headerGetEVR(Header h, const char **np)
headerSizeof
unsigned int headerSizeof(Header h, int magicp)
Return size of on-disk header representation in bytes.
headerImport
Header headerImport(void *blob, unsigned int bsize, headerImportFlags flags)
Import header to in-memory representation.
HEADERCONV_EXPANDFILELIST
Definition: header.h:456
HEADERCONV_RETROFIT_V3
Definition: header.h:458
headerImportFlags_e
headerImportFlags_e
Definition: header.h:136
headerPut
int headerPut(Header h, rpmtd td, headerPutFlags flags)
Add or append tag to header.
HEADER_MAGIC_YES
Definition: header.h:34
HEADERGET_MINMEM
Definition: header.h:188
HEADERIMPORT_FAST
Definition: header.h:138
headerCopyTags
void headerCopyTags(Header headerFrom, Header headerTo, const rpmTagVal *tagstocopy)
Duplicate tag values from one header into another.
headerFormat
char * headerFormat(Header h, const char *fmt, errmsg_t *errmsg)
Return formatted output string from header tags.
headerFree
Header headerFree(Header h)
Dereference a header instance.
headerFreeIterator
HeaderIterator headerFreeIterator(HeaderIterator hi)
Destroy header tag iterator.
headerCopyLoad
Header headerCopyLoad(const void *uh)
Make a copy and convert header to in-memory representation.
headerLink
Header headerLink(Header h)
Reference a header instance.
RPM_GNUC_DEPRECATED
#define RPM_GNUC_DEPRECATED
Definition: rpmutil.h:80
headerDel
int headerDel(Header h, rpmTagVal tag)
Delete tag in header.
headerGetFlags_e
headerGetFlags_e
Modifier flags for headerGet() operation.
Definition: header.h:186
headerGetNEVR
RPM_GNUC_DEPRECATED char * headerGetNEVR(Header h, const char **np)
Return (malloc'd) header name-version-release string.
rpmFlags
uint32_t rpmFlags
Definition: rpmtypes.h:42
HEADERGET_EXT
Definition: header.h:189
headerPutString
int headerPutString(Header h, rpmTagVal tag, const char *val)
Type-safe methods for inserting tag data to header.
HEADERGET_DEFAULT
Definition: header.h:187
headerGet
int headerGet(Header h, rpmTagVal tag, rpmtd td, headerGetFlags flags)
Retrieve tag value.
rpm_header_magic
const unsigned char rpm_header_magic[8]
Header magic value.
headerPutStringArray
int headerPutStringArray(Header h, rpmTagVal tag, const char **val, rpm_count_t size)
FD_t
struct _FD_s * FD_t
RPM IO file descriptor type.
Definition: rpmtypes.h:98
HEADERGET_RAW
Definition: header.h:190
headerGetNumber
uint64_t headerGetNumber(Header h, rpmTagVal tag)
rpm_color_t
uint32_t rpm_color_t
Definition: rpmtypes.h:38
headerImportFlags
rpmFlags headerImportFlags
Definition: header.h:141
headerConvert
int headerConvert(Header h, int op)
Convert header to/from (legacy) data presentation.
headerPutUint8
int headerPutUint8(Header h, rpmTagVal tag, const uint8_t *val, rpm_count_t size)
headerLoad
Header headerLoad(void *uh)
Convert header to in-memory representation.
Header
struct headerToken_s * Header
RPM header and data retrieval types.
Definition: rpmtypes.h:24
HeaderIterator
struct headerIterator_s * HeaderIterator
Definition: rpmtypes.h:25
headerVerifyInfo
int headerVerifyInfo(int il, int dl, const void *pev, void *iv, int negate)
Perform simple sanity and range checks on header tag(s).
headerNextTag
rpmTagVal headerNextTag(HeaderIterator hi)
Return next tag number from header.
rpm_count_t
uint32_t rpm_count_t
Definition: rpmtypes.h:29
headerCopy
Header headerCopy(Header h)
Duplicate a header.
headerPutUint64
int headerPutUint64(Header h, rpmTagVal tag, const uint64_t *val, rpm_count_t size)
headerReload
Header headerReload(Header h, rpmTagVal tag)
Convert header to on-disk representation, and then reload.
HEADERGET_ALLOC
Definition: header.h:191
rpmTagVal
rpm_tag_t rpmTagVal
Definition: rpmtypes.h:30
headerRead
Header headerRead(FD_t fd, int magicp)
Read (and load) header from file handle.
headerMod
int headerMod(Header h, rpmtd td)
Modify tag in header.
headerPutFlags
rpmFlags headerPutFlags
Definition: header.h:213
headerGetAsString
char * headerGetAsString(Header h, rpmTagVal tag)
Return any non-array tag from header, converted to string.
headerPutChar
int headerPutChar(Header h, rpmTagVal tag, const char *val, rpm_count_t size)
HEADERCONV_COMPRESSFILELIST
Definition: header.h:457
headerGetInstance
unsigned int headerGetInstance(Header h)
Return header instance, ie is the header from rpmdb.
headerNEVRA
RPM_GNUC_DEPRECATED int headerNEVRA(Header h, const char **np, uint32_t **ep, const char **vp, const char **rp, const char **ap)
Return name, epoch, version, release, arch strings from header.
headerPutFlags_e
headerPutFlags_e
Definition: header.h:208
headerNext
int headerNext(HeaderIterator hi, rpmtd td)
Return next tag contents from header.
headerGetFlags
rpmFlags headerGetFlags
Definition: header.h:195
rpmtd_s
Container for rpm tag data (from headers or extensions).
Definition: rpmtd.h:26
HEADER_MAGIC_NO
Definition: header.h:33
headerIsSource
int headerIsSource(Header h)
Check if header is a source or binary package header.
headerIsEntry
int headerIsEntry(Header h, rpmTagVal tag)
Check if tag is in header.
headerSort
void headerSort(Header h)
Sort tags in header.
headerGetColor
RPM_GNUC_DEPRECATED rpm_color_t headerGetColor(Header h)
Return header color.
HEADERGET_ARGV
Definition: header.h:192
headerAddI18NString
int headerAddI18NString(Header h, rpmTagVal tag, const char *string, const char *lang)
Add locale specific tag to header.
HEADERIMPORT_COPY
Definition: header.h:137
headerWrite
int headerWrite(FD_t fd, Header h, int magicp)
Write (with unload) header to file handle.
headerConvOps
enum headerConvOps_e headerConvOps
headerGetString
const char * headerGetString(Header h, rpmTagVal tag)
Return a simple string tag from header.
headerUnsort
void headerUnsort(Header h)
Restore tags in header to original ordering.
headerUnload
void * headerUnload(Header h)
Convert header to on-disk representation.
errmsg_t
const char * errmsg_t
Definition: rpmtypes.h:17
HEADERPUT_APPEND
Definition: header.h:210
headerPutUint16
int headerPutUint16(Header h, rpmTagVal tag, const uint16_t *val, rpm_count_t size)
hMagic
hMagic
Include calculation for 8 bytes of (magic, 0)?
Definition: header.h:32
HEADERPUT_DEFAULT
Definition: header.h:209
headerPutUint32
int headerPutUint32(Header h, rpmTagVal tag, const uint32_t *val, rpm_count_t size)
headerConvOps_e
headerConvOps_e
Definition: header.h:455