- 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
    00324 rpmTag headerNextTag(HeaderIterator hi);
    00325
    00334 RPM_GNUC_DEPRECATED
    00335 int headerNVR(Header h,
    00336                 const char ** np,
    00337                 const char ** vp,
    00338                 const char ** rp);
    00339
    00350 RPM_GNUC_DEPRECATED
    00351 int headerNEVRA(Header h,
    00352                 const char ** np,
    00353                 uint32_t ** ep,
    00354                 const char ** vp,
    00355                 const char ** rp,
    00356                 const char ** ap);
    00357
    00364 RPM_GNUC_DEPRECATED
    00365 char * headerGetNEVR(Header h, const char ** np );
    00366
    00373 RPM_GNUC_DEPRECATED
    00374 char * headerGetNEVRA(Header h, const char ** np );
    00375
    00376 /* \ingroup header
    00377  * Return (malloc'd) header (epoch:)version-release string.
    00378  * @param h             header
    00379  * @retval np           name tag value (or NULL)
    00380  * @return             (epoch:)version-release string
    00381  */
    00382 RPM_GNUC_DEPRECATED
    00383 char * headerGetEVR(Header h, const char **np);
    00384
    00391 char * headerGetAsString(Header h, rpmTag tag);
    00392
    00399 const char * headerGetString(Header h, rpmTag tag);
    00400
    00401 /* \ingroup header
    00402  * Return a simple number tag (or extension) from header
    00403  * @param h             header
    00404  * @param tag           tag to retrieve
    00405  * @return              numeric tag value or 0 on failure
    00406  */
    00407 uint64_t headerGetNumber(Header h, rpmTag tag);
    00408
    00414 RPM_GNUC_DEPRECATED
    00415 rpm_color_t headerGetColor(Header h);
    00416
    00422 int headerIsSource(Header h);
    00423
    00429 unsigned int headerGetInstance(Header h);
    00430
    00431 typedef enum headerConvOps_e {
    00432     HEADERCONV_EXPANDFILELIST   = 0,
    00433     HEADERCONV_COMPRESSFILELIST = 1,
    00434     HEADERCONV_RETROFIT_V3      = 2,
    00435 } headerConvOps;
    00436
    00443 int headerConvert(Header h, headerConvOps op);
    00444
    00445 #ifdef __cplusplus
    00446 }
    00447 #endif
    00448
    00449 #endif  /* H_HEADER */