Open SCAP Library
Loading...
Searching...
No Matches
Files | Data Structures | Macros | Typedefs | Functions
PROBEAPI

Files

file  probe-api.c
 Probe API implmentation.
 

Data Structures

struct  _oresults
 
struct  probe_elmatr_t
 

Macros

#define PROBE_API_H
 
#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_EACCESS   11
 Operation not permitted.
 
#define PROBE_ESETEVAL   12
 Set evaluation failed.
 
#define PROBE_ENOENT   13
 Missing entity.
 
#define PROBE_ENOOBJ   14
 Missing object.
 
#define PROBE_ECONNABORTED   15
 Evaluation aborted.
 
#define PROBE_ESYSTEM   253
 System call failure.
 
#define PROBE_EFATAL   254
 Unrecoverable error.
 
#define PROBE_EUNKNOWN   255
 Unknown/Unexpected error.
 
#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.
 
#define PROBE_ENT_AREF(ent, dst, attr_name, invalid_exp)
 
#define PROBE_ENT_STRVAL(ent, dst, dstlen, invalid_exp, zerolen_exp)
 
#define PROBE_ENT_I32VAL(ent, dst, invalid_exp, nil_exp)
 

Typedefs

typedef struct probe_ctx probe_ctx
 

Functions

probe_rcache_tOSCAP_GSYM (pcache)
 
probe_ncache_tOSCAP_GSYM (ncache)
 
struct id_desc_t OSCAP_GSYM (id_desc)
 
probe_option_tOSCAP_GSYM (probe_optdef)
 
size_t OSCAP_GSYM (probe_optdef_count)
 
SEXP_tprobe_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_tprobe_item_new (const char *name, SEXP_t *attrs)
 Create a new item with just a name and optional attributes argument.
 
SEXP_tprobe_item_attr_add (SEXP_t *item, const char *name, SEXP_t *val)
 Add a new attribute to an item.
 
SEXP_tprobe_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.
 
void probe_item_resetidctr (struct id_desc_t *id_desc)
 Reset the item id generator.
 
bool probe_item_filtered (const SEXP_t *item, const SEXP_t *filters)
 
SEXP_tprobe_attr_creat (const char *name, const SEXP_t *val,...)
 Create a new list of attributes.
 
SEXP_tprobe_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_tprobe_obj_new (const char *name, SEXP_t *attrs)
 Create a new object with just a name and optional attributes argument.
 
SEXP_tprobe_obj_getent (const SEXP_t *obj, const char *name, uint32_t n)
 Get an entity from an object.
 
SEXP_tprobe_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.
 
oval_schema_version_t probe_obj_get_platform_schema_version (const SEXP_t *obj)
 
SEXP_tprobe_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_tprobe_cobj_new (oval_syschar_collection_flag_t flag, SEXP_t *msg_list, SEXP_t *item_list, SEXP_t *mask_list)
 
int probe_cobj_add_msg (SEXP_t *cobj, const SEXP_t *msg)
 
SEXP_tprobe_cobj_get_msgs (const SEXP_t *cobj)
 
SEXP_tprobe_cobj_get_mask (const SEXP_t *cobj)
 
int probe_cobj_add_item (SEXP_t *cobj, const SEXP_t *item)
 
SEXP_tprobe_cobj_get_items (const SEXP_t *cobj)
 
void probe_cobj_set_flag (SEXP_t *cobj, oval_syschar_collection_flag_t flag)
 
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)
 
oval_syschar_collection_flag_t probe_cobj_compute_flag (SEXP_t *cobj)
 
SEXP_tprobe_msg_creat (oval_message_level_t level, char *message)
 Create a new message that can be added to a collected object.
 
SEXP_tprobe_msg_creatf (oval_message_level_t level, const char *fmt,...) __attribute__((format(printf
 Create a new message that can be added to a collected object.
 
SEXP_tprobe_ent_creat (const char *name, SEXP_t *attrs, SEXP_t *val,...)
 Create a new list of entities.
 
SEXP_tprobe_ent_creat1 (const char *name, SEXP_t *attrs, SEXP_t *val)
 Create a new entity.
 
SEXP_tprobe_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_tprobe_ent_getval (const SEXP_t *ent)
 Get the value of an entity.
 
SEXP_tprobe_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.
 
void probe_filebehaviors_canonicalize (SEXP_t **behaviors)
 Set all of the missing attributes of the 'behaviors' entity to default values.
 
void probe_tfc54behaviors_canonicalize (SEXP_t **behaviors)
 Set all of the missing attributes of the 'behaviors' entity to default values.
 
SEXP_tprobe_item_create (oval_subtype_t item_subtype, probe_elmatr_t *item_attributes[],...)
 The order of (value_name, value_type, *value) argument tuples passed as e.g.
 
oval_operation_t probe_ent_getoperation (SEXP_t *entity, oval_operation_t default_op)
 
int probe_item_add_msg (SEXP_t *item, oval_message_level_t msglvl, char *msgfmt,...)
 
SEXP_tprobe_entval_from_cstr (oval_datatype_t type, const char *value, size_t vallen)
 
SEXP_tprobe_ent_from_cstr (const char *name, oval_datatype_t type, const char *value, size_t vallen)
 
SEXP_tprobe_obj_getmask (SEXP_t *obj)
 Get object entity mask.
 
bool probe_path_is_blocked (const char *path, struct oscap_list *blocked_paths)
 Check if the given path matches any of the paths in the blocked paths list.
 
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_debian_evr (SEXP_t *val1, SEXP_t *val2, oval_operation_t op)
 Compare two Debian 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.
 
OSCAP_API SEXP_t nonnull (2)))
 
OSCAP_API int probe_item_collect (probe_ctx *ctx, SEXP_t *item)
 Collect generated item (i.e.
 
OSCAP_API SEXP_tprobe_ctx_getobject (probe_ctx *ctx)
 Return reference to the input object.
 
OSCAP_API SEXP_tprobe_ctx_getresult (probe_ctx *ctx)
 Return reference to the output object (aka collected object).
 

Detailed Description

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.

structure

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.

Macro Definition Documentation

◆ PROBE_ENT_AREF

#define PROBE_ENT_AREF ( ent,
dst,
attr_name,
invalid_exp )
Value:
do { \
if (((dst) = probe_ent_getattrval(ent, attr_name)) == NULL) { \
dE("Attribute `%s' is missing!", attr_name); \
invalid_exp \
} \
} while(0)
SEXP_t * probe_ent_getattrval(const SEXP_t *ent, const char *name)
Get the value of an entity's attribute.
Definition probe-api.c:1074

◆ PROBE_ENT_I32VAL

#define PROBE_ENT_I32VAL ( ent,
dst,
invalid_exp,
nil_exp )
Value:
do { \
SEXP_t *___r; \
\
if ((___r = probe_ent_getval(ent)) == NULL) { \
nil_exp; \
} else { \
if (!SEXP_numberp(___r)) { \
SEXP_free(___r); \
invalid_exp; \
} else { \
dst = SEXP_number_geti_32(___r); \
SEXP_free(___r); \
} \
} \
} while (0)
SEXP_t * probe_ent_getval(const SEXP_t *ent)
Get the value of an entity.
Definition probe-api.c:1049
OSCAP_API bool SEXP_numberp(const SEXP_t *s_exp)
Check whether the provided sexp object is a number.
Definition sexp-manip.c:562
OSCAP_API int32_t SEXP_number_geti_32(const SEXP_t *s_exp)
Get integer value from a sexp object.
Definition sexp-manip.c:266
Definition sexp-types.h:82

◆ PROBE_ENT_STRVAL

#define PROBE_ENT_STRVAL ( ent,
dst,
dstlen,
invalid_exp,
zerolen_exp )
Value:
do { \
SEXP_t *___r; \
\
if ((___r = probe_ent_getval(ent)) == NULL) { \
invalid_exp \
} else { \
if (!SEXP_stringp(___r)) { \
SEXP_free(___r); \
invalid_exp \
} \
else if (SEXP_string_length(___r) == 0) { \
SEXP_free(___r); \
zerolen_exp \
} else { \
SEXP_string_cstr_r(___r, dst, dstlen); \
SEXP_free(___r); \
} \
} \
} while (0)
OSCAP_API size_t SEXP_string_length(const SEXP_t *s_exp)
Get the length of a string in a sexp object.
Definition sexp-manip.c:641
OSCAP_API bool SEXP_stringp(const SEXP_t *s_exp)
Check whether the provided sexp object is a string.
Definition sexp-manip.c:629

Function Documentation

◆ probe_attr_creat()

OSCAP_API SEXP_t * probe_attr_creat ( const char * name,
const SEXP_t * val,
... )

Create a new list of attributes.

This function increments its val argument's reference count.

Parameters
namethe name of the attribute
valthe value of the attribute
...there can be an arbitrary number of name - value pairs

◆ probe_ctx_getobject()

OSCAP_API SEXP_t * probe_ctx_getobject ( probe_ctx * ctx)

Return reference to the input object.

The reference counter is NOT incremented by this operation (i.e. don't call SEXP_free on the return value of this function). Implementation of this function is placed in the ‘’ file.

◆ probe_ctx_getresult()

OSCAP_API SEXP_t * probe_ctx_getresult ( probe_ctx * ctx)

Return reference to the output object (aka collected object).

Reference counter is NOT incremented (see the description of probe_ctx_getobject above).

◆ probe_ent_attr_add()

OSCAP_API SEXP_t * probe_ent_attr_add ( SEXP_t * ent,
const char * name,
SEXP_t * val )

Add a new attribute to an entity.

This function increments its val argument's reference count.

Parameters
entthe entity to be modified
namename of the new attribute
valvalue of the new attribute

◆ probe_ent_attrexists()

OSCAP_API bool probe_ent_attrexists ( const SEXP_t * ent,
const char * name )

Check whether the specified attribute exists.

Parameters
entthe queried entity
namethe name of the attribute

◆ probe_ent_cmp_binary()

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.

Parameters
val1the first value
val2the second value
opthe desired operation

◆ probe_ent_cmp_bool()

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.

Parameters
val1the first value
val2the second value
opthe desired operation

◆ probe_ent_cmp_debian_evr()

oval_result_t probe_ent_cmp_debian_evr ( SEXP_t * val1,
SEXP_t * val2,
oval_operation_t op )

Compare two Debian epoch-version-release values.

The operation to use is specified by the operation enumeration value.

Parameters
val1the first value
val2the second value
opthe desired operation

◆ probe_ent_cmp_evr()

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.

Parameters
val1the first value
val2the second value
opthe desired operation

◆ probe_ent_cmp_filesetrev()

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.

Parameters
val1the first value
val2the second value
opthe desired operation

◆ probe_ent_cmp_float()

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.

Parameters
val1the first value
val2the second value
opthe desired operation

◆ probe_ent_cmp_int()

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.

Parameters
val1the first value
val2the second value
opthe desired operation

◆ probe_ent_cmp_ios()

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.

Parameters
val1the first value
val2the second value
opthe desired operation

◆ probe_ent_cmp_string()

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.

Parameters
val1the first value
val2the second value
opthe desired operation

◆ probe_ent_cmp_version()

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.

Parameters
val1the first value
val2the second value
opthe desired operation

◆ probe_ent_creat()

OSCAP_API SEXP_t * probe_ent_creat ( const char * name,
SEXP_t * attrs,
SEXP_t * val,
... )

Create a new list of entities.

This function increments its SEXP_t arguments' reference count.

Parameters
namethe name of the entity
attrsoptional entity's attributes argument
valthe value of the entity
...there can be an arbitrary number of name - attributes - value triples

◆ probe_ent_creat1()

OSCAP_API SEXP_t * probe_ent_creat1 ( const char * name,
SEXP_t * attrs,
SEXP_t * val )

Create a new entity.

This function increments its SEXP_t arguments' reference count.

Parameters
namethe name of the entity
attrsoptional entity's attributes argument
valthe value of the entity

◆ probe_ent_getattrval()

OSCAP_API SEXP_t * probe_ent_getattrval ( const SEXP_t * ent,
const char * name )

Get the value of an entity's attribute.

Parameters
entthe queried entity
namethe name of the attribute

◆ probe_ent_getdatatype()

OSCAP_API oval_datatype_t probe_ent_getdatatype ( const SEXP_t * ent)

Get the OVAL data type of an entity.

Parameters
entthe queried entity

◆ probe_ent_getmask()

OSCAP_API bool probe_ent_getmask ( const SEXP_t * ent)

Get entity's mask.

Parameters
entthe queried entity

◆ probe_ent_getname()

OSCAP_API char * probe_ent_getname ( const SEXP_t * ent)

Get the name of an entity.

Parameters
entthe queried entity

◆ probe_ent_getname_r()

OSCAP_API 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.

Parameters
entthe queried entity
bufferthe buffer to store the name in
buflenthe length of the buffer

◆ probe_ent_getstatus()

OSCAP_API oval_syschar_status_t probe_ent_getstatus ( const SEXP_t * ent)

Get entity status.

Parameters
entthe queried entity

◆ probe_ent_getval()

OSCAP_API SEXP_t * probe_ent_getval ( const SEXP_t * ent)

Get the value of an entity.

The function respects the var_ref attribute and returns the currently selected value.

Parameters
entthe queried entity

◆ probe_ent_getvals()

OSCAP_API int probe_ent_getvals ( const SEXP_t * ent,
SEXP_t ** res )

Get the list of values of an entity.

If the entity uses var_ref, there can be more than one value.

Parameters
entthe queried entity
resthe resulting value list is stored in this argument
Returns
number of values in the list stored in the res argument

◆ probe_ent_result_bychk()

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.

Parameters
res_lstthe results vector
checkthe check enumeration value

◆ probe_ent_result_byopr()

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.

Parameters
res_lstthe results vector
checkthe operator enumeration value

◆ probe_ent_setdatatype()

OSCAP_API int probe_ent_setdatatype ( SEXP_t * ent,
oval_datatype_t type )

Set the OVAL data type of an entity.

Parameters
entthe queried entity
typethe new data type

◆ probe_ent_setmask()

OSCAP_API int probe_ent_setmask ( SEXP_t * ent,
bool mask )

Set entity's mask.

Parameters
entthe queried entity @mask the new mask

◆ probe_ent_setstatus()

OSCAP_API int probe_ent_setstatus ( SEXP_t * ent,
oval_syschar_status_t status )

Set entity's status.

Parameters
entthe entity to be modified
statusthe new status

◆ probe_entobj_cmp()

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.

Parameters
ent_objobject entity
valraw value

◆ probe_entste_cmp()

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.

Parameters
ent_stestate entity
ent_itmitem entity

◆ probe_filebehaviors_canonicalize()

OSCAP_API void probe_filebehaviors_canonicalize ( SEXP_t ** behaviors)

Set all of the missing attributes of the 'behaviors' entity to default values.

If the referenced pointer contains NULL, a new entity is created and stored in the referenced pointer.

Parameters
behaviorsaddress of the pointer to the 'behaviors' entity, must not be NULL

◆ probe_free()

OSCAP_API void probe_free ( SEXP_t * obj)

Free the memory allocated by the probe_* functions.

Parameters
objthe object to be freed

◆ probe_item_attr_add()

OSCAP_API SEXP_t * probe_item_attr_add ( SEXP_t * item,
const char * name,
SEXP_t * val )

Add a new attribute to an item.

This function increments its val argument's reference count.

Parameters
itemthe item to be modified
namename of the new attribute
valvalue of the new attribute

◆ probe_item_collect()

OSCAP_API int probe_item_collect ( struct probe_ctx * ctx,
SEXP_t * item )

Collect generated item (i.e.

add it to the collected object) The function takes ownership of the item reference and takes care of freeing the item (i.e. don't call SEXP_free(item) after calling this function). The implementation of this function is placed in the ‘probe/icache.c’ file.

Collect generated item (i.e.

Returns: 0 ... the item was succesfully added to the collected object 1 ... the item was filtered out 2 ... the item was not added because of memory constraints and the collected object was flagged as incomplete -1 ... unexpected/internal error

The caller must not free the item, it's freed automatically by this function or by the icache worker thread.

◆ probe_item_creat()

OSCAP_API 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.

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.

Parameters
namemandatory name argument
attrsoptional item's attributes argument
...arbitrary number of entity arguments

◆ probe_item_create()

OSCAP_API SEXP_t * probe_item_create ( oval_subtype_t item_subtype,
probe_elmatr_t * item_attributes[],
... )

The order of (value_name, value_type, *value) argument tuples passed as e.g.

3rd to 5th arguments matters. If you change ordering of those tuples, it will have consequences.

◆ probe_item_ent_add()

OSCAP_API 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.

This function increments its attrs and val arguments' reference count.

Parameters
itemthe item to be modified
namename of the new entity
attrsoptional attributes of the new entity
valvalue of the new entity

◆ probe_item_new()

OSCAP_API SEXP_t * probe_item_new ( const char * name,
SEXP_t * attrs )

Create a new item with just a name and optional attributes argument.

Parameters
nameitem's name
attrsoptional attributes argument

◆ probe_item_resetidctr()

OSCAP_API void probe_item_resetidctr ( struct id_desc_t * id_desc)

Reset the item id generator.

Parameters
id_descpointer to a structure holding the global id context

◆ probe_item_setstatus()

OSCAP_API int probe_item_setstatus ( SEXP_t * obj,
oval_syschar_status_t status )

Set item's status.

Parameters
objthe item to be modified
statusthe new status

◆ probe_itement_setstatus()

OSCAP_API 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.

Parameters
objthe item to be modified
namethe name of the entity
nselect the n-th occurence of an entity with the specified name
statusthe new status

◆ probe_msg_creat()

OSCAP_API SEXP_t * probe_msg_creat ( oval_message_level_t level,
char * message )

Create a new message that can be added to a collected object.

Parameters
levelthe level associated with the new message
messagethe text of the new message

◆ probe_msg_creatf()

OSCAP_API SEXP_t * probe_msg_creatf ( oval_message_level_t level,
const char * fmt,
... )

Create a new message that can be added to a collected object.

Parameters
levelthe level associated with the new message
fmtprintf-like format string that produces the text of the new message
...arguments for the format

◆ probe_obj_attrexists()

OSCAP_API bool probe_obj_attrexists ( const SEXP_t * obj,
const char * name )

Check whether the specified attribute exists.

Parameters
objthe queried object
namethe name of the attribute

◆ probe_obj_creat()

OSCAP_API 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.

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.

Parameters
namemandatory name argument
attrsoptional object's attributes argument
...arbitrary number of entity arguments

◆ probe_obj_getattrval()

OSCAP_API SEXP_t * probe_obj_getattrval ( const SEXP_t * obj,
const char * name )

Get the value of an object's attribute.

Parameters
objthe queried object
namethe name of the attribute

◆ probe_obj_getent()

OSCAP_API SEXP_t * probe_obj_getent ( const SEXP_t * obj,
const char * name,
uint32_t n )

Get an entity from an object.

Parameters
objthe queried object
namethe name of the entity
nselect the n-th occurence of an entity with the specified name

◆ probe_obj_getentval()

OSCAP_API SEXP_t * probe_obj_getentval ( const SEXP_t * obj,
const char * name,
uint32_t n )

Get the value of an object's entity.

The function respects the var_ref attribute and returns the currently selected value.

Parameters
objthe queried object
namethe name of the entity
nselect the n-th occurence of an entity with the specified name

◆ probe_obj_getentvals()

OSCAP_API 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.

If the entity uses var_ref, there can be more than one value.

Parameters
objthe queried object
namethe name of the entity
nselect the n-th occurence of an entity with the specified name
resthe resulting value list is stored in this argument
Returns
number of values in the list stored in the res argument

◆ probe_obj_getmask()

OSCAP_API SEXP_t * probe_obj_getmask ( SEXP_t * obj)

Get object entity mask.

Returns
a list of masked entities

◆ probe_obj_getname()

OSCAP_API char * probe_obj_getname ( const SEXP_t * obj)

Get the name of an object.

Parameters
objthe queried object

◆ probe_obj_getname_r()

OSCAP_API 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.

Parameters
objthe queried object
bufferthe buffer to store the name in
buflenthe length of the buffer

◆ probe_obj_new()

OSCAP_API SEXP_t * probe_obj_new ( const char * name,
SEXP_t * attrs )

Create a new object with just a name and optional attributes argument.

This function increments its SEXP_t argument's reference count.

Parameters
nameobject's name
attrsoptional attributes argument

◆ probe_obj_setstatus()

OSCAP_API int probe_obj_setstatus ( SEXP_t * obj,
oval_syschar_status_t status )

Set objects's status.

Parameters
objthe object to be modified
statusthe new status

◆ probe_path_is_blocked()

OSCAP_API bool probe_path_is_blocked ( const char * path,
struct oscap_list * blocked_paths )

Check if the given path matches any of the paths in the blocked paths list.

Parameters
pathpath to be examined
blocked_pathslist of blocked paths

◆ probe_tfc54behaviors_canonicalize()

OSCAP_API void probe_tfc54behaviors_canonicalize ( SEXP_t ** behaviors)

Set all of the missing attributes of the 'behaviors' entity to default values.

If the referenced pointer contains NULL, a new entity is created and stored in the referenced pointer.

Parameters
behaviorsaddress of the pointer to the 'behaviors' entity, must not be NULL