rpm  6.0.91
The RPM Package Manager
rpmtd.h
Go to the documentation of this file.
1 #ifndef _RPMTD_H
2 #define _RPMTD_H
3 
10 #include <rpm/rpmtag.h>
11 #include <rpm/argv.h>
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
21  RPMTD_NONE = 0,
22  RPMTD_ALLOCED = (1 << 0), /* was memory allocated? */
23  RPMTD_PTR_ALLOCED = (1 << 1), /* were array pointers allocated? */
24  RPMTD_IMMUTABLE = (1 << 2), /* header data or modifiable? */
25  RPMTD_ARGV = (1 << 3), /* string array is NULL-terminated? */
26  RPMTD_INVALID = (1 << 4), /* invalid data (in header) */
27 };
28 
29 typedef rpmFlags rpmtdFlags;
30 
35 struct rpmtd_s {
36  rpm_tag_t tag;
37  rpm_tagtype_t type;
38  rpm_count_t count;
39  rpm_data_t data;
40  rpmtdFlags flags;
41  int ix;
42  rpm_count_t size;
43 };
44 
49 rpmtd rpmtdNew(void);
50 
57 
63 void rpmtdReset(rpmtd td);
64 
70 void rpmtdFreeData(rpmtd td);
71 
77 rpm_count_t rpmtdCount(rpmtd td);
78 
85 rpm_count_t rpmtdSize(rpmtd td);
86 
92 rpmTagVal rpmtdTag(rpmtd td);
93 
99 rpmTagType rpmtdType(rpmtd td);
100 
107 
113 rpmtdFlags rpmtdGetFlags(rpmtd td);
114 
120 int rpmtdGetIndex(rpmtd td);
121 
130 int rpmtdSetIndex(rpmtd td, int index);
131 
137 int rpmtdInit(rpmtd td);
138 
144 int rpmtdNext(rpmtd td);
145 
151 uint32_t *rpmtdNextUint32(rpmtd td);
152 
158 uint64_t *rpmtdNextUint64(rpmtd td);
159 
165 const char *rpmtdNextString(rpmtd td);
166 
175 char *rpmtdGetChar(rpmtd td);
176 
185 uint16_t * rpmtdGetUint16(rpmtd td);
186 
195 uint32_t * rpmtdGetUint32(rpmtd td);
196 
205 uint64_t * rpmtdGetUint64(rpmtd td);
206 
215 const char * rpmtdGetString(rpmtd td);
216 
226 uint64_t rpmtdGetNumber(rpmtd td);
227 
231 typedef enum rpmtdFormats_e {
232  RPMTD_FORMAT_STRING = 0, /* plain string (any type) */
233  RPMTD_FORMAT_ARMOR = 1, /* ascii armor format (bin types) */
234  RPMTD_FORMAT_BASE64 = 2, /* base64 encoding (bin types) */
235  RPMTD_FORMAT_PGPSIG = 3, /* pgp/gpg signature (bin types) */
236  RPMTD_FORMAT_DEPFLAGS = 4, /* dependency flags (int types) */
237  RPMTD_FORMAT_FFLAGS = 5, /* file flags (int types) */
238  RPMTD_FORMAT_PERMS = 6, /* permission string (int types) */
239  RPMTD_FORMAT_TRIGGERTYPE = 7, /* trigger types (int types) */
240  RPMTD_FORMAT_XML = 8, /* xml format (any type) */
241  RPMTD_FORMAT_OCTAL = 9, /* octal format (int types) */
242  RPMTD_FORMAT_HEX = 10, /* hex format (int types) */
243  RPMTD_FORMAT_DATE = 11, /* date format (int types) */
244  RPMTD_FORMAT_DAY = 12, /* day format (int types) */
245  RPMTD_FORMAT_SHESCAPE = 13, /* shell escaped (any type) */
246  RPMTD_FORMAT_ARRAYSIZE = 14, /* size of contained array (any type) */
247  RPMTD_FORMAT_DEPTYPE = 15, /* dependency types (int types) */
248  RPMTD_FORMAT_FSTATE = 16, /* file states (int types) */
249  RPMTD_FORMAT_VFLAGS = 17, /* file verify flags (int types) */
250  RPMTD_FORMAT_EXPAND = 18, /* macro expansion (string types) */
251  RPMTD_FORMAT_FSTATUS = 19, /* file verify status (int types) */
252  RPMTD_FORMAT_HUMANSI = 20, /* human readable value, K = 1000 (int types) */
253  RPMTD_FORMAT_HUMANIEC = 21, /* human readable value, K = 1024 (int types) */
254  RPMTD_FORMAT_TAGNAME = 22, /* tag name (any type) */
255  RPMTD_FORMAT_TAGNUM = 23, /* tag number (any type) */
256  RPMTD_FORMAT_JSON = 24, /* json format (any type) */
257  RPMTD_FORMAT_HASHALGO = 25, /* digest algorithm name (int types) */
258 } rpmtdFormats;
259 
271 char *rpmtdFormat(rpmtd td, rpmtdFormats fmt, const char *errmsg);
272 
281 int rpmtdSetTag(rpmtd td, rpmTagVal tag);
282 
294 int rpmtdFromUint8(rpmtd td, rpmTagVal tag, uint8_t *data, rpm_count_t count);
295 
306 int rpmtdFromUint16(rpmtd td, rpmTagVal tag, uint16_t *data, rpm_count_t count);
307 
318 int rpmtdFromUint32(rpmtd td, rpmTagVal tag, uint32_t *data, rpm_count_t count);
319 
330 int rpmtdFromUint64(rpmtd td, rpmTagVal tag, uint64_t *data, rpm_count_t count);
331 
340 int rpmtdFromString(rpmtd td, rpmTagVal tag, const char *data);
341 
352 int rpmtdFromStringArray(rpmtd td, rpmTagVal tag, const char **data, rpm_count_t count);
353 
363 int rpmtdFromArgv(rpmtd td, rpmTagVal tag, ARGV_t argv);
364 
374 int rpmtdFromArgi(rpmtd td, rpmTagVal tag, ARGI_t argi);
375 
384 rpmtd rpmtdDup(rpmtd td);
385 
392 rpmsid * rpmtdToPool(rpmtd td, rpmstrPool pool);
393 
394 #ifdef __cplusplus
395 }
396 #endif
397 
398 #endif /* _RPMTD_H */
uint32_t * rpmtdNextUint32(rpmtd td)
int rpmtdInit(rpmtd td)
int rpmtdSetTag(rpmtd td, rpmTagVal tag)
rpmtd rpmtdFree(rpmtd td)
const char * rpmtdNextString(rpmtd td)
rpm_count_t rpmtdSize(rpmtd td)
rpm_count_t count
Definition: rpmtd.h:38
rpm_count_t size
Definition: rpmtd.h:42
enum rpmtdFormats_e rpmtdFormats
rpmTagType rpmtdType(rpmtd td)
int rpmtdFromStringArray(rpmtd td, rpmTagVal tag, const char **data, rpm_count_t count)
rpm_tagtype_t type
Definition: rpmtd.h:37
uint64_t * rpmtdGetUint64(rpmtd td)
rpmtdFlags flags
Definition: rpmtd.h:40
int rpmtdFromUint64(rpmtd td, rpmTagVal tag, uint64_t *data, rpm_count_t count)
char * rpmtdGetChar(rpmtd td)
rpm_count_t rpmtdCount(rpmtd td)
void rpmtdReset(rpmtd td)
int ix
Definition: rpmtd.h:41
rpmtdFormats_e
Definition: rpmtd.h:231
int rpmtdFromUint16(rpmtd td, rpmTagVal tag, uint16_t *data, rpm_count_t count)
int rpmtdFromUint8(rpmtd td, rpmTagVal tag, uint8_t *data, rpm_count_t count)
rpmTagVal rpmtdTag(rpmtd td)
rpm_data_t data
Definition: rpmtd.h:39
rpm_tag_t tag
Definition: rpmtd.h:36
uint16_t * rpmtdGetUint16(rpmtd td)
rpmtd rpmtdNew(void)
void rpmtdFreeData(rpmtd td)
uint64_t rpmtdGetNumber(rpmtd td)
uint32_t * rpmtdGetUint32(rpmtd td)
rpmtdFlags_e
Definition: rpmtd.h:20
Definition: rpmtd.h:35
int rpmtdFromUint32(rpmtd td, rpmTagVal tag, uint32_t *data, rpm_count_t count)
int rpmtdFromArgi(rpmtd td, rpmTagVal tag, ARGI_t argi)
int rpmtdNext(rpmtd td)
rpmtd rpmtdDup(rpmtd td)
int rpmtdSetIndex(rpmtd td, int index)
enum rpmTagClass_e rpmTagClass
rpmtdFlags rpmtdGetFlags(rpmtd td)
uint64_t * rpmtdNextUint64(rpmtd td)
char * rpmtdFormat(rpmtd td, rpmtdFormats fmt, const char *errmsg)
int rpmtdFromArgv(rpmtd td, rpmTagVal tag, ARGV_t argv)
Definition: argv.h:21
int rpmtdGetIndex(rpmtd td)
int rpmtdFromString(rpmtd td, rpmTagVal tag, const char *data)
rpmsid * rpmtdToPool(rpmtd td, rpmstrPool pool)
const char * rpmtdGetString(rpmtd td)
rpmTagClass rpmtdClass(rpmtd td)