Data Structures | |
struct | cpe_t |
Structure holding Common Platform Enumeration URI data. More... | |
Files | |
file | cpeuri.h |
Interface to Common Product Enumeration (CPE) URI. | |
Enumerations | |
enum | cpe_part_t { CPE_PART_NONE, CPE_PART_HW, CPE_PART_OS, CPE_PART_APP } |
enumeration of possible CPE parts More... | |
enum | cpe_field_t { CPE_FIELD_TYPE, CPE_FIELD_VENDOR, CPE_FIELD_PRODUCT, CPE_FIELD_VERSION, CPE_FIELD_UPDATE, CPE_FIELD_EDITION, CPE_FIELD_LANGUAGE, CPE_FIELDNUM } |
enumeration of CPE URI fields (useful for indexing arrays) | |
Functions | |
cpe_t * | cpe_new (const char *cpe) |
Create new CPE structure from string cpe. | |
char ** | cpe_split (char *str, const char *delim) |
Split CPE string into individual fields separated by delim. | |
bool | cpe_urldecode (char *str) |
In-place decodes a -encoded string. | |
bool | cpe_name_match_one (const cpe_t *cpe, const cpe_t *against) |
Check if candidate CPE cpe matches CPE against according to CPE specification v 2.1. | |
bool | cpe_name_match_cpes (const cpe_t *name, size_t n, cpe_t **namelist) |
Check if CPE name matches any CPE in namelist. | |
int | cpe_name_match_strs (const char *candidate, size_t n, char **targets) |
Match CPE URI candidate against list of n CPE URIs given by targets. | |
bool | cpe_check (const char *str) |
Ensures str is in proper CPE format. | |
char * | cpe_get_uri (const cpe_t *cpe) |
Return CPE URI as a new string. | |
int | cpe_write (const cpe_t *cpe, FILE *f) |
Write CPE URI cpe to file a descriptor f. | |
bool | cpe_assign_values (cpe_t *cpe, char **fields) |
Fill cpe structure with parsed fields. | |
void | cpe_delete (cpe_t *cpe) |
Destructor. | |
size_t | ptrarray_length (void **arr) |
Return number of elements in NULL-terminated array of pointers. | |
Variables | |
const char * | CPE_PART_CHAR [4] |
string representation of CPE parts, order corresponds with values in enum above | |
const char * | CPE_SCHEMA |
CPE URI schema string. | |
const char | CPE_SEP_CHAR |
CPE URI component separator character. | |
const char * | CPE_SEP_STR |
CPE URI component separator character as string. | |
char ** | cpe_t::fields_ |
NULL-terminated array of pointers to individual components of CPE URI, internal. | |
enum cpe_part_t | cpe_t::part |
part | |
const char * | cpe_t::vendor |
vendor | |
const char * | cpe_t::product |
product | |
const char * | cpe_t::version |
version | |
const char * | cpe_t::update |
update | |
const char * | cpe_t::edition |
edition | |
const char * | cpe_t::language |
language |
enum cpe_part_t |
bool cpe_assign_values | ( | cpe_t * | cpe, | |
char ** | fields | |||
) |
Fill cpe structure with parsed fields.
Fields can be obtained via cpe_split(). Pointers in target sructure will point to same strings as pointers in fields do. No string duplication is performed.
cpe | structure to be filled | |
fields | NULL-terminated array of strings representing individual fields |
bool cpe_check | ( | const char * | str | ) |
Ensures str is in proper CPE format.
str | string to be validated |
void cpe_delete | ( | cpe_t * | cpe | ) |
Destructor.
Frees any used resources and safely destroys cpe.
cpe | CPE to be deleted |
char* cpe_get_uri | ( | const cpe_t * | cpe | ) |
Return CPE URI as a new string.
cpe | CPE to be converted |
NULL | on failure |
Check if CPE name matches any CPE in namelist.
name | name to be looked-up | |
n | number of items in namelist | |
namelist | list of names to search in |
int cpe_name_match_strs | ( | const char * | candidate, | |
size_t | n, | |||
char ** | targets | |||
) |
Match CPE URI candidate against list of n CPE URIs given by targets.
candidate | candidarte CPE URI as string | |
n | number of items in targets | |
targets | list of CPE URIs to be candidate matched against |
-1 | on mismatch | |
-2 | invalid CPE URI was given as parameter |
cpe_t* cpe_new | ( | const char * | cpe | ) |
Create new CPE structure from string cpe.
cpe | CPE URI string to be parsed |
NULL | on failure |
char** cpe_split | ( | char * | str, | |
const char * | delim | |||
) |
Split CPE string into individual fields separated by delim.
This function returns NULL-terminated array of pointers to strings.
This function modifies its first argument.
str | string to be parsed, will be changed as side-effect of this function | |
delim | delimiter |
NULL | on failure |
bool cpe_urldecode | ( | char * | str | ) |
In-place decodes a -encoded string.
str | string to be decoded (will be modified) |
int cpe_write | ( | const cpe_t * | cpe, | |
FILE * | f | |||
) |
Write CPE URI cpe to file a descriptor f.
cpe | cpe to write | |
f | file descriptor to write CPE URI to |
<0 | on failure |
size_t ptrarray_length | ( | void ** | arr | ) |
Return number of elements in NULL-terminated array of pointers.
array | of pointers |