CPE URIs
[CPE]


Files

file  cpe_name.h
 Interface to Common Platform Enumeration (CPE) URI.

Data Structures

struct  cpe_name
 Structure holding Common Platform Enumeration URI data. More...

Getters

Return value is pointer to structure's member.

Do not free unless you null the pointer in the structure. Use remove function otherwise.

cpe_format_t cpe_name_get_format (const struct cpe_name *cpe)
 Get how the CPE name was loaded and how it should be saved cpe_name.
cpe_part_t cpe_name_get_part (const struct cpe_name *cpe)
 Get CPE name part type field.
const char * cpe_name_get_vendor (const struct cpe_name *cpe)
 Get CPE name vendor field.
const char * cpe_name_get_product (const struct cpe_name *cpe)
 Get CPE name product field.
const char * cpe_name_get_version (const struct cpe_name *cpe)
 Get CPE name version field.
const char * cpe_name_get_update (const struct cpe_name *cpe)
 Get CPE name update field.
const char * cpe_name_get_edition (const struct cpe_name *cpe)
 Get CPE name edition field.
const char * cpe_name_get_language (const struct cpe_name *cpe)
 Get CPE name language field.
const char * cpe_name_get_sw_edition (const struct cpe_name *cpe)
 Get CPE name sw_edition field.
const char * cpe_name_get_target_sw (const struct cpe_name *cpe)
 Get CPE name target_sw field.
const char * cpe_name_get_target_hw (const struct cpe_name *cpe)
 Get CPE name target_hw field.
const char * cpe_name_get_other (const struct cpe_name *cpe)
 Get CPE name other field.
char * cpe_name_get_as_format (const struct cpe_name *cpe, cpe_format_t format)
 Return CPE URI as a new string in specified format.
char * cpe_name_get_as_str (const struct cpe_name *cpe)
 Return CPE URI as a new string in the format in which it was loaded.

Setters

For lists use add functions.

Parameters of set functions are duplicated in memory and need to be freed by caller.

bool cpe_name_set_format (struct cpe_name *cpe, cpe_format_t newval)
 Set how the CPE name was loaded and how it should be saved cpe_name.
bool cpe_name_set_part (struct cpe_name *cpe, cpe_part_t newval)
 Set CPE name part type field.
bool cpe_name_set_vendor (struct cpe_name *cpe, const char *newval)
 Set CPE name vendor field.
bool cpe_name_set_product (struct cpe_name *cpe, const char *newval)
 Set CPE name product field.
bool cpe_name_set_version (struct cpe_name *cpe, const char *newval)
 Set CPE name version field.
bool cpe_name_set_update (struct cpe_name *cpe, const char *newval)
 Set CPE name update field.
bool cpe_name_set_edition (struct cpe_name *cpe, const char *newval)
 Set CPE name edition field.
bool cpe_name_set_language (struct cpe_name *cpe, const char *newval)
 Set CPE name language field.
bool cpe_name_set_sw_edition (struct cpe_name *cpe, const char *newval)
 Set CPE name sw_edition field.
bool cpe_name_set_target_sw (struct cpe_name *cpe, const char *newval)
 Set CPE name target_sw field.
bool cpe_name_set_target_hw (struct cpe_name *cpe, const char *newval)
 Set CPE name target_hw field.
bool cpe_name_set_other (struct cpe_name *cpe, const char *newval)
 Set CPE name other field.

Evaluators

bool cpe_name_match_one (const struct cpe_name *cpe, const struct cpe_name *against)
 Check if candidate CPE cpe matches CPE against according to CPE specification v 2.1.
bool cpe_name_match_cpes (const struct cpe_name *name, size_t n, struct cpe_name **namelist)
 Check if CPE name matches any CPE in namelist.
int cpe_name_write (const struct cpe_name *cpe, FILE *f)
 Write CPE URI cpe to file a descriptor f cpe_name.
cpe_format_t cpe_name_get_format_of_str (const char *str)
 Looks at given string and returns format it is in.
bool cpe_name_check (const char *str)
 Checks whether str is valid CPE string (in any supported format).
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.
const char * cpe_name_supported (void)
 Get supported version of CPE uri XML.

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_format_t { CPE_FORMAT_UNKNOWN, CPE_FORMAT_URI, CPE_FORMAT_STRING, CPE_FORMAT_WFN }

Functions

struct cpe_namecpe_name_new (const char *cpe)
 Create a new CPE structure from string cpe.
struct cpe_namecpe_name_clone (struct cpe_name *old_name)
 Clone CPE Name.
void cpe_name_free (struct cpe_name *cpe)
 Destructor.

Enumeration Type Documentation

Enumerator:
CPE_FORMAT_UNKNOWN  can't be serialized, is usually used to signal errors
CPE_FORMAT_URI  available in all CPE versions, default in CPE 2.2 and previous
CPE_FORMAT_STRING  available in CPE 2.3 and newer
CPE_FORMAT_WFN  available in CPE 2.3 and newer versions, default in CPE 2.3 and newer

enum cpe_part_t

enumeration of possible CPE parts

Enumerator:
CPE_PART_NONE  no part specified
CPE_PART_HW  hardware
CPE_PART_OS  operating system
CPE_PART_APP  application


Function Documentation

bool cpe_name_check ( const char *  str  ) 

Checks whether str is valid CPE string (in any supported format).

cpe_name

Parameters:
str string to be validated

struct cpe_name* cpe_name_clone ( struct cpe_name old_name  )  [read]

Clone CPE Name.

