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     RPMTD_ARGV          = (1 << 3),     
00017 } rpmtdFlags;
00018 
00023 struct rpmtd_s {
00024     rpmTag tag;         
00025     rpmTagType type;    
00026     rpm_count_t count;  
00027     rpm_data_t data;    
00028     rpmtdFlags flags;   
00029     int ix;             
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,    
00202     RPMTD_FORMAT_ARMOR          = 1,    
00203     RPMTD_FORMAT_BASE64         = 2,    
00204     RPMTD_FORMAT_PGPSIG         = 3,    
00205     RPMTD_FORMAT_DEPFLAGS       = 4,    
00206     RPMTD_FORMAT_FFLAGS         = 5,    
00207     RPMTD_FORMAT_PERMS          = 6,    
00208     RPMTD_FORMAT_TRIGGERTYPE    = 7,    
00209     RPMTD_FORMAT_XML            = 8,    
00210     RPMTD_FORMAT_OCTAL          = 9,    
00211     RPMTD_FORMAT_HEX            = 10,   
00212     RPMTD_FORMAT_DATE           = 11,   
00213     RPMTD_FORMAT_DAY            = 12,   
00214     RPMTD_FORMAT_SHESCAPE       = 13,   
00215     RPMTD_FORMAT_ARRAYSIZE      = 14,   
00216     RPMTD_FORMAT_DEPTYPE        = 15,   
00217 } rpmtdFormats;
00218 
00230 char *rpmtdFormat(rpmtd td, rpmtdFormats fmt, const char *errmsg);
00231 
00240 int rpmtdSetTag(rpmtd td, rpmTag tag);
00241 
00253 int rpmtdFromUint8(rpmtd td, rpmTag tag, uint8_t *data, rpm_count_t count);
00254 
00265 int rpmtdFromUint16(rpmtd td, rpmTag tag, uint16_t *data, rpm_count_t count);
00266 
00277 int rpmtdFromUint32(rpmtd td, rpmTag tag, uint32_t *data, rpm_count_t count);
00278 
00289 int rpmtdFromUint64(rpmtd td, rpmTag tag, uint64_t *data, rpm_count_t count);
00290 
00299 int rpmtdFromString(rpmtd td, rpmTag tag, const char *data);
00300 
00311 int rpmtdFromStringArray(rpmtd td, rpmTag tag, const char **data, rpm_count_t count);
00312 
00322 int rpmtdFromArgv(rpmtd td, rpmTag tag, ARGV_t argv);
00323 
00333 int rpmtdFromArgi(rpmtd td, rpmTag tag, ARGI_t argi);
00334 
00335 
00336 
00337 
00338 
00339 
00340 
00341 
00342 
00343 rpmtd rpmtdDup(rpmtd td);
00344 
00345 #ifdef __cplusplus
00346 }
00347 #endif
00348 
00349 #endif