This file contains functions for manipulating with the S-exp representation of OVAL objects and items. More...
Data Structures | |
struct | _oresults |
Files | |
file | probe-api.c |
Probe API implmentation. | |
Defines | |
#define | probe_item_getent(item, name, n) probe_obj_getent (item, name, n) |
#define | PROBE_EINVAL 1 |
Invalid type/value/format. | |
#define | PROBE_ENOELM 2 |
Missing element OBSOLETE: use ENOENT. | |
#define | PROBE_ENOVAL 3 |
Missing value. | |
#define | PROBE_ENOATTR 4 |
Missing attribute. | |
#define | PROBE_EINIT 5 |
Initialization failed. | |
#define | PROBE_ENOMEM 6 |
No memory. | |
#define | PROBE_EOPNOTSUPP 7 |
Not supported. | |
#define | PROBE_ERANGE 8 |
Out of range. | |
#define | PROBE_EDOM 9 |
Out of domain. | |
#define | PROBE_EFAULT 10 |
Memory fault/NULL value. | |
#define | PROBE_EACCES 11 |
Operation not perimitted. | |
#define | PROBE_ESETEVAL 12 |
Set evaluation failed. | |
#define | PROBE_ENOENT 13 |
Missing entity. | |
#define | PROBE_EFATAL 254 |
Unrecoverable error. | |
#define | PROBE_EUNKNOWN 255 |
Unknown/Unexpected error. | |
#define | OVAL_STATUS_UNKNOWN SYSCHAR_STATUS_UNKNOWN |
#define | OVAL_STATUS_ERROR SYSCHAR_STATUS_ERROR |
#define | OVAL_STATUS_EXISTS SYSCHAR_STATUS_EXISTS |
#define | OVAL_STATUS_DOESNOTEXIST SYSCHAR_STATUS_DOES_NOT_EXIST |
#define | OVAL_STATUS_NOTCOLLECTED SYSCHAR_STATUS_NOT_COLLECTED |
#define | PROBECMD_STE_FETCH 1 |
State fetch command code. | |
#define | PROBECMD_OBJ_EVAL 2 |
Object eval command code. | |
#define | PROBECMD_RESET 3 |
Reset command code. | |
Functions | |
SEXP_t * | probe_item_creat (const char *name, SEXP_t *attrs,...) |
Create a new item consisting of a name, optional attributes argument and an arbitrary number of entities. | |
SEXP_t * | probe_item_new (const char *name, SEXP_t *attrs) |
Create a new item with just a name and optional attributes argument. | |
SEXP_t * | probe_item_attr_add (SEXP_t *item, const char *name, SEXP_t *val) |
Add a new attribute to an item. | |
SEXP_t * | probe_item_ent_add (SEXP_t *item, const char *name, SEXP_t *attrs, SEXP_t *val) |
Add a new entity to an item. | |
int | probe_item_setstatus (SEXP_t *obj, oval_syschar_status_t status) |
Set item's status. | |
int | probe_itement_setstatus (SEXP_t *obj, const char *name, uint32_t n, oval_syschar_status_t status) |
Set status of an item's entity. | |
SEXP_t * | probe_item_newid (struct id_desc_t *id_desc) |
Get a new unique id (within a probe) for an item. | |
void | probe_item_resetidctr (struct id_desc_t *id_desc) |
Reset the item id generator. | |
SEXP_t * | probe_attr_creat (const char *name, const SEXP_t *val,...) |
Create a new list of attributes. | |
SEXP_t * | probe_obj_creat (const char *name, SEXP_t *attrs,...) |
Create a new object consisting of a name, optional attributes argument and an arbitrary number of entities. | |
SEXP_t * | probe_obj_new (const char *name, SEXP_t *attrs) |
Create a new object with just a name and optional attributes argument. | |
SEXP_t * | probe_obj_getent (const SEXP_t *obj, const char *name, uint32_t n) |
Get an entity from an object. | |
SEXP_t * | probe_obj_getentval (const SEXP_t *obj, const char *name, uint32_t n) |
Get the value of an object's entity. | |
int | probe_obj_getentvals (const SEXP_t *obj, const char *name, uint32_t n, SEXP_t **res) |
Get the list of values of an object's entity. | |
SEXP_t * | probe_obj_getattrval (const SEXP_t *obj, const char *name) |
Get the value of an object's attribute. | |
bool | probe_obj_attrexists (const SEXP_t *obj, const char *name) |
Check whether the specified attribute exists. | |
int | probe_obj_setstatus (SEXP_t *obj, oval_syschar_status_t status) |
Set objects's status. | |
char * | probe_obj_getname (const SEXP_t *obj) |
Get the name of an object. | |
size_t | probe_obj_getname_r (const SEXP_t *obj, char *buffer, size_t buflen) |
Get the name of an object. | |
SEXP_t * | _probe_cobj_new (oval_syschar_collection_flag_t flag, const SEXP_t *item_list) |
SEXP_t * | _probe_cobj_get_items (const SEXP_t *cobj) |
oval_syschar_collection_flag_t | _probe_cobj_get_flag (const SEXP_t *cobj) |
oval_syschar_collection_flag_t | _probe_cobj_combine_flags (oval_syschar_collection_flag_t f1, oval_syschar_collection_flag_t f2, oval_setobject_operation_t op) |
SEXP_t * | probe_ent_creat (const char *name, SEXP_t *attrs, SEXP_t *val,...) |
Create a new list of entities. | |
SEXP_t * | probe_ent_creat1 (const char *name, SEXP_t *attrs, SEXP_t *val) |
Create a new entity. | |
SEXP_t * | probe_ent_attr_add (SEXP_t *ent, const char *name, SEXP_t *val) |
Add a new attribute to an entity. | |
int | probe_ent_getvals (const SEXP_t *ent, SEXP_t **res) |
Get the list of values of an entity. | |
SEXP_t * | probe_ent_getval (const SEXP_t *ent) |
Get the value of an entity. | |
SEXP_t * | probe_ent_getattrval (const SEXP_t *ent, const char *name) |
Get the value of an entity's attribute. | |
bool | probe_ent_attrexists (const SEXP_t *ent, const char *name) |
Check whether the specified attribute exists. | |
int | probe_ent_setdatatype (SEXP_t *ent, oval_datatype_t type) |
Set the OVAL data type of an entity. | |
oval_datatype_t | probe_ent_getdatatype (const SEXP_t *ent) |
Get the OVAL data type of an entity. | |
int | probe_ent_setmask (SEXP_t *ent, bool mask) |
Set entity's mask. | |
bool | probe_ent_getmask (const SEXP_t *ent) |
Get entity's mask. | |
int | probe_ent_setstatus (SEXP_t *ent, oval_syschar_status_t status) |
Set entity's status. | |
oval_syschar_status_t | probe_ent_getstatus (const SEXP_t *ent) |
Get entity status. | |
char * | probe_ent_getname (const SEXP_t *ent) |
Get the name of an entity. | |
size_t | probe_ent_getname_r (const SEXP_t *ent, char *buffer, size_t buflen) |
Get the name of an entity. | |
void | probe_free (SEXP_t *obj) |
Free the memory allocated by the probe_* functions. | |
oval_result_t | probe_ent_cmp_binary (SEXP_t *val1, SEXP_t *val2, oval_operation_t op) |
Compare two binary values. | |
oval_result_t | probe_ent_cmp_bool (SEXP_t *val1, SEXP_t *val2, oval_operation_t op) |
Compare two boolean values. | |
oval_result_t | probe_ent_cmp_evr (SEXP_t *val1, SEXP_t *val2, oval_operation_t op) |
Compare two epoch-version-release values. | |
oval_result_t | probe_ent_cmp_filesetrev (SEXP_t *val1, SEXP_t *val2, oval_operation_t op) |
Compare two values. | |
oval_result_t | probe_ent_cmp_float (SEXP_t *val1, SEXP_t *val2, oval_operation_t op) |
Compare two floating point values. | |
oval_result_t | probe_ent_cmp_int (SEXP_t *val1, SEXP_t *val2, oval_operation_t op) |
Compare two integer values. | |
oval_result_t | probe_ent_cmp_ios (SEXP_t *val1, SEXP_t *val2, oval_operation_t op) |
Compare two ios values. | |
oval_result_t | probe_ent_cmp_version (SEXP_t *val1, SEXP_t *val2, oval_operation_t op) |
Compare two version values. | |
oval_result_t | probe_ent_cmp_string (SEXP_t *val1, SEXP_t *val2, oval_operation_t op) |
Compare two string values. | |
oval_result_t | probe_entste_cmp (SEXP_t *ent_ste, SEXP_t *ent_itm) |
Compare state entity's content with a item entity's value. | |
oval_result_t | probe_entobj_cmp (SEXP_t *ent_obj, SEXP_t *val) |
Compare object entity's content with a value. | |
oval_result_t | probe_ent_result_bychk (SEXP_t *res_lst, oval_check_t check) |
Compute the overall result. | |
oval_result_t | probe_ent_result_byopr (SEXP_t *res_lst, oval_operator_t operator) |
Compute the overall result. | |
SEXP_t * | probe_item_build (const char *fmt,...) |
Build a new item according to the scpecified format. | |
SEXP_t * | probe_obj_build (const char *fmt,...) |
Build a new object according to the scpecified format. | |
int | probe_objent_setstatus (SEXP_t *obj, const char *name, uint32_t n, oval_syschar_status_t status) |
Set status of an object's entity. | |
void * | probe_init (void) __attribute__((unused)) |
Dummy probe_fini function. | |
void | probe_fini (void *) __attribute__((unused)) |
Dummy probe_fini function. | |
SEXP_t * | probe_main (SEXP_t *, int *, void *) __attribute__((nonnull(1 |
This file contains functions for manipulating with the S-exp representation of OVAL objects and items.
Currently object and items have the same structure and the API distinction is just formal. However, the structure can diverge in the future and the API functions for manipulating with items should be used only with items and vice versa. The most recent description of the object and item structure can be found in this file and should be used as the main source of information for implementing new API functions. In the following text, the term `element' referers to the general structure which is used to represent the various components of an OVAL document, particularly the OVAL objects, items and entities.
The basic structure of an element looks like this:
(foo_object bar)
foo_object is the element name and bar is the value of the element. There can be 0 to n values. In case the element has some attributes set the structure changes to:
((foo_object :attr1 val1) bar)
where attr1 is the name of the attribute and val1 is the attribute's value. The colon in the attribute name signals that the attribute has a value.
Create a new list of attributes.
This function increments its val argument's reference count.
name | the name of the attribute | |
val | the value of the attribute | |
... | there can be an arbitrary number of name - value pairs |
Add a new attribute to an entity.
This function increments its val argument's reference count.
ent | the entity to be modified | |
name | name of the new attribute | |
val | value of the new attribute |
bool probe_ent_attrexists | ( | const SEXP_t * | ent, | |
const char * | name | |||
) |
Check whether the specified attribute exists.
ent | the queried entity | |
name | the name of the attribute |
oval_result_t probe_ent_cmp_binary | ( | SEXP_t * | val1, | |
SEXP_t * | val2, | |||
oval_operation_t | op | |||
) |
Compare two binary values.
The operation to use is specified by the operation enumeration value.
val1 | the first value | |
val2 | the second value | |
op | the desired operation |
oval_result_t probe_ent_cmp_bool | ( | SEXP_t * | val1, | |
SEXP_t * | val2, | |||
oval_operation_t | op | |||
) |
Compare two boolean values.
The operation to use is specified by the operation enumeration value.
val1 | the first value | |
val2 | the second value | |
op | the desired operation |
oval_result_t probe_ent_cmp_evr | ( | SEXP_t * | val1, | |
SEXP_t * | val2, | |||
oval_operation_t | op | |||
) |
Compare two epoch-version-release values.
The operation to use is specified by the operation enumeration value.
val1 | the first value | |
val2 | the second value | |
op | the desired operation |
oval_result_t probe_ent_cmp_filesetrev | ( | SEXP_t * | val1, | |
SEXP_t * | val2, | |||
oval_operation_t | op | |||
) |
Compare two values.
The operation to use is specified by the operation enumeration value.
val1 | the first value | |
val2 | the second value | |
op | the desired operation |
oval_result_t probe_ent_cmp_float | ( | SEXP_t * | val1, | |
SEXP_t * | val2, | |||
oval_operation_t | op | |||
) |
Compare two floating point values.
The operation to use is specified by the operation enumeration value.
val1 | the first value | |
val2 | the second value | |
op | the desired operation |
oval_result_t probe_ent_cmp_int | ( | SEXP_t * | val1, | |
SEXP_t * | val2, | |||
oval_operation_t | op | |||
) |
Compare two integer values.
The operation to use is specified by the operation enumeration value.
val1 | the first value | |
val2 | the second value | |
op | the desired operation |
oval_result_t probe_ent_cmp_ios | ( | SEXP_t * | val1, | |
SEXP_t * | val2, | |||
oval_operation_t | op | |||
) |
Compare two ios values.
The operation to use is specified by the operation enumeration value.
val1 | the first value | |
val2 | the second value | |
op | the desired operation |
oval_result_t probe_ent_cmp_string | ( | SEXP_t * | val1, | |
SEXP_t * | val2, | |||
oval_operation_t | op | |||
) |
Compare two string values.
The operation to use is specified by the operation enumeration value.
val1 | the first value | |
val2 | the second value | |
op | the desired operation |
oval_result_t probe_ent_cmp_version | ( | SEXP_t * | val1, | |
SEXP_t * | val2, | |||
oval_operation_t | op | |||
) |
Compare two version values.
The operation to use is specified by the operation enumeration value.
val1 | the first value | |
val2 | the second value | |
op | the desired operation |
Create a new list of entities.
This function increments its SEXP_t arguments' reference count.
name | the name of the entity | |
attrs | optional entity's attributes argument | |
val | the value of the entity | |
... | there can be an arbitrary number of name - attributes - value triples |
Create a new entity.
This function increments its SEXP_t arguments' reference count.
name | the name of the entity | |
attrs | optional entity's attributes argument | |
val | the value of the entity |
Get the value of an entity's attribute.
ent | the queried entity | |
name | the name of the attribute |
oval_datatype_t probe_ent_getdatatype | ( | const SEXP_t * | ent | ) |
Get the OVAL data type of an entity.
ent | the queried entity |
bool probe_ent_getmask | ( | const SEXP_t * | ent | ) |
Get entity's mask.
ent | the queried entity |
char * probe_ent_getname | ( | const SEXP_t * | ent | ) |
Get the name of an entity.
ent | the queried entity |
size_t probe_ent_getname_r | ( | const SEXP_t * | ent, | |
char * | buffer, | |||
size_t | buflen | |||
) |
Get the name of an entity.
The name is stored in the provided buffer.
ent | the queried entity | |
buffer | the buffer to store the name in | |
buflen | the length of the buffer |
oval_syschar_status_t probe_ent_getstatus | ( | const SEXP_t * | ent | ) |
Get entity status.
ent | the queried entity |
Get the value of an entity.
The function respects the var_ref attribute and returns the currently selected value.
ent | the queried entity |
Get the list of values of an entity.
If the entity uses var_ref, there can be more than one value.
ent | the queried entity | |
res | the resulting value list is stored in this argument |
oval_result_t probe_ent_result_bychk | ( | SEXP_t * | res_lst, | |
oval_check_t | check | |||
) |
Compute the overall result.
Compute the overall result from a results vector and a check enumeration parameter.
res_lst | the results vector | |
check | the check enumeration value |
oval_result_t probe_ent_result_byopr | ( | SEXP_t * | res_lst, | |
oval_operator_t | operator | |||
) |
Compute the overall result.
Compute the overall result from a results vector and a operator enumeration parameter.
res_lst | the results vector | |
check | the operator enumeration value |
int probe_ent_setdatatype | ( | SEXP_t * | ent, | |
oval_datatype_t | type | |||
) |
Set the OVAL data type of an entity.
ent | the queried entity | |
type | the new data type |
int probe_ent_setmask | ( | SEXP_t * | ent, | |
bool | mask | |||
) |
Set entity's mask.
ent | the queried entity the new mask |
int probe_ent_setstatus | ( | SEXP_t * | ent, | |
oval_syschar_status_t | status | |||
) |
Set entity's status.
ent | the entity to be modified | |
status | the new status |
oval_result_t probe_entobj_cmp | ( | SEXP_t * | ent_obj, | |
SEXP_t * | val | |||
) |
Compare object entity's content with a value.
The result depends on the operation attribute and a possible var_check attribute.
ent_obj | object entity | |
val | raw value |
oval_result_t probe_entste_cmp | ( | SEXP_t * | ent_ste, | |
SEXP_t * | ent_itm | |||
) |
Compare state entity's content with a item entity's value.
The result depends on the operation attribute, a possible var_check attribute and item entity's status.
ent_ste | state entity | |
ent_itm | item entity |
void probe_free | ( | SEXP_t * | obj | ) |
Free the memory allocated by the probe_* functions.
obj | the object to be freed |
Add a new attribute to an item.
This function increments its val argument's reference count.
item | the item to be modified | |
name | name of the new attribute | |
val | value of the new attribute |
SEXP_t* probe_item_build | ( | const char * | fmt, | |
... | ||||
) |
Build a new item according to the scpecified format.
fmt | the desired format |
Create a new item consisting of a name, optional attributes argument and an arbitrary number of entities.
Every entity is a triple: const char *name - name of the new entity SEXP_t attrs - optional list of entity attributes in a sexp, can be NULL SEXP_t val - value of the new entity in a sexp This function increments its SEXP_t arguments' reference count.
name | mandatory name argument | |
attrs | optional item's attributes argument | |
... | arbitrary number of entity arguments |
Add a new entity to an item.
This function increments its attrs and val arguments' reference count.
item | the item to be modified | |
name | name of the new entity | |
attrs | optional attributes of the new entity | |
val | value of the new entity |
Create a new item with just a name and optional attributes argument.
name | item's name | |
attrs | optional attributes argument |
Get a new unique id (within a probe) for an item.
id_desc | pointer to a structure holding the global id context |
void probe_item_resetidctr | ( | struct id_desc_t * | id_desc | ) |
Reset the item id generator.
id_desc | pointer to a structure holding the global id context |
int probe_item_setstatus | ( | SEXP_t * | obj, | |
oval_syschar_status_t | status | |||
) |
Set item's status.
obj | the item to be modified | |
status | the new status |
int probe_itement_setstatus | ( | SEXP_t * | obj, | |
const char * | name, | |||
uint32_t | n, | |||
oval_syschar_status_t | status | |||
) |
Set status of an item's entity.
obj | the item to be modified | |
name | the name of the entity | |
n | select the n-th occurence of an entity with the specified name | |
status | the new status |
bool probe_obj_attrexists | ( | const SEXP_t * | obj, | |
const char * | name | |||
) |
Check whether the specified attribute exists.
obj | the queried object | |
name | the name of the attribute |
SEXP_t* probe_obj_build | ( | const char * | fmt, | |
... | ||||
) |
Build a new object according to the scpecified format.
fmt | the desired format |
Create a new object consisting of a name, optional attributes argument and an arbitrary number of entities.
Every entity is a triple: const char *name - name of the new entity SEXP_t attrs - optional list of entity attributes in a sexp, can be NULL SEXP_t val - value of the new entity in a sexp This function increments its SEXP_t arguments' reference count.
name | mandatory name argument | |
attrs | optional object's attributes argument | |
... | arbitrary number of entity arguments |
Get the value of an object's attribute.
obj | the queried object | |
name | the name of the attribute |
Get an entity from an object.
obj | the queried object | |
name | the name of the entity | |
n | select the n-th occurence of an entity with the specified name |
Get the value of an object's entity.
The function respects the var_ref attribute and returns the currently selected value.
obj | the queried object | |
name | the name of the entity | |
n | select the n-th occurence of an entity with the specified name |
Get the list of values of an object's entity.
If the entity uses var_ref, there can be more than one value.
obj | the queried object | |
name | the name of the entity | |
n | select the n-th occurence of an entity with the specified name | |
res | the resulting value list is stored in this argument |
char * probe_obj_getname | ( | const SEXP_t * | obj | ) |
Get the name of an object.
obj | the queried object |
size_t probe_obj_getname_r | ( | const SEXP_t * | obj, | |
char * | buffer, | |||
size_t | buflen | |||
) |
Get the name of an object.
The name is stored in the provided buffer.
obj | the queried object | |
buffer | the buffer to store the name in | |
buflen | the length of the buffer |
Create a new object with just a name and optional attributes argument.
This function increments its SEXP_t argument's reference count.
name | object's name | |
attrs | optional attributes argument |
int probe_obj_setstatus | ( | SEXP_t * | obj, | |
oval_syschar_status_t | status | |||
) |
Set objects's status.
obj | the object to be modified | |
status | the new status |
int probe_objent_setstatus | ( | SEXP_t * | obj, | |
const char * | name, | |||
uint32_t | n, | |||
oval_syschar_status_t | status | |||
) |
Set status of an object's entity.
obj | the object to be modified | |
name | the name of the entity | |
n | select the n-th occurence of an entity with the specified name | |
status | the new status |