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

- File List
- Globals

# header.h

Go to the documentation of this file.

    00001 #ifndef H_HEADER
    00002 #define H_HEADER
    00003
    00013 /* RPM - Copyright (C) 1995-2001 Red Hat Software */
    00014
    00015 #include <rpm/rpmio.h>
    00016 #include <rpm/rpmtypes.h>
    00017 #include <rpm/rpmtd.h>
    00018 #include <rpm/rpmutil.h>
    00019
    00020 #ifdef __cplusplus
    00021 extern "C" {
    00022 #endif
    00023
    00027 extern const unsigned char rpm_header_magic[8];
    00028
    00032 enum hMagic {
    00033     HEADER_MAGIC_NO             = 0,
    00034     HEADER_MAGIC_YES            = 1
    00035 };
    00036
    00041 Header headerNew(void);
    00042
    00048 Header headerFree( Header h);
    00049
    00055 Header headerLink(Header h);
    00056
    00062 Header headerUnlink(Header h);
    00063
    00068 void headerSort(Header h);
    00069
    00074 void headerUnsort(Header h);
    00075
    00082 unsigned int headerSizeof(Header h, enum hMagic magicp);
    00083
    00093 int headerVerifyInfo(int il, int dl, const void * pev, void * iv, int negate);
    00094
    00100 void * headerUnload(Header h);
    00101
    00109 Header headerReload(Header h, rpmTag tag);
    00110
    00116 Header headerCopy(Header h);
    00117
    00123 Header headerLoad(void * uh);
    00124
    00130 Header headerCopyLoad(const void * uh);
    00131
    00138 Header headerRead(FD_t fd, enum hMagic magicp);
    00139
    00147 int headerWrite(FD_t fd, Header h, enum hMagic magicp);
    00148
    00155 int headerIsEntry(Header h, rpmTag tag);
    00156
    00166 typedef enum headerGetFlags_e {
    00167     HEADERGET_DEFAULT   = 0,        /* legacy headerGetEntry() behavior */
    00168     HEADERGET_MINMEM    = (1 << 0), /* pointers can refer to header memory */
    00169     HEADERGET_EXT       = (1 << 1), /* lookup extension types too */
    00170     HEADERGET_RAW       = (1 << 2), /* return raw contents (no i18n lookups) */
    00171     HEADERGET_ALLOC     = (1 << 3), /* always allocate memory for all data */
    00172     HEADERGET_ARGV      = (1 << 4), /* return string arrays NULL-terminated */
    00173 } headerGetFlags;
    00174
    00183 int headerGet(Header h, rpmTag tag, rpmtd td, headerGetFlags flags);
    00184
    00185
    00186 typedef enum headerPutFlags_e {
    00187     HEADERPUT_DEFAULT   = 0,
    00188     HEADERPUT_APPEND    = (1 << 0),
    00189 } headerPutFlags;
    00190
    00199 int headerPut(Header h, rpmtd td, headerPutFlags flags);
    00200
    00224 int headerPutString(Header h, rpmTag tag, const char *val);
    00225 int headerPutStringArray(Header h, rpmTag tag, const char **val, rpm_count_t size);
    00226 int headerPutBin(Header h, rpmTag tag, uint8_t *val, rpm_count_t size);
    00227 int headerPutChar(Header h, rpmTag tag, char *val, rpm_count_t size);
    00228 int headerPutUint8(Header h, rpmTag tag, uint8_t *val, rpm_count_t size);
    00229 int headerPutUint16(Header h, rpmTag tag, uint16_t *val, rpm_count_t size);
    00230 int headerPutUint32(Header h, rpmTag tag, uint32_t *val, rpm_count_t size);
    00231 int headerPutUint64(Header h, rpmTag tag, uint64_t *val, rpm_count_t size);
    00254 int headerAddI18NString(Header h, rpmTag tag, const char * string,
    00255                 const char * lang);
    00256
    00264 int headerMod(Header h, rpmtd td);
    00265
    00275 int headerDel(Header h, rpmTag tag);
    00276
    00286 char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
    00287
    00294 void headerCopyTags(Header headerFrom, Header headerTo,
    00295                     const rpmTag * tagstocopy);
    00296
    00302 HeaderIterator headerFreeIterator(HeaderIterator hi);
    00303
    00309 HeaderIterator headerInitIterator(Header h);
    00310
    00317 int headerNext(HeaderIterator hi, rpmtd td);
    00318
    00327 int headerNVR(Header h,
    00328                 const char ** np,
    00329                 const char ** vp,
    00330                 const char ** rp);
    00331
    00342 int headerNEVRA(Header h,
    00343                 const char ** np,
    00344                 uint32_t ** ep,
    00345                 const char ** vp,
    00346                 const char ** rp,
    00347                 const char ** ap);
    00348
    00355 char * headerGetNEVR(Header h, const char ** np );
    00356
    00363 char * headerGetNEVRA(Header h, const char ** np );
    00364
    00365 /* \ingroup header
    00366  * Return (malloc'd) header (epoch:)version-release string.
    00367  * @param h             header
    00368  * @retval np           name tag value (or NULL)
    00369  * @return             (epoch:)version-release string
    00370  */
    00371 char * headerGetEVR(Header h, const char **np);
    00372
    00378 rpm_color_t headerGetColor(Header h);
    00379
    00385 int headerIsSource(Header h);
    00386
    00392 unsigned int headerGetInstance(Header h);
    00393
    00394 typedef enum headerConvOps_e {
    00395     HEADERCONV_EXPANDFILELIST   = 0,
    00396     HEADERCONV_COMPRESSFILELIST = 1,
    00397     HEADERCONV_RETROFIT_V3      = 2,
    00398 } headerConvOps;
    00399
    00406 int headerConvert(Header h, headerConvOps op);
    00407
    00408 #ifdef __cplusplus
    00409 }
    00410 #endif
    00411
    00412 #endif  /* H_HEADER */