rpm: rpmtd.h Source File

rpm 4.11.2-rc1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

rpmtd.h
Go to the documentation of this file.
1 #ifndef _RPMTD_H
2 #define _RPMTD_H
3
4 #include <rpm/rpmtypes.h>
5 #include <rpm/argv.h>
6
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10
11 enum rpmtdFlags_e {
12 RPMTD_NONE = 0,
13 RPMTD_ALLOCED = (1 << 0), /* was memory allocated? */
14 RPMTD_PTR_ALLOCED = (1 << 1), /* were array pointers allocated? */
15 RPMTD_IMMUTABLE = (1 << 2), /* header data or modifiable? */
16 RPMTD_ARGV = (1 << 3), /* string array is NULL-terminated? */
17 RPMTD_INVALID = (1 << 4), /* invalid data (in header) */
18 };
19
20 typedef rpmFlags rpmtdFlags;
21
26 struct rpmtd_s {
27 rpm_tag_t tag; /* rpm tag of this data entry*/
28 rpm_tagtype_t type; /* data type */
29 rpm_count_t count; /* number of entries */
30 rpm_data_t data; /* pointer to actual data */
31 rpmtdFlags flags; /* flags on memory allocation etc */
32 int ix; /* iteration index */
33 };
34
39 rpmtd rpmtdNew(void);
40
46 rpmtd rpmtdFree(rpmtd td);
47
53 void rpmtdReset(rpmtd td);
54
60 void rpmtdFreeData(rpmtd td);
61
67 rpm_count_t rpmtdCount(rpmtd td);
68
74 rpmTagVal rpmtdTag(rpmtd td);
75
81 rpmTagType rpmtdType(rpmtd td);
82
88 rpmTagClass rpmtdClass(rpmtd td);
89
95 rpmtdFlags rpmtdGetFlags(rpmtd td);
96
102 int rpmtdGetIndex(rpmtd td);
103
112 int rpmtdSetIndex(rpmtd td, int index);
113
119 int rpmtdInit(rpmtd td);
120
126 int rpmtdNext(rpmtd td);
127
133 uint32_t *rpmtdNextUint32(rpmtd td);
134
140 uint64_t *rpmtdNextUint64(rpmtd td);
141
147 const char *rpmtdNextString(rpmtd td);
148
157 char *rpmtdGetChar(rpmtd td);
158
167 uint16_t * rpmtdGetUint16(rpmtd td);
168
177 uint32_t * rpmtdGetUint32(rpmtd td);
178
187 uint64_t * rpmtdGetUint64(rpmtd td);
188
197 const char * rpmtdGetString(rpmtd td);
198
208 uint64_t rpmtdGetNumber(rpmtd td);
209
210 typedef enum rpmtdFormats_e {
211 RPMTD_FORMAT_STRING = 0, /* plain string (any type) */
212 RPMTD_FORMAT_ARMOR = 1, /* ascii armor format (bin types) */
213 RPMTD_FORMAT_BASE64 = 2, /* base64 encoding (bin types) */
214 RPMTD_FORMAT_PGPSIG = 3, /* pgp/gpg signature (bin types) */
215 RPMTD_FORMAT_DEPFLAGS = 4, /* dependency flags (int types) */
216 RPMTD_FORMAT_FFLAGS = 5, /* file flags (int types) */
217 RPMTD_FORMAT_PERMS = 6, /* permission string (int types) */
218 RPMTD_FORMAT_TRIGGERTYPE = 7, /* trigger types (int types) */
219 RPMTD_FORMAT_XML = 8, /* xml format (any type) */
220 RPMTD_FORMAT_OCTAL = 9, /* octal format (int types) */
221 RPMTD_FORMAT_HEX = 10, /* hex format (int types) */
222 RPMTD_FORMAT_DATE = 11, /* date format (int types) */
223 RPMTD_FORMAT_DAY = 12, /* day format (int types) */
224 RPMTD_FORMAT_SHESCAPE = 13, /* shell escaped (any type) */
225 RPMTD_FORMAT_ARRAYSIZE = 14, /* size of contained array (any type) */
226 RPMTD_FORMAT_DEPTYPE = 15, /* dependency types (int types) */
227 RPMTD_FORMAT_FSTATE = 16, /* file states (int types) */
228 RPMTD_FORMAT_VFLAGS = 17, /* file verify flags (int types) */
229 RPMTD_FORMAT_EXPAND = 18, /* macro expansion (string types) */
230 RPMTD_FORMAT_FSTATUS = 19, /* file verify status (int types) */
231 } rpmtdFormats;
232
244 char *rpmtdFormat(rpmtd td, rpmtdFormats fmt, const char *errmsg);
245
254 int rpmtdSetTag(rpmtd td, rpmTagVal tag);
255
267 int rpmtdFromUint8(rpmtd td, rpmTagVal tag, uint8_t *data, rpm_count_t count);
268
279 int rpmtdFromUint16(rpmtd td, rpmTagVal tag, uint16_t *data, rpm_count_t count);
280
291 int rpmtdFromUint32(rpmtd td, rpmTagVal tag, uint32_t *data, rpm_count_t count);
292
303 int rpmtdFromUint64(rpmtd td, rpmTagVal tag, uint64_t *data, rpm_count_t count);
304
313 int rpmtdFromString(rpmtd td, rpmTagVal tag, const char *data);
314
325 int rpmtdFromStringArray(rpmtd td, rpmTagVal tag, const char **data, rpm_count_t count);
326
336 int rpmtdFromArgv(rpmtd td, rpmTagVal tag, ARGV_t argv);
337
347 int rpmtdFromArgi(rpmtd td, rpmTagVal tag, ARGI_t argi);
348
349 /* \ingroup rpmtd
350 * Perform deep copy of container.
351 * Create a modifiable copy of tag data container (on string arrays each
352 * string is separately allocated)
353 * @todo Only string arrays types are supported currently
354 * @param td Container to copy
355 * @return New container or NULL on error
356 */
357 rpmtd rpmtdDup(rpmtd td);
358
359 /* \ingroup rpmtd
360 * Push string array container contents to a string pool, return string ids.
361 * @param td Tag data container
362 * @param pool String pool
363 * @return Array of string id's (malloced)
364 */
365 rpmsid * rpmtdToPool(rpmtd td, rpmstrPool pool);
366
367 #ifdef __cplusplus
368 }
369 #endif
370
371 #endif /* _RPMTD_H */
rpmtdNextUint32
uint32_t * rpmtdNextUint32(rpmtd td)
Iterate over uint32_t type tag data container.
rpmtdInit
int rpmtdInit(rpmtd td)
Initialize tag container for iteration.
RPMTD_FORMAT_PGPSIG
Definition: rpmtd.h:214
RPMTD_FORMAT_VFLAGS
Definition: rpmtd.h:228
rpmtdSetTag
int rpmtdSetTag(rpmtd td, rpmTagVal tag)
Set container tag and type.
rpmtdFree
rpmtd rpmtdFree(rpmtd td)
Destroy tag data container.
RPMTD_FORMAT_OCTAL
Definition: rpmtd.h:220
ARGV_t
char ** ARGV_t
Definition: argv.h:15
rpmtdNextString
const char * rpmtdNextString(rpmtd td)
Iterate over string / string array type tag data container.
RPMTD_ALLOCED
Definition: rpmtd.h:13
rpmtdToPool
rpmsid * rpmtdToPool(rpmtd td, rpmstrPool pool)
rpm_data_t
void * rpm_data_t
Definition: rpmtypes.h:33
rpmtd_s::count
rpm_count_t count
Definition: rpmtd.h:29
rpm_tag_t
int32_t rpm_tag_t
Definition: rpmtypes.h:27
rpmtdFlags
rpmFlags rpmtdFlags
Definition: rpmtd.h:20
rpmtdFormats
enum rpmtdFormats_e rpmtdFormats
RPMTD_FORMAT_SHESCAPE
Definition: rpmtd.h:224
rpmtdType
rpmTagType rpmtdType(rpmtd td)
Retrieve type of the container.
rpmtdFromStringArray
int rpmtdFromStringArray(rpmtd td, rpmTagVal tag, const char **data, rpm_count_t count)
Construct tag container from a string array.
RPMTD_FORMAT_ARRAYSIZE
Definition: rpmtd.h:225
RPMTD_INVALID
Definition: rpmtd.h:17
RPMTD_FORMAT_DAY
Definition: rpmtd.h:223
RPMTD_FORMAT_TRIGGERTYPE
Definition: rpmtd.h:218
rpmtd_s::type
rpm_tagtype_t type
Definition: rpmtd.h:28
RPMTD_FORMAT_DATE
Definition: rpmtd.h:222
RPMTD_FORMAT_STRING
Definition: rpmtd.h:211
rpmtdGetUint64
uint64_t * rpmtdGetUint64(rpmtd td)
Return uint64_t data from tag container.
rpmtd_s::flags
rpmtdFlags flags
Definition: rpmtd.h:31
RPMTD_FORMAT_FSTATUS
Definition: rpmtd.h:230
RPMTD_IMMUTABLE
Definition: rpmtd.h:15
rpmtdFromUint64
int rpmtdFromUint64(rpmtd td, rpmTagVal tag, uint64_t *data, rpm_count_t count)
Construct tag container from uint64_t pointer.
rpmtdGetChar
char * rpmtdGetChar(rpmtd td)
Return char data from tag container.
rpmtdCount
rpm_count_t rpmtdCount(rpmtd td)
Retrieve array size of the container.
rpmFlags
uint32_t rpmFlags
Definition: rpmtypes.h:42
rpmstrPool
struct rpmstrPool_s * rpmstrPool
Definition: rpmtypes.h:81
rpmsid
uint32_t rpmsid
Definition: rpmtypes.h:80
rpmtdReset
void rpmtdReset(rpmtd td)
(Re-)initialize tag data container.
rpmtd_s::ix
int ix
Definition: rpmtd.h:32
RPMTD_NONE
Definition: rpmtd.h:12
RPMTD_FORMAT_HEX
Definition: rpmtd.h:221
RPMTD_FORMAT_DEPTYPE
Definition: rpmtd.h:226
rpmtdFormats_e
rpmtdFormats_e
Definition: rpmtd.h:210
rpmtdFromUint16
int rpmtdFromUint16(rpmtd td, rpmTagVal tag, uint16_t *data, rpm_count_t count)
Construct tag container from uint16_t pointer.
rpmtdFromUint8
int rpmtdFromUint8(rpmtd td, rpmTagVal tag, uint8_t *data, rpm_count_t count)
Construct tag container from uint8_t pointer.
rpmtdTag
rpmTagVal rpmtdTag(rpmtd td)
Retrieve tag of the container.
rpmTagType
enum rpmTagType_e rpmTagType
The basic types of data in tags from headers.
RPMTD_PTR_ALLOCED
Definition: rpmtd.h:14
RPMTD_FORMAT_DEPFLAGS
Definition: rpmtd.h:215
rpmtd_s::data
rpm_data_t data
Definition: rpmtd.h:30
RPMTD_FORMAT_FFLAGS
Definition: rpmtd.h:216
RPMTD_ARGV
Definition: rpmtd.h:16
rpmtd_s::tag
rpm_tag_t tag
Definition: rpmtd.h:27
rpm_count_t
uint32_t rpm_count_t
Definition: rpmtypes.h:29
rpmtdGetUint16
uint16_t * rpmtdGetUint16(rpmtd td)
Return uint16_t data from tag container.
rpmtdNew
rpmtd rpmtdNew(void)
Create new tag data container.
rpmtdFreeData
void rpmtdFreeData(rpmtd td)
Free contained data.
RPMTD_FORMAT_BASE64
Definition: rpmtd.h:213
RPMTD_FORMAT_ARMOR
Definition: rpmtd.h:212
rpmTagVal
rpm_tag_t rpmTagVal
Definition: rpmtypes.h:30
rpmtdGetNumber
uint64_t rpmtdGetNumber(rpmtd td)
Return numeric value from tag container.
rpmtdGetUint32
uint32_t * rpmtdGetUint32(rpmtd td)
Return uint32_t data from tag container.
rpmtdDup
rpmtd rpmtdDup(rpmtd td)
RPMTD_FORMAT_FSTATE
Definition: rpmtd.h:227
RPMTD_FORMAT_XML
Definition: rpmtd.h:219
rpmtdFlags_e
rpmtdFlags_e
Definition: rpmtd.h:11
RPMTD_FORMAT_EXPAND
Definition: rpmtd.h:229
rpmtd_s
Container for rpm tag data (from headers or extensions).
Definition: rpmtd.h:26
rpmtdFromUint32
int rpmtdFromUint32(rpmtd td, rpmTagVal tag, uint32_t *data, rpm_count_t count)
Construct tag container from uint32_t pointer.
rpmtdFromArgi
int rpmtdFromArgi(rpmtd td, rpmTagVal tag, ARGI_t argi)
Construct tag container from ARGI_t array.
RPMTD_FORMAT_PERMS
Definition: rpmtd.h:217
rpmtdNext
int rpmtdNext(rpmtd td)
Iterate over tag data container.
rpmtdSetIndex
int rpmtdSetIndex(rpmtd td, int index)
Set iteration index of the container.
rpmTagClass
enum rpmTagClass_e rpmTagClass
The classes of data in tags from headers.
rpm_tagtype_t
uint32_t rpm_tagtype_t
Definition: rpmtypes.h:28
rpmtdGetFlags
rpmtdFlags rpmtdGetFlags(rpmtd td)
Retrieve flags of the container (allocation details etc)
rpmtdNextUint64
uint64_t * rpmtdNextUint64(rpmtd td)
Iterate over uint64_t type tag data container.
rpmtdFormat
char * rpmtdFormat(rpmtd td, rpmtdFormats fmt, const char *errmsg)
Format data from tag container to string presentation of given format.
rpmtdFromArgv
int rpmtdFromArgv(rpmtd td, rpmTagVal tag, ARGV_t argv)
Construct tag container from ARGV_t array.
ARGI_s
Definition: argv.h:19
rpmtdGetIndex
int rpmtdGetIndex(rpmtd td)
Retrieve current iteration index of the container.
rpmtdFromString
int rpmtdFromString(rpmtd td, rpmTagVal tag, const char *data)
Construct tag container from a string.
rpmtdGetString
const char * rpmtdGetString(rpmtd td)
Return string data from tag container.
rpmtdClass
rpmTagClass rpmtdClass(rpmtd td)
Retrieve class of the container.