rpm: header.h Source File

rpm 4.10.0

- 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
    00061 void headerSort(Header h);
    00062
    00067 void headerUnsort(Header h);
    00068
    00075 unsigned int headerSizeof(Header h, int magicp);
    00076
    00086 int headerVerifyInfo(int il, int dl, const void * pev, void * iv, int negate);
    00087
    00094 void * headerUnload(Header h);
    00095
    00102 void * headerExport(Header h, unsigned int * bsize);
    00103
    00111 Header headerReload(Header h, rpmTagVal tag);
    00112
    00118 Header headerCopy(Header h);
    00119
    00126 Header headerLoad(void * uh);
    00127
    00134 Header headerCopyLoad(const void * uh);
    00135
    00136 enum headerImportFlags_e {
    00137     HEADERIMPORT_COPY           = (1 << 0), /* Make copy of blob on import? */
    00138     HEADERIMPORT_FAST           = (1 << 1), /* Faster but less safe? */
    00139 };
    00140
    00141 typedef rpmFlags headerImportFlags;
    00142
    00150 Header headerImport(void *blob, unsigned int bsize, headerImportFlags flags);
    00151
    00158 Header headerRead(FD_t fd, int magicp);
    00159
    00167 int headerWrite(FD_t fd, Header h, int magicp);
    00168
    00175 int headerIsEntry(Header h, rpmTagVal tag);
    00176
    00186 enum headerGetFlags_e {
    00187     HEADERGET_DEFAULT   = 0,        /* legacy headerGetEntry() behavior */
    00188     HEADERGET_MINMEM    = (1 << 0), /* pointers can refer to header memory */
    00189     HEADERGET_EXT       = (1 << 1), /* lookup extension types too */
    00190     HEADERGET_RAW       = (1 << 2), /* return raw contents (no i18n lookups) */
    00191     HEADERGET_ALLOC     = (1 << 3), /* always allocate memory for all data */
    00192     HEADERGET_ARGV      = (1 << 4), /* return string arrays NULL-terminated */
    00193 };
    00194
    00195 typedef rpmFlags headerGetFlags;
    00196
    00205 int headerGet(Header h, rpmTagVal tag, rpmtd td, headerGetFlags flags);
    00206
    00207
    00208 enum headerPutFlags_e {
    00209     HEADERPUT_DEFAULT   = 0,
    00210     HEADERPUT_APPEND    = (1 << 0),
    00211 };
    00212
    00213 typedef rpmFlags headerPutFlags;
    00214
    00223 int headerPut(Header h, rpmtd td, headerPutFlags flags);
    00224
    00248 int headerPutString(Header h, rpmTagVal tag, const char *val);
    00249 int headerPutStringArray(Header h, rpmTagVal tag, const char **val, rpm_count_t size);
    00250 int headerPutBin(Header h, rpmTagVal tag, const uint8_t *val, rpm_count_t size);
    00251 int headerPutChar(Header h, rpmTagVal tag, const char *val, rpm_count_t size);
    00252 int headerPutUint8(Header h, rpmTagVal tag, const uint8_t *val, rpm_count_t size);
    00253 int headerPutUint16(Header h, rpmTagVal tag, const uint16_t *val, rpm_count_t size);
    00254 int headerPutUint32(Header h, rpmTagVal tag, const uint32_t *val, rpm_count_t size);
    00255 int headerPutUint64(Header h, rpmTagVal tag, const uint64_t *val, rpm_count_t size);
    00278 int headerAddI18NString(Header h, rpmTagVal tag, const char * string,
    00279                 const char * lang);
    00280
    00288 int headerMod(Header h, rpmtd td);
    00289
    00299 int headerDel(Header h, rpmTagVal tag);
    00300
    00310 char * headerFormat(Header h, const char * fmt, errmsg_t * errmsg);
    00311
    00318 void headerCopyTags(Header headerFrom, Header headerTo,
    00319                     const rpmTagVal * tagstocopy);
    00320
    00326 HeaderIterator headerFreeIterator(HeaderIterator hi);
    00327
    00333 HeaderIterator headerInitIterator(Header h);
    00334
    00341 int headerNext(HeaderIterator hi, rpmtd td);
    00342
    00348 rpmTagVal headerNextTag(HeaderIterator hi);
    00349
    00358 RPM_GNUC_DEPRECATED
    00359 int headerNVR(Header h,
    00360                 const char ** np,
    00361                 const char ** vp,
    00362                 const char ** rp);
    00363
    00374 RPM_GNUC_DEPRECATED
    00375 int headerNEVRA(Header h,
    00376                 const char ** np,
    00377                 uint32_t ** ep,
    00378                 const char ** vp,
    00379                 const char ** rp,
    00380                 const char ** ap);
    00381
    00388 RPM_GNUC_DEPRECATED
    00389 char * headerGetNEVR(Header h, const char ** np );
    00390
    00397 RPM_GNUC_DEPRECATED
    00398 char * headerGetNEVRA(Header h, const char ** np );
    00399
    00400 /* \ingroup header
    00401  * Return (malloc'd) header (epoch:)version-release string.
    00402  * @param h             header
    00403  * @retval np           name tag value (or NULL)
    00404  * @return             (epoch:)version-release string
    00405  */
    00406 RPM_GNUC_DEPRECATED
    00407 char * headerGetEVR(Header h, const char **np);
    00408
    00415 char * headerGetAsString(Header h, rpmTagVal tag);
    00416
    00423 const char * headerGetString(Header h, rpmTagVal tag);
    00424
    00425 /* \ingroup header
    00426  * Return a simple number tag (or extension) from header
    00427  * @param h             header
    00428  * @param tag           tag to retrieve
    00429  * @return              numeric tag value or 0 on failure
    00430  */
    00431 uint64_t headerGetNumber(Header h, rpmTagVal tag);
    00432
    00438 RPM_GNUC_DEPRECATED
    00439 rpm_color_t headerGetColor(Header h);
    00440
    00446 int headerIsSource(Header h);
    00447
    00453 unsigned int headerGetInstance(Header h);
    00454
    00455 typedef enum headerConvOps_e {
    00456     HEADERCONV_EXPANDFILELIST   = 0,
    00457     HEADERCONV_COMPRESSFILELIST = 1,
    00458     HEADERCONV_RETROFIT_V3      = 2,
    00459 } headerConvOps;
    00460
    00467 int headerConvert(Header h, int op);
    00468
    00469 #ifdef __cplusplus
    00470 }
    00471 #endif
    00472
    00473 #endif  /* H_HEADER */