rpm 4.8.1
|
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), /* was memory allocated? */ 00014 RPMTD_PTR_ALLOCED = (1 << 1), /* were array pointers allocated? */ 00015 RPMTD_IMMUTABLE = (1 << 2), /* header data or modifiable? */ 00016 RPMTD_ARGV = (1 << 3), /* string array is NULL-terminated? */ 00017 } rpmtdFlags; 00018 00023 struct rpmtd_s { 00024 rpmTag tag; /* rpm tag of this data entry*/ 00025 rpmTagType type; /* data type */ 00026 rpm_count_t count; /* number of entries */ 00027 rpm_data_t data; /* pointer to actual data */ 00028 rpmtdFlags flags; /* flags on memory allocation etc */ 00029 int ix; /* iteration index */ 00030 }; 00031 00036 rpmtd rpmtdNew(void); 00037 00043 rpmtd rpmtdFree(rpmtd td); 00044 00050 void rpmtdReset(rpmtd td); 00051 00057 void rpmtdFreeData(rpmtd td); 00058 00064 rpm_count_t rpmtdCount(rpmtd td); 00065 00071 rpmTag rpmtdTag(rpmtd td); 00072 00078 rpmTagType rpmtdType(rpmtd td); 00079 00085 rpmTagClass rpmtdClass(rpmtd td); 00086 00092 int rpmtdGetIndex(rpmtd td); 00093 00102 int rpmtdSetIndex(rpmtd td, int index); 00103 00109 int rpmtdInit(rpmtd td); 00110 00116 int rpmtdNext(rpmtd td); 00117 00123 uint32_t *rpmtdNextUint32(rpmtd td); 00124 00130 uint64_t *rpmtdNextUint64(rpmtd td); 00131 00137 const char *rpmtdNextString(rpmtd td); 00138 00147 char *rpmtdGetChar(rpmtd td); 00148 00157 uint16_t * rpmtdGetUint16(rpmtd td); 00158 00167 uint32_t * rpmtdGetUint32(rpmtd td); 00168 00177 uint64_t * rpmtdGetUint64(rpmtd td); 00178 00187 const char * rpmtdGetString(rpmtd td); 00188 00198 uint64_t rpmtdGetNumber(rpmtd td); 00199 00200 typedef enum rpmtdFormats_e { 00201 RPMTD_FORMAT_STRING = 0, /* plain string (any type) */ 00202 RPMTD_FORMAT_ARMOR = 1, /* ascii armor format (bin types) */ 00203 RPMTD_FORMAT_BASE64 = 2, /* base64 encoding (bin types) */ 00204 RPMTD_FORMAT_PGPSIG = 3, /* pgp/gpg signature (bin types) */ 00205 RPMTD_FORMAT_DEPFLAGS = 4, /* dependency flags (int types) */ 00206 RPMTD_FORMAT_FFLAGS = 5, /* file flags (int types) */ 00207 RPMTD_FORMAT_PERMS = 6, /* permission string (int types) */ 00208 RPMTD_FORMAT_TRIGGERTYPE = 7, /* trigger types (int types) */ 00209 RPMTD_FORMAT_XML = 8, /* xml format (any type) */ 00210 RPMTD_FORMAT_OCTAL = 9, /* octal format (int types) */ 00211 RPMTD_FORMAT_HEX = 10, /* hex format (int types) */ 00212 RPMTD_FORMAT_DATE = 11, /* date format (int types) */ 00213 RPMTD_FORMAT_DAY = 12, /* day format (int types) */ 00214 RPMTD_FORMAT_SHESCAPE = 13, /* shell escaped (any type) */ 00215 RPMTD_FORMAT_ARRAYSIZE = 14, /* size of contained array (any type) */ 00216 RPMTD_FORMAT_DEPTYPE = 15, /* dependency types (int types) */ 00217 RPMTD_FORMAT_FSTATE = 16, /* file states (int types) */ 00218 RPMTD_FORMAT_VFLAGS = 17, /* file verify flags (int types) */ 00219 } rpmtdFormats; 00220 00232 char *rpmtdFormat(rpmtd td, rpmtdFormats fmt, const char *errmsg); 00233 00242 int rpmtdSetTag(rpmtd td, rpmTag tag); 00243 00255 int rpmtdFromUint8(rpmtd td, rpmTag tag, uint8_t *data, rpm_count_t count); 00256 00267 int rpmtdFromUint16(rpmtd td, rpmTag tag, uint16_t *data, rpm_count_t count); 00268 00279 int rpmtdFromUint32(rpmtd td, rpmTag tag, uint32_t *data, rpm_count_t count); 00280 00291 int rpmtdFromUint64(rpmtd td, rpmTag tag, uint64_t *data, rpm_count_t count); 00292 00301 int rpmtdFromString(rpmtd td, rpmTag tag, const char *data); 00302 00313 int rpmtdFromStringArray(rpmtd td, rpmTag tag, const char **data, rpm_count_t count); 00314 00324 int rpmtdFromArgv(rpmtd td, rpmTag tag, ARGV_t argv); 00325 00335 int rpmtdFromArgi(rpmtd td, rpmTag tag, ARGI_t argi); 00336 00337 /* \ingroup rpmtd 00338 * Perform deep copy of container. 00339 * Create a modifiable copy of tag data container (on string arrays each 00340 * string is separately allocated) 00341 * @todo Only string arrays types are supported currently 00342 * @param td Container to copy 00343 * @return New container or NULL on error 00344 */ 00345 rpmtd rpmtdDup(rpmtd td); 00346 00347 #ifdef __cplusplus 00348 } 00349 #endif 00350 00351 #endif /* _RPMTD_H */