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 rpmTagClass rpmtdClass(rpmtd td);
00085
00091 int rpmtdGetIndex(rpmtd td);
00092
00101 int rpmtdSetIndex(rpmtd td, int index);
00102
00108 int rpmtdInit(rpmtd td);
00109
00115 int rpmtdNext(rpmtd td);
00116
00122 uint32_t *rpmtdNextUint32(rpmtd td);
00123
00129 uint64_t *rpmtdNextUint64(rpmtd td);
00130
00136 const char *rpmtdNextString(rpmtd td);
00137
00146 char *rpmtdGetChar(rpmtd td);
00147
00156 uint16_t * rpmtdGetUint16(rpmtd td);
00157
00166 uint32_t * rpmtdGetUint32(rpmtd td);
00167
00176 uint64_t * rpmtdGetUint64(rpmtd td);
00177
00186 const char * rpmtdGetString(rpmtd td);
00187
00197 uint64_t rpmtdGetNumber(rpmtd td);
00198
00199 typedef enum rpmtdFormats_e {
00200 RPMTD_FORMAT_STRING = 0,
00201 RPMTD_FORMAT_ARMOR = 1,
00202 RPMTD_FORMAT_BASE64 = 2,
00203 RPMTD_FORMAT_PGPSIG = 3,
00204 RPMTD_FORMAT_DEPFLAGS = 4,
00205 RPMTD_FORMAT_FFLAGS = 5,
00206 RPMTD_FORMAT_PERMS = 6,
00207 RPMTD_FORMAT_TRIGGERTYPE = 7,
00208 RPMTD_FORMAT_XML = 8,
00209 RPMTD_FORMAT_OCTAL = 9,
00210 RPMTD_FORMAT_HEX = 10,
00211 RPMTD_FORMAT_DATE = 11,
00212 RPMTD_FORMAT_DAY = 12,
00213 RPMTD_FORMAT_SHESCAPE = 13,
00214 RPMTD_FORMAT_ARRAYSIZE = 14,
00215 } rpmtdFormats;
00216
00228 char *rpmtdFormat(rpmtd td, rpmtdFormats fmt, const char *errmsg);
00229
00238 int rpmtdSetTag(rpmtd td, rpmTag tag);
00239
00251 int rpmtdFromUint8(rpmtd td, rpmTag tag, uint8_t *data, rpm_count_t count);
00252
00263 int rpmtdFromUint16(rpmtd td, rpmTag tag, uint16_t *data, rpm_count_t count);
00264
00275 int rpmtdFromUint32(rpmtd td, rpmTag tag, uint32_t *data, rpm_count_t count);
00276
00287 int rpmtdFromUint64(rpmtd td, rpmTag tag, uint64_t *data, rpm_count_t count);
00288
00297 int rpmtdFromString(rpmtd td, rpmTag tag, const char *data);
00298
00309 int rpmtdFromStringArray(rpmtd td, rpmTag tag, const char **data, rpm_count_t count);
00310
00320 int rpmtdFromArgv(rpmtd td, rpmTag tag, ARGV_t argv);
00321
00331 int rpmtdFromArgi(rpmtd td, rpmTag tag, ARGI_t argi);
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341 rpmtd rpmtdDup(rpmtd td);
00342
00343 #ifdef __cplusplus
00344 }
00345 #endif
00346
00347 #endif