rpm 6.1.90
The RPM Package Manager
Loading...
Searching...
No Matches
RPM Tag Data Container API.

How to retrieve data from package headers. More...

Collaboration diagram for RPM Tag Data Container API.:

Files

file  rpmtd.h

Data Structures

struct  rpmtd_s

Functions

RPM_PUBLIC_API rpmtd rpmtdNew (void)
RPM_PUBLIC_API rpmtd rpmtdFree (rpmtd td)
RPM_PUBLIC_API void rpmtdReset (rpmtd td)
RPM_PUBLIC_API void rpmtdFreeData (rpmtd td)
RPM_PUBLIC_API rpm_count_t rpmtdCount (rpmtd td)
RPM_PUBLIC_API rpm_count_t rpmtdSize (rpmtd td)
RPM_PUBLIC_API rpmTagVal rpmtdTag (rpmtd td)
RPM_PUBLIC_API rpmTagType rpmtdType (rpmtd td)
RPM_PUBLIC_API rpmTagClass rpmtdClass (rpmtd td)
RPM_PUBLIC_API rpmtdFlags rpmtdGetFlags (rpmtd td)
RPM_PUBLIC_API int rpmtdGetIndex (rpmtd td)
RPM_PUBLIC_API int rpmtdSetIndex (rpmtd td, int index)
RPM_PUBLIC_API int rpmtdInit (rpmtd td)
RPM_PUBLIC_API int rpmtdNext (rpmtd td)
RPM_PUBLIC_API uint32_t * rpmtdNextUint32 (rpmtd td)
RPM_PUBLIC_API uint64_t * rpmtdNextUint64 (rpmtd td)
RPM_PUBLIC_API const char * rpmtdNextString (rpmtd td)
RPM_PUBLIC_API char * rpmtdGetChar (rpmtd td)
RPM_PUBLIC_API uint16_t * rpmtdGetUint16 (rpmtd td)
RPM_PUBLIC_API uint32_t * rpmtdGetUint32 (rpmtd td)
RPM_PUBLIC_API uint64_t * rpmtdGetUint64 (rpmtd td)
RPM_PUBLIC_API const char * rpmtdGetString (rpmtd td)
RPM_PUBLIC_API uint64_t rpmtdGetNumber (rpmtd td)
RPM_PUBLIC_API char * rpmtdFormat (rpmtd td, rpmtdFormats fmt, const char *errmsg)
RPM_PUBLIC_API int rpmtdSetTag (rpmtd td, rpmTagVal tag)
RPM_PUBLIC_API int rpmtdFromUint8 (rpmtd td, rpmTagVal tag, uint8_t *data, rpm_count_t count)
RPM_PUBLIC_API int rpmtdFromUint16 (rpmtd td, rpmTagVal tag, uint16_t *data, rpm_count_t count)
RPM_PUBLIC_API int rpmtdFromUint32 (rpmtd td, rpmTagVal tag, uint32_t *data, rpm_count_t count)
RPM_PUBLIC_API int rpmtdFromUint64 (rpmtd td, rpmTagVal tag, uint64_t *data, rpm_count_t count)
RPM_PUBLIC_API int rpmtdFromString (rpmtd td, rpmTagVal tag, const char *data)
RPM_PUBLIC_API int rpmtdFromStringArray (rpmtd td, rpmTagVal tag, const char **data, rpm_count_t count)
RPM_PUBLIC_API int rpmtdFromArgv (rpmtd td, rpmTagVal tag, ARGV_t argv)
RPM_PUBLIC_API int rpmtdFromArgi (rpmtd td, rpmTagVal tag, ARGI_t argi)
RPM_PUBLIC_API rpmtd rpmtdDup (rpmtd td)
RPM_PUBLIC_API rpmsid * rpmtdToPool (rpmtd td, rpmstrPool pool)

Detailed Description

How to retrieve data from package headers.

Function Documentation

◆ rpmtdClass()

RPM_PUBLIC_API rpmTagClass rpmtdClass ( rpmtd td)

Retrieve class of the container.

Parameters
tdTag data container
Returns
Rpm tag class

◆ rpmtdCount()

RPM_PUBLIC_API rpm_count_t rpmtdCount ( rpmtd td)

Retrieve array size of the container. For non-array types this is always 1.

Parameters
tdTag data container
Returns
Number of entries in contained data.

◆ rpmtdDup()

RPM_PUBLIC_API rpmtd rpmtdDup ( rpmtd td)

Perform deep copy of container. Create a modifiable copy of tag data container (on string arrays each string is separately allocated)

Todo
Only string arrays types are supported currently
Parameters
tdContainer to copy
Returns
New container or NULL on error

◆ rpmtdFormat()

RPM_PUBLIC_API char * rpmtdFormat ( rpmtd td,
rpmtdFormats fmt,
const char * errmsg )

Format data from tag container to string presentation of given format. Return malloced string presentation of current data in container, converting from integers etc as necessary. On array types, data from current iteration index is used for formatting.

