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 typedef enum rpmtdFlags_e {
00012 RPMTD_NONE = 0,
00013 RPMTD_ALLOCED = (1 << 0),
00014 RPMTD_PTR_ALLOCED = (1 << 1),
00015 RPMTD_IMMUTABLE = (1 << 2),
00016 } rpmtdFlags;
00017
00022 struct rpmtd_s {
00023 rpmTag tag;
00024 rpmTagType type;
00025 rpm_count_t count;
00026 rpm_data_t data;
00027 rpmtdFlags flags;
00028 int ix;
00029 };
00030
00035 rpmtd rpmtdNew(void);
00036
00042 rpmtd rpmtdFree(rpmtd td);
00043
00049 void rpmtdReset(rpmtd td);
00050
00056 void rpmtdFreeData(rpmtd td);
00057
00063 rpm_count_t rpmtdCount(rpmtd td);
00064
00070 rpmTag rpmtdTag(rpmtd td);
00071
00077 rpmTagType rpmtdType(rpmtd td);
00078
00084 int rpmtdGetIndex(rpmtd td);
00085
00094 int rpmtdSetIndex(rpmtd td, int index);
00095
00101 int rpmtdInit(rpmtd td);
00102
00108 int rpmtdNext(rpmtd td);
00109
00115 uint32_t *rpmtdNextUint32(rpmtd td);
00116
00122 uint64_t *rpmtdNextUint64(rpmtd td);
00123
00129 const char *rpmtdNextString(rpmtd td);
00130
00139 char *rpmtdGetChar(rpmtd td);
00140
00149 uint16_t * rpmtdGetUint16(rpmtd td);
00150
00159 uint32_t * rpmtdGetUint32(rpmtd td);
00160
00169 uint64_t * rpmtdGetUint64(rpmtd td);
00170
00179 const char * rpmtdGetString(rpmtd td);
00180
00181 typedef enum rpmtdFormats_e {
00182 RPMTD_FORMAT_STRING = 0,
00183 RPMTD_FORMAT_ARMOR = 1,
00184 RPMTD_FORMAT_BASE64 = 2,
00185 RPMTD_FORMAT_PGPSIG = 3,
00186 RPMTD_FORMAT_DEPFLAGS = 4,
00187 RPMTD_FORMAT_FFLAGS = 5,
00188 RPMTD_FORMAT_PERMS = 6,
00189 RPMTD_FORMAT_TRIGGERTYPE = 7,
00190 RPMTD_FORMAT_XML = 8,
00191 RPMTD_FORMAT_OCTAL = 9,
00192 RPMTD_FORMAT_HEX = 10,
00193 RPMTD_FORMAT_DATE = 11,
00194 RPMTD_FORMAT_DAY = 12,
00195 RPMTD_FORMAT_SHESCAPE = 13,
00196 RPMTD_FORMAT_ARRAYSIZE = 14,
00197 } rpmtdFormats;
00198
00210 char *rpmtdFormat(rpmtd td, rpmtdFormats fmt, const char *errmsg);
00211
00220 int rpmtdSetTag(rpmtd td, rpmTag tag);
00221
00233 int rpmtdFromUint8(rpmtd td, rpmTag tag, uint8_t *data, rpm_count_t count);
00234
00245 int rpmtdFromUint16(rpmtd td, rpmTag tag, uint16_t *data, rpm_count_t count);
00246
00257 int rpmtdFromUint32(rpmtd td, rpmTag tag, uint32_t *data, rpm_count_t count);
00258
00269 int rpmtdFromUint64(rpmtd td, rpmTag tag, uint64_t *data, rpm_count_t count);
00270
00279 int rpmtdFromString(rpmtd td, rpmTag tag, const char *data);
00280
00291 int rpmtdFromStringArray(rpmtd td, rpmTag tag, const char **data, rpm_count_t count);
00292
00302 int rpmtdFromArgv(rpmtd td, rpmTag tag, ARGV_t argv);
00303
00313 int rpmtdFromArgi(rpmtd td, rpmTag tag, ARGI_t argi);
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323 rpmtd rpmtdDup(rpmtd td);
00324
00325 #ifdef __cplusplus
00326 }
00327 #endif
00328
00329 #endif