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

# 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 enum hMagic {
    00028     HEADER_MAGIC_NO             = 0,
    00029     HEADER_MAGIC_YES            = 1
    00030 };
    00031
    00036 Header headerNew(void);
    00037
    00043 Header headerFree( Header h);
    00044
    00050 Header headerLink(Header h);
    00051
    00057 Header headerUnlink(Header h);
    00058
    00063 void headerSort(Header h);
    00064
    00069 void headerUnsort(Header h);
    00070
    00077 unsigned int headerSizeof(Header h, enum hMagic magicp);
    00078
    00088 int headerVerifyInfo(int il, int dl, const void * pev, void * iv, int negate);
    00089
    00095 void * headerUnload(Header h);
    00096
    00104 Header headerReload(Header h, rpmTag tag);
    00105
    00111 Header headerCopy(Header h);
    00112
    00118 Header headerLoad(void * uh);
    00119
    00125 Header headerCopyLoad(const void * uh);
    00126
    00133 Header headerRead(FD_t fd, enum hMagic magicp);
    00134
    00142 int headerWrite(FD_t fd, Header h, enum hMagic magicp);
    00143
    00150 int headerIsEntry(Header h, rpmTag tag);
    00151
    00152 typedef enum headerGetFlags_e {
    00153     HEADERGET_DEFAULT   = 0,
    00154     HEADERGET_MINMEM    = (1 << 0), /* string pointers refer to header memory */
    00155     HEADERGET_EXT       = (1 << 1), /* lookup extension types too */
    00156     HEADERGET_RAW       = (1 << 2), /* return raw contents (no i18n lookups) */
    00157     HEADERGET_ALLOC     = (1 << 3), /* always allocate memory for all data */
    00158 } headerGetFlags;
    00159
    00168 int headerGet(Header h, rpmTag tag, rpmtd td, headerGetFlags flags);
    00169
    00170
    00171 typedef enum headerPutFlags_e {
    00172     HEADERPUT_DEFAULT   = 0,
    00173     HEADERPUT_APPEND    = (1 << 0),
    00174 } headerPutFlags;
    00175
    00184 int headerPut(Header h, rpmtd td, headerPutFlags flags);
    00185
    00209 int headerPutString(Header h, rpmTag tag, const char *val);
    00210 int headerPutStringArray(Header h, rpmTag tag, const char **val, rpm_count_t size);
    00211 int headerPutBin(Header h, rpmTag tag, uint8_t *val, rpm_count_t size);
    00212 int headerPutChar(Header h, rpmTag tag, char *val, rpm_count_t size);
    00213 int headerPutUint8(Header h, rpmTag tag, uint8_t *val, rpm_count_t size);
    00214 int headerPutUint16(Header h, rpmTag tag, uint16_t *val, rpm_count_t size);
    00215 int headerPutUint32(Header h, rpmTag tag, uint32_t *val, rpm_count_t size);
    00216 int headerPutUint64(Header h, rpmTag tag, uint64_t *val, rpm_count_t size);
    00239 int headerAddI18NString(Header h, rpmTag tag, const char * string,
    00240                 const char * lang);
    00241
    00249 int headerMod(Header h, rpmtd td);
    00250
    00260 int headerDel(Header h, rpmTag tag);
    00261
    00271 char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
    00272
    00279 void headerCopyTags(Header headerFrom, Header headerTo,
    00280                     const rpmTag * tagstocopy);
    00281
    00287 HeaderIterator headerFreeIterator(HeaderIterator hi);
    00288
    00294 HeaderIterator headerInitIterator(Header h);
    00295
    00302 int headerNext(HeaderIterator hi, rpmtd td);
    00303
    00312 int headerNVR(Header h,
    00313                 const char ** np,
    00314                 const char ** vp,
    00315                 const char ** rp);
    00316
    00327 int headerNEVRA(Header h,
    00328                 const char ** np,
    00329                 uint32_t ** ep,
    00330                 const char ** vp,
    00331                 const char ** rp,
    00332                 const char ** ap);
    00333
    00340 char * headerGetNEVR(Header h, const char ** np );
    00341
    00348 char * headerGetNEVRA(Header h, const char ** np );
    00349
    00350 /* \ingroup header
    00351  * Return (malloc'd) header (epoch:)version-release string.
    00352  * @param h             header
    00353  * @retval np           name tag value (or NULL)
    00354  * @return             (epoch:)version-release string
    00355  */
    00356 char * headerGetEVR(Header h, const char **np);
    00357
    00363 rpm_color_t headerGetColor(Header h);
    00364
    00370 int headerIsSource(Header h);
    00371
    00372
    00373 #ifdef __cplusplus
    00374 }
    00375 #endif
    00376
    00377 #endif  /* H_HEADER */