Parameters
tdTag data container
fmtFormat to apply
errmsgError message from conversion (or NULL)
Returns
String representation of current data (malloc'ed), NULL on error

◆ rpmtdFree()

RPM_PUBLIC_API rpmtd rpmtdFree ( rpmtd td)

Destroy tag data container.

Parameters
tdTag data container
Returns
NULL always

◆ rpmtdFreeData()

RPM_PUBLIC_API void rpmtdFreeData ( rpmtd td)

Free contained data. This is always safe to call as the container knows if data was malloc'ed or not. Container is reinitialized.

Parameters
tdTag data container

◆ rpmtdFromArgi()

RPM_PUBLIC_API int rpmtdFromArgi ( rpmtd td,
rpmTagVal tag,
ARGI_t argi )

Construct tag container from ARGI_t array. Tag type is checked to be of integer array type and array is checked to be non-empty.

Parameters
tdTag data container
tagRpm tag to construct
argiARGI array
Returns
1 on success, 0 on error (eg wrong type)

◆ rpmtdFromArgv()

RPM_PUBLIC_API int rpmtdFromArgv ( rpmtd td,
rpmTagVal tag,
ARGV_t argv )

Construct tag container from ARGV_t array. Tag type is checked to be of string array type and array is checked to be non-empty.

Parameters
tdTag data container
tagRpm tag to construct
argvARGV array
Returns
1 on success, 0 on error (eg wrong type)

◆ rpmtdFromString()

RPM_PUBLIC_API int rpmtdFromString ( rpmtd td,
rpmTagVal tag,
const char * data )

Construct tag container from a string. Tag type is checked to be of string type.

Parameters
tdTag data container
tagRpm tag to construct
dataString to use
Returns
1 on success, 0 on error (eg wrong type)

◆ rpmtdFromStringArray()

RPM_PUBLIC_API int rpmtdFromStringArray ( rpmtd td,
rpmTagVal tag,
const char ** data,
rpm_count_t count )

Construct tag container from a string array. Tag type is checked to be of string or string array type. For non-array types count must be exactly 1.

Parameters
tdTag data container
tagRpm tag to construct
dataPointer to string array
countNumber of entries
Returns
1 on success, 0 on error (eg wrong type)

◆ rpmtdFromUint16()

RPM_PUBLIC_API int rpmtdFromUint16 ( rpmtd td,
rpmTagVal tag,
uint16_t * data,
rpm_count_t count )

Construct tag container from uint16_t pointer. Tag type is checked to be of INT16 type. For non-array types count must be exactly 1.

Parameters
tdTag data container
tagRpm tag to construct
dataPointer to uint16_t (value or array)
countNumber of entries
Returns
1 on success, 0 on error (eg wrong type)

◆ rpmtdFromUint32()

RPM_PUBLIC_API int rpmtdFromUint32 ( rpmtd td,
rpmTagVal tag,
uint32_t * data,
rpm_count_t count )

Construct tag container from uint32_t pointer. Tag type is checked to be of INT32 type. For non-array types count must be exactly 1.

Parameters
tdTag data container
tagRpm tag to construct
dataPointer to uint32_t (value or array)
countNumber of entries
Returns
1 on success, 0 on error (eg wrong type)

◆ rpmtdFromUint64()

RPM_PUBLIC_API int rpmtdFromUint64 ( rpmtd td,
rpmTagVal tag,
uint64_t * data,
rpm_count_t count )

Construct tag container from uint64_t pointer. Tag type is checked to be of INT64 type. For non-array types count must be exactly 1.

Parameters
tdTag data container
tagRpm tag to construct
dataPointer to uint64_t (value or array)
countNumber of entries
Returns
1 on success, 0 on error (eg wrong type)

◆ rpmtdFromUint8()

RPM_PUBLIC_API int rpmtdFromUint8 ( rpmtd td,
rpmTagVal tag,
uint8_t * data,
rpm_count_t count )

Construct tag container from uint8_t pointer. Tag type is checked to be of compatible type (CHAR, INT8 or BIN). For non-array types (BIN is a special case of INT8 array) count must be exactly 1.

Parameters
tdTag data container
tagRpm tag to construct
dataPointer to uint8_t (value or array)
countNumber of entries
Returns
1 on success, 0 on error (eg wrong type)

◆ rpmtdGetChar()

RPM_PUBLIC_API char * rpmtdGetChar ( rpmtd td)

Return char data from tag container. For scalar return type, just return pointer to the integer. On array types, return pointer to current iteration index. If the tag container is not for char type, NULL is returned.

Parameters
tdTag data container
Returns
Pointer to uint16_t, NULL on error

◆ rpmtdGetFlags()

RPM_PUBLIC_API rpmtdFlags rpmtdGetFlags ( rpmtd td)

Retrieve flags of the container (allocation details etc)

Parameters
tdTag data container
Returns
Container flags

◆ rpmtdGetIndex()

RPM_PUBLIC_API int rpmtdGetIndex ( rpmtd td)

Retrieve current iteration index of the container.

Parameters
tdTag data container
Returns
Iteration index (or -1 if not iterating)

◆ rpmtdGetNumber()

RPM_PUBLIC_API uint64_t rpmtdGetNumber ( rpmtd td)

Return numeric value from tag container. Returns the value of numeric container (RPM_NUMERIC_CLASS) from current iteration index as uint64_t regardless of its internal presentation (8/16/32/64-bit integer).

Parameters
tdTag data container
Returns
Value of current iteration item as uint64_t, 0 for non-numeric types (error)

◆ rpmtdGetString()

RPM_PUBLIC_API const char * rpmtdGetString ( rpmtd td)

Return string data from tag container. For string types, just return the string. On string array types, return the string from current iteration index. If the tag container is not for a string type, NULL is returned.

Parameters
tdTag data container
Returns
String constant from container, NULL on error

◆ rpmtdGetUint16()

RPM_PUBLIC_API uint16_t * rpmtdGetUint16 ( rpmtd td)

Return uint16_t data from tag container. For scalar return type, just return pointer to the integer. On array types, return pointer to current iteration index. If the tag container is not for int16 type, NULL is returned.

Parameters
tdTag data container
Returns
Pointer to uint16_t, NULL on error

◆ rpmtdGetUint32()

RPM_PUBLIC_API uint32_t * rpmtdGetUint32 ( rpmtd td)

Return uint32_t data from tag container. For scalar return type, just return pointer to the integer. On array types, return pointer to current iteration index. If the tag container is not for int32 type, NULL is returned.

Parameters
tdTag data container
Returns
Pointer to uint32_t, NULL on error

◆ rpmtdGetUint64()

RPM_PUBLIC_API uint64_t * rpmtdGetUint64 ( rpmtd td)

Return uint64_t data from tag container. For scalar return type, just return pointer to the integer. On array types, return pointer to current iteration index. If the tag container is not for int64 type, NULL is returned.

Parameters
tdTag data container
Returns
Pointer to uint64_t, NULL on error

◆ rpmtdInit()

RPM_PUBLIC_API int rpmtdInit ( rpmtd td)

Initialize tag container for iteration

Parameters
tdTag data container
Returns
0 on success

◆ rpmtdNew()

RPM_PUBLIC_API rpmtd rpmtdNew ( void )

Create new tag data container

Returns
New, initialized tag data container.

◆ rpmtdNext()

RPM_PUBLIC_API int rpmtdNext ( rpmtd td)

Iterate over tag data container.

Parameters
tdTag data container
Returns
Tag data container iterator index, -1 on termination

◆ rpmtdNextString()

RPM_PUBLIC_API const char * rpmtdNextString ( rpmtd td)

Iterate over string / string array type tag data container.

Parameters
tdTag data container
Returns
Pointer to next value, NULL on termination or error

◆ rpmtdNextUint32()

RPM_PUBLIC_API uint32_t * rpmtdNextUint32 ( rpmtd td)

Iterate over uint32_t type tag data container.

Parameters
tdTag data container
Returns
Pointer to next value, NULL on termination or error

◆ rpmtdNextUint64()

RPM_PUBLIC_API uint64_t * rpmtdNextUint64 ( rpmtd td)

Iterate over uint64_t type tag data container.

Parameters
tdTag data container
Returns
Pointer to next value, NULL on termination or error

◆ rpmtdReset()

RPM_PUBLIC_API void rpmtdReset ( rpmtd td)

(Re-)initialize tag data container. Contents will be zeroed out and iteration index reset.

Parameters
tdTag data container

◆ rpmtdSetIndex()

RPM_PUBLIC_API int rpmtdSetIndex ( rpmtd td,
int index )

Set iteration index of the container. If new index is out of bounds for the container, -1 is returned and iteration index is left untouched.

Parameters
tdTag data container
indexNew index
Returns
New index, or -1 if index out of bounds

◆ rpmtdSetTag()

RPM_PUBLIC_API int rpmtdSetTag ( rpmtd td,
rpmTagVal tag )

Set container tag and type. For empty container, any valid tag can be set. If the container has data, changing is only permitted to tag of same type.

Parameters
tdTag data container
tagNew tag
Returns
1 on success, 0 on error

◆ rpmtdSize()

RPM_PUBLIC_API rpm_count_t rpmtdSize ( rpmtd td)

Retrieve container data size (eg required for allocation). Note this currently only works for RPMTD_IMMUTABLE data.

Parameters
tdTag data container
Returns
Data size in bytes.

◆ rpmtdTag()

RPM_PUBLIC_API rpmTagVal rpmtdTag ( rpmtd td)

Retrieve tag of the container.

Parameters
tdTag data container
Returns
Rpm tag.

◆ rpmtdToPool()

RPM_PUBLIC_API rpmsid * rpmtdToPool ( rpmtd td,
rpmstrPool pool )

Push string array container contents to a string pool, return string ids.

Parameters
tdTag data container
poolString pool
Returns
Array of string id's (malloced)

◆ rpmtdType()

RPM_PUBLIC_API rpmTagType rpmtdType ( rpmtd td)

Retrieve type of the container.

Parameters
tdTag data container
Returns
Rpm tag type.