00001 #ifndef _RPMTD_H
00002 #define _RPMTD_H
00003
00004 #include <rpm/rpmtypes.h>
00005 #include <rpm/argv.h>
00006
00007 #ifdef __cplusplus
00008 extern "C" {
00009 #endif
00010
00011 enum rpmtdFlags_e {
00012 RPMTD_NONE = 0,
00013 RPMTD_ALLOCED = (1 << 0),
00014 RPMTD_PTR_ALLOCED = (1 << 1),
00015 RPMTD_IMMUTABLE = (1 << 2),
00016 RPMTD_ARGV = (1 << 3),
00017 };
00018
00019 typedef rpmFlags rpmtdFlags;
00020
00025 struct rpmtd_s {
00026 rpm_tag_t tag;
00027 rpm_tagtype_t type;
00028 rpm_count_t count;
00029 rpm_data_t data;
00030 rpmtdFlags flags;
00031 int ix;
00032 };
00033
00038 rpmtd rpmtdNew(void);
00039
00045 rpmtd rpmtdFree(rpmtd td);
00046
00052 void rpmtdReset(rpmtd td);
00053
00059 void rpmtdFreeData(rpmtd td);
00060
00066 rpm_count_t rpmtdCount(rpmtd td);
00067
00073 rpmTagVal rpmtdTag(rpmtd td);
00074
00080 rpmTagType rpmtdType(rpmtd td);
00081
00087 rpmTagClass rpmtdClass(rpmtd td);
00088
00094 int rpmtdGetIndex(rpmtd td);
00095
00104 int rpmtdSetIndex(rpmtd td, int index);
00105
00111 int rpmtdInit(rpmtd td);
00112
00118 int rpmtdNext(rpmtd td);
00119
00125 uint32_t *rpmtdNextUint32(rpmtd td);
00126
00132 uint64_t *rpmtdNextUint64(rpmtd td);
00133
00139 const char *rpmtdNextString(rpmtd td);
00140
00149 char *rpmtdGetChar(rpmtd td);
00150
00159 uint16_t * rpmtdGetUint16(rpmtd td);
00160
00169 uint32_t * rpmtdGetUint32(rpmtd td);
00170
00179 uint64_t * rpmtdGetUint64(rpmtd td);
00180
00189 const char * rpmtdGetString(rpmtd td);
00190
00200 uint64_t rpmtdGetNumber(rpmtd td);
00201
00202 typedef enum rpmtdFormats_e {
00203 RPMTD_FORMAT_STRING = 0,
00204 RPMTD_FORMAT_ARMOR = 1,
00205 RPMTD_FORMAT_BASE64 = 2,
00206 RPMTD_FORMAT_PGPSIG = 3,
00207 RPMTD_FORMAT_DEPFLAGS = 4,
00208 RPMTD_FORMAT_FFLAGS = 5,
00209 RPMTD_FORMAT_PERMS = 6,
00210 RPMTD_FORMAT_TRIGGERTYPE = 7,
00211 RPMTD_FORMAT_XML = 8,
00212 RPMTD_FORMAT_OCTAL = 9,
00213 RPMTD_FORMAT_HEX = 10,
00214 RPMTD_FORMAT_DATE = 11,
00215 RPMTD_FORMAT_DAY = 12,
00216 RPMTD_FORMAT_SHESCAPE = 13,
00217 RPMTD_FORMAT_ARRAYSIZE = 14,
00218 RPMTD_FORMAT_DEPTYPE = 15,
00219 RPMTD_FORMAT_FSTATE = 16,
00220 RPMTD_FORMAT_VFLAGS = 17,
00221 RPMTD_FORMAT_EXPAND = 18,
00222 RPMTD_FORMAT_FSTATUS = 19,
00223 } rpmtdFormats;
00224
00236 char *rpmtdFormat(rpmtd td, rpmtdFormats fmt, const char *errmsg);
00237
00246 int rpmtdSetTag(rpmtd td, rpmTagVal tag);
00247
00259 int rpmtdFromUint8(rpmtd td, rpmTagVal tag, uint8_t *data, rpm_count_t count);
00260
00271 int rpmtdFromUint16(rpmtd td, rpmTagVal tag, uint16_t *data, rpm_count_t count);
00272
00283 int rpmtdFromUint32(rpmtd td, rpmTagVal tag, uint32_t *data, rpm_count_t count);
00284
00295 int rpmtdFromUint64(rpmtd td, rpmTagVal tag, uint64_t *data, rpm_count_t count);
00296
00305 int rpmtdFromString(rpmtd td, rpmTagVal tag, const char *data);
00306
00317 int rpmtdFromStringArray(rpmtd td, rpmTagVal tag, const char **data, rpm_count_t count);
00318
00328 int rpmtdFromArgv(rpmtd td, rpmTagVal tag, ARGV_t argv);
00329
00339 int rpmtdFromArgi(rpmtd td, rpmTagVal tag, ARGI_t argi);
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349 rpmtd rpmtdDup(rpmtd td);
00350
00351 #ifdef __cplusplus
00352 }
00353 #endif
00354
00355 #endif