Parameters:
old_name CPE name cpe_name

void cpe_name_free ( struct cpe_name cpe  ) 

Destructor.

Frees any used resources and safely destroys cpe. cpe_name

Parameters:
cpe CPE to be deleted

char* cpe_name_get_as_format ( const struct cpe_name cpe,
cpe_format_t  format 
)

Return CPE URI as a new string in specified format.

cpe_name

Note:
Returned string is newly allocated and is caller's responsibility to free it.
Parameters:
cpe CPE to be converted
format Which format should the string be in
Returns:
CPE URI as string
Return values:
NULL on failure

char* cpe_name_get_as_str ( const struct cpe_name cpe  ) 

Return CPE URI as a new string in the format in which it was loaded.

cpe_name

Note:
Returned string is newly allocated and is caller's responsibility to free it.
Parameters:
cpe CPE to be converted
Returns:
CPE URI as string
Return values:
NULL on failure

const char* cpe_name_get_edition ( const struct cpe_name cpe  ) 

Get CPE name edition field.

cpe_name

cpe_format_t cpe_name_get_format_of_str ( const char *  str  ) 

Looks at given string and returns format it is in.

CPE_FORMAT_UNKNOWN is used in case of errors

const char* cpe_name_get_language ( const struct cpe_name cpe  ) 

Get CPE name language field.

cpe_name

const char* cpe_name_get_other ( const struct cpe_name cpe  ) 

Get CPE name other field.

cpe_name

cpe_part_t cpe_name_get_part ( const struct cpe_name cpe  ) 

Get CPE name part type field.

cpe_name

const char* cpe_name_get_product ( const struct cpe_name cpe  ) 

Get CPE name product field.

cpe_name

const char* cpe_name_get_sw_edition ( const struct cpe_name cpe  ) 

Get CPE name sw_edition field.

cpe_name

const char* cpe_name_get_target_hw ( const struct cpe_name cpe  ) 

Get CPE name target_hw field.

cpe_name

const char* cpe_name_get_target_sw ( const struct cpe_name cpe  ) 

Get CPE name target_sw field.

cpe_name

const char* cpe_name_get_update ( const struct cpe_name cpe  ) 

Get CPE name update field.

cpe_name

const char* cpe_name_get_vendor ( const struct cpe_name cpe  ) 

Get CPE name vendor field.

cpe_name

const char* cpe_name_get_version ( const struct cpe_name cpe  ) 

Get CPE name version field.

cpe_name

bool cpe_name_match_cpes ( const struct cpe_name name,
size_t  n,
struct cpe_name **  namelist 
)

Check if CPE name matches any CPE in namelist.

cpe_name

Parameters:
name name to be looked-up
n number of items in namelist
namelist list of names to search in
Returns:
true if name was found within namelist

bool cpe_name_match_one ( const struct cpe_name cpe,
const struct cpe_name against 
)

Check if candidate CPE cpe matches CPE against according to CPE specification v 2.1.

cpe_name

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.

cpe_name

Parameters:
candidate candidarte CPE URI as string
n number of items in targets
targets list of CPE URIs to be candidate matched against
Returns:
index of first URI in targets, that matched
Return values:
-1 on mismatch
-2 invalid CPE URI was given as parameter

struct cpe_name* cpe_name_new ( const char *  cpe  )  [read]

Create a new CPE structure from string cpe.

cpe_name

Note:
If cpe is NULL, empty cpe will be created.
Parameters:
cpe CPE URI string to be parsed
Returns:
new structure holding parsed data
Return values:
NULL on failure

bool cpe_name_set_edition ( struct cpe_name cpe,
const char *  newval 
)

Set CPE name edition field.

cpe_name

bool cpe_name_set_language ( struct cpe_name cpe,
const char *  newval 
)

Set CPE name language field.

cpe_name

bool cpe_name_set_other ( struct cpe_name cpe,
const char *  newval 
)

Set CPE name other field.

cpe_name

bool cpe_name_set_part ( struct cpe_name cpe,
cpe_part_t  newval 
)

Set CPE name part type field.

cpe_name

bool cpe_name_set_product ( struct cpe_name cpe,
const char *  newval 
)

Set CPE name product field.

cpe_name

bool cpe_name_set_sw_edition ( struct cpe_name cpe,
const char *  newval 
)

Set CPE name sw_edition field.

cpe_name

bool cpe_name_set_target_hw ( struct cpe_name cpe,
const char *  newval 
)

Set CPE name target_hw field.

cpe_name

bool cpe_name_set_target_sw ( struct cpe_name cpe,
const char *  newval 
)

Set CPE name target_sw field.

cpe_name

bool cpe_name_set_update ( struct cpe_name cpe,
const char *  newval 
)

Set CPE name update field.

cpe_name

bool cpe_name_set_vendor ( struct cpe_name cpe,
const char *  newval 
)

Set CPE name vendor field.

cpe_name

bool cpe_name_set_version ( struct cpe_name cpe,
const char *  newval 
)

Set CPE name version field.

cpe_name

const char* cpe_name_supported ( void   ) 

Get supported version of CPE uri XML.

Returns:
version of XML file format cpe_name

int cpe_name_write ( const struct cpe_name cpe,
FILE *  f 
)

Write CPE URI cpe to file a descriptor f cpe_name.

Parameters:
cpe cpe to write
f file descriptor to write CPE URI to
Returns:
number of written characters
Return values:
<0 on failure


Generated on Tue Nov 14 12:19:00 2017 for Open SCAP Library by  doxygen 1.5.6