Open SCAP Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
oval_system_characteristics.h
Go to the documentation of this file.
1 
16 /*
17  * Copyright 2009--2014 Red Hat Inc., Durham, North Carolina.
18  * All Rights Reserved.
19  *
20  * This library is free software; you can redistribute it and/or
21  * modify it under the terms of the GNU Lesser General Public
22  * License as published by the Free Software Foundation; either
23  * version 2.1 of the License, or (at your option) any later version.
24  *
25  * This library is distributed in the hope that it will be useful,
26  * but WITHOUT ANY WARRANTY; without even the implied warranty of
27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28  * Lesser General Public License for more details.
29  *
30  * You should have received a copy of the GNU Lesser General Public
31  * License along with this library; if not, write to the Free Software
32  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33  *
34  * Authors:
35  * "David Niemoller" <David.Niemoller@g2-inc.com>
36  * Šimon Lukašík
37  */
38 
39 
40 #ifndef OVAL_SYSTEM_CHARACTERISTICS
41 #define OVAL_SYSTEM_CHARACTERISTICS
42 
43 #include "oscap.h"
44 #include "oscap_source.h"
45 #include "oval_types.h"
46 #include "oval_definitions.h"
47 
49 typedef enum {
50  SYSCHAR_FLAG_UNKNOWN = 0,
51  SYSCHAR_FLAG_ERROR = 1,
52  SYSCHAR_FLAG_COMPLETE = 2,
53  SYSCHAR_FLAG_INCOMPLETE = 3,
54  SYSCHAR_FLAG_DOES_NOT_EXIST = 4,
55  SYSCHAR_FLAG_NOT_COLLECTED = 5,
56  SYSCHAR_FLAG_NOT_APPLICABLE = 6
58 
60 typedef enum {
61  SYSCHAR_STATUS_UNKNOWN = 0,
62  SYSCHAR_STATUS_ERROR = 1,
63  SYSCHAR_STATUS_EXISTS = 2,
64  SYSCHAR_STATUS_DOES_NOT_EXIST = 3,
65  SYSCHAR_STATUS_NOT_COLLECTED = 4
67 
69 typedef enum {
70  OVAL_MESSAGE_LEVEL_NONE = 0,
71  OVAL_MESSAGE_LEVEL_DEBUG = 1,
72  OVAL_MESSAGE_LEVEL_INFO = 2,
73  OVAL_MESSAGE_LEVEL_WARNING = 3,
74  OVAL_MESSAGE_LEVEL_ERROR = 4,
75  OVAL_MESSAGE_LEVEL_FATAL = 5
77 
78 const char *oval_syschar_collection_flag_get_text(oval_syschar_collection_flag_t flag);
79 const char *oval_syschar_status_get_text(oval_syschar_status_t status);
80 const char *oval_message_level_text(oval_message_level_t);
81 
82 
83 
84 
85 
86 
93 struct oval_syschar_model;
94 
105 struct oval_sysinfo_iterator;
106 
126 struct oval_syschar_iterator;
127 
134 struct oval_sysint;
139 struct oval_sysint_iterator;
140 
155 struct oval_sysitem_iterator;
156 
160 struct oval_sysent;
165 struct oval_sysent_iterator;
166 
175 struct oval_message_iterator;
176 
186 
187 
188 
189 
190 
197 struct oval_syschar_model *oval_syschar_model_new(struct oval_definition_model *definition_model);
198 
207 int oval_syschar_model_import_source(struct oval_syschar_model *model, struct oscap_source *source);
208 
220 OSCAP_DEPRECATED(int oval_syschar_model_import(struct oval_syschar_model *model, const char *file));
231 int oval_syschar_model_export(struct oval_syschar_model *, const char *file);
237 void oval_syschar_model_free(struct oval_syschar_model *model);
238 
243 void oval_syschar_model_set_generator(struct oval_syschar_model *model, struct oval_generator *generator);
253 void oval_syschar_model_set_sysinfo(struct oval_syschar_model *model, struct oval_sysinfo *sysinfo);
260 struct oval_generator *oval_syschar_model_get_generator(struct oval_syschar_model *model);
286 struct oval_syschar *oval_syschar_model_get_syschar(struct oval_syschar_model *model, const char *object_id);
292 oval_syschar_collection_flag_t oval_variable_get_collection_flag(struct oval_variable *);
296 struct oval_sysitem *oval_syschar_model_get_sysitem(struct oval_syschar_model *, const char *);
313 struct oval_sysinfo *oval_sysinfo_new(struct oval_syschar_model *);
318 struct oval_sysinfo *oval_sysinfo_clone(struct oval_syschar_model *new_model, struct oval_sysinfo *old_sysinfo);
322 void oval_sysinfo_free(struct oval_sysinfo *);
323 
331 void oval_sysinfo_set_os_name(struct oval_sysinfo *, char *);
335 void oval_sysinfo_set_os_version(struct oval_sysinfo *, char *);
339 void oval_sysinfo_set_os_architecture(struct oval_sysinfo *, char *);
343 void oval_sysinfo_set_primary_host_name(struct oval_sysinfo *, char *);
347 void oval_sysinfo_add_interface(struct oval_sysinfo *, struct oval_sysint *);
358 char *oval_sysinfo_get_os_name(struct oval_sysinfo *);
359 
365 
371 
377 
392 bool oval_sysinfo_iterator_has_more(struct oval_sysinfo_iterator *);
396 struct oval_sysinfo *oval_sysinfo_iterator_next(struct oval_sysinfo_iterator *);
400 void oval_sysinfo_iterator_free(struct oval_sysinfo_iterator *);
417 struct oval_syschar *oval_syschar_new(struct oval_syschar_model *, struct oval_object *);
422 struct oval_syschar *oval_syschar_clone(struct oval_syschar_model *new_model, struct oval_syschar *old_syschar);
426 void oval_syschar_free(struct oval_syschar *);
427 
435 void oval_syschar_add_variable_binding(struct oval_syschar *, struct oval_variable_binding *);
439 void oval_syschar_set_flag(struct oval_syschar *model, oval_syschar_collection_flag_t flag);
443 void oval_syschar_set_object(struct oval_syschar *, struct oval_object *);
449 int oval_syschar_get_variable_instance(const struct oval_syschar *syschar);
456 void oval_syschar_set_variable_instance(struct oval_syschar *syschar, int variable_instance_in);
460 void oval_syschar_add_sysitem(struct oval_syschar *, struct oval_sysitem *);
464 void oval_syschar_add_message(struct oval_syschar *syschar, struct oval_message *message);
468 void oval_syschar_add_new_message(struct oval_syschar *syschar, char *text, oval_message_level_t level);
480 
486 
492 
498 
513 bool oval_syschar_iterator_has_more(struct oval_syschar_iterator *);
517 struct oval_syschar *oval_syschar_iterator_next(struct oval_syschar_iterator *);
521 void oval_syschar_iterator_free(struct oval_syschar_iterator *);
538 struct oval_sysint *oval_sysint_new(struct oval_syschar_model *);
543 struct oval_sysint *oval_sysint_clone(struct oval_syschar_model *new_model, struct oval_sysint *old_sysint);
547 void oval_sysint_free(struct oval_sysint *);
548 
556 void oval_sysint_set_name(struct oval_sysint *, char *);
560 void oval_sysint_set_ip_address(struct oval_sysint *, char *);
564 void oval_sysint_set_mac_address(struct oval_sysint *, char *);
575 char *oval_sysint_get_name(struct oval_sysint *);
576 
582 
597 bool oval_sysint_iterator_has_more(struct oval_sysint_iterator *);
601 struct oval_sysint *oval_sysint_iterator_next(struct oval_sysint_iterator *);
605 void oval_sysint_iterator_free(struct oval_sysint_iterator *);
622 struct oval_sysitem *oval_sysitem_new(struct oval_syschar_model *, const char *id);
627 struct oval_sysitem *oval_sysitem_clone(struct oval_syschar_model *new_model, struct oval_sysitem *old_data);
631 void oval_sysitem_free(struct oval_sysitem *);
632 
640 void oval_sysitem_set_status(struct oval_sysitem *, oval_syschar_status_t);
644 void oval_sysitem_set_subtype(struct oval_sysitem *sysitem, oval_subtype_t subtype);
648 void oval_sysitem_add_message(struct oval_sysitem *, struct oval_message *);
652 void oval_sysitem_add_sysent(struct oval_sysitem *, struct oval_sysent *);
663 char *oval_sysitem_get_id(struct oval_sysitem *);
693 bool oval_sysitem_iterator_has_more(struct oval_sysitem_iterator *);
697 struct oval_sysitem *oval_sysitem_iterator_next(struct oval_sysitem_iterator *);
701 void oval_sysitem_iterator_free(struct oval_sysitem_iterator *);
718 struct oval_sysent *oval_sysent_new(struct oval_syschar_model *);
723 struct oval_sysent *oval_sysent_clone(struct oval_syschar_model *new_model, struct oval_sysent *old_item);
727 void oval_sysent_free(struct oval_sysent *);
735 void oval_sysent_set_name(struct oval_sysent *sysent, char *name);
739 void oval_sysent_set_value(struct oval_sysent *sysent, char *value);
743 void oval_sysent_add_record_field(struct oval_sysent *, struct oval_record_field *);
747 void oval_sysent_set_status(struct oval_sysent *sysent, oval_syschar_status_t status);
751 void oval_sysent_set_datatype(struct oval_sysent *sysent, oval_datatype_t type);
755 void oval_sysent_set_mask(struct oval_sysent *sysent, int mask);
766 char *oval_sysent_get_name(struct oval_sysent *);
767 
772 char *oval_sysent_get_value(struct oval_sysent *);
773 
777 struct oval_record_field_iterator *oval_sysent_get_record_fields(struct oval_sysent *);
778 
784 
790 
795 int oval_sysent_get_mask(struct oval_sysent *);
805 bool oval_sysent_iterator_has_more(struct oval_sysent_iterator *);
809 struct oval_sysent *oval_sysent_iterator_next(struct oval_sysent_iterator *);
813 void oval_sysent_iterator_free(struct oval_sysent_iterator *);
829 void oval_record_field_set_status(struct oval_record_field *, oval_syschar_status_t);
838 oval_syschar_status_t oval_record_field_get_status(struct oval_record_field *);
844 struct oval_message *oval_message_new(void);
849 struct oval_message *oval_message_clone(struct oval_message *old_message);
853 void oval_message_free(struct oval_message *);
854 
862 void oval_message_set_text(struct oval_message *, char *);
866 void oval_message_set_level(struct oval_message *, oval_message_level_t);
877 char *oval_message_get_text(struct oval_message *message);
892 bool oval_message_iterator_has_more(struct oval_message_iterator *oc_message);
896 struct oval_message *oval_message_iterator_next(struct oval_message_iterator *oc_message);
900 void oval_message_iterator_free(struct oval_message_iterator *oc_message);
907 struct oval_variable_binding *oval_variable_binding_new(struct oval_variable *, char *);
913  struct oval_definition_model *);
917 void oval_variable_binding_free(struct oval_variable_binding *);
918 
926 void oval_variable_binding_set_variable(struct oval_variable_binding *, struct oval_variable *);
930 void oval_variable_binding_add_value(struct oval_variable_binding *, char *);
956 bool oval_variable_binding_iterator_has_more(struct oval_variable_binding_iterator *);
960 struct oval_variable_binding *oval_variable_binding_iterator_next(struct oval_variable_binding_iterator *);
964 void oval_variable_binding_iterator_free(struct oval_variable_binding_iterator *);
971 #endif
char * oval_sysint_get_mac_address(struct oval_sysint *)
Get interface MAC address.
Definition: oval_sysInterface.c:99
OVAL System Characteristics model.
Definition: oval_sysModel.c:54
int oval_syschar_model_import_source(struct oval_syschar_model *model, struct oscap_source *source)
Import the content from the oscap_source into an oval_syschar_model.
Definition: oval_sysModel.c:231
struct oval_syschar * oval_syschar_clone(struct oval_syschar_model *new_model, struct oval_syschar *old_syschar)
Definition: oval_syschar.c:167
struct oval_syschar_iterator * oval_syschar_model_get_syschars(struct oval_syschar_model *model)
Return an iterator over the oval_sychar objects persisted by this model.
Definition: oval_sysModel.c:178
oval_subtype_t
Unknown subtypes.
Definition: oval_types.h:120
General instrumented host description.
Definition: oval_sysInfo.c:45
Definition: oval_system_characteristics.h:160
General OpenScap functions and types.
struct oval_sysinfo * oval_sysinfo_clone(struct oval_syschar_model *new_model, struct oval_sysinfo *old_sysinfo)
Definition: oval_sysInfo.c:71
char * oval_sysinfo_get_primary_host_name(struct oval_sysinfo *)
Get primary host name of the tested machine.
Definition: oval_sysInfo.c:187
Definition: oval_system_characteristics.h:181
char * oval_sysent_get_name(struct oval_sysent *)
Get system data item name.
Definition: oval_sysEnt.c:130
Definition: oval_system_characteristics.h:101
struct oval_sysitem * oval_sysitem_clone(struct oval_syschar_model *new_model, struct oval_sysitem *old_data)
Definition: oval_sysItem.c:76
oval_subtype_t oval_sysitem_get_subtype(struct oval_sysitem *)
Get system data subtype.
Definition: oval_sysItem.c:136
oval_message_level_t oval_message_get_level(struct oval_message *message)
Get OVAL message level.
Definition: oval_message.c:110
oval_syschar_status_t oval_sysent_get_status(struct oval_sysent *)
Get system data item status.
Definition: oval_sysEnt.c:137
#define OSCAP_DEPRECATED(func)
This macro will warn, when a deprecated function is used.
Definition: oscap.h:50
int oval_syschar_model_import(struct oval_syschar_model *model, const char *file)
Import the content from the file into an oval_syschar_model.
Definition: oval_sysModel.c:266
struct oval_message_iterator * oval_sysitem_get_messages(struct oval_sysitem *)
Get system data message.
Definition: oval_sysItem.c:155
int oval_sysent_get_mask(struct oval_sysent *)
Get system data item mask.
Definition: oval_sysEnt.c:167
oval_syschar_status_t
System characteristics status.
Definition: oval_system_characteristics.h:60
void oval_syschar_set_variable_instance(struct oval_syschar *syschar, int variable_instance_in)
Sets the variable_instance attribute of the syschar.
Definition: oval_syschar.c:383
OVAL message.
Definition: oval_message.c:45
struct oval_definition_model * oval_syschar_model_get_definition_model(struct oval_syschar_model *model)
Return related oval_definition_model from an oval_syschar_model.
Definition: oval_sysModel.c:171
Binding of an value to an OVAL variable.
Definition: oval_variableBinding.c:45
int oval_syschar_model_bind_variable_model(struct oval_syschar_model *, struct oval_variable_model *)
Bind a variable model to the definitions bound to the syschar model.
Definition: oval_sysModel.c:278
Each instance of Oval_sysitem represents one item.
Definition: oval_sysItem.c:45
oval_datatype_t
Datatypes.
Definition: oval_definitions.h:149
void oval_syschar_model_free(struct oval_syschar_model *model)
Free memory allocated to a specified syschar model.
Definition: oval_sysModel.c:137
Definition: oval_system_characteristics.h:171
char * oval_sysinfo_get_os_version(struct oval_sysinfo *)
Get operating system version.
Definition: oval_sysInfo.c:161
struct oval_sysent_iterator * oval_sysitem_get_sysents(struct oval_sysitem *)
Get system data individual items.
Definition: oval_sysItem.c:167
oval_datatype_t oval_sysent_get_datatype(struct oval_sysent *)
Get system data item data type.
Definition: oval_sysEnt.c:160
int oval_syschar_get_variable_instance(const struct oval_syschar *syschar)
Gets the variable_instance attribute of the syschar.
Definition: oval_syschar.c:377
An oval variable resolves an oval_value stream which specifies constraints for oval_objects and oval_...
Definition: oval_variable.c:50
struct oval_sysitem_iterator * oval_syschar_get_sysitem(struct oval_syschar *)
Get system characteristic data.
Definition: oval_syschar.c:124
Definition: oval_recordField.c:39
struct oval_sysent * oval_sysent_clone(struct oval_syschar_model *new_model, struct oval_sysent *old_item)
Definition: oval_sysEnt.c:74
struct oval_syschar_model * oval_syschar_model_clone(struct oval_syschar_model *)
Copy an oval_syschar_model.
Definition: oval_sysModel.c:117
struct oval_message * oval_message_clone(struct oval_message *old_message)
Definition: oval_message.c:62
struct oval_variable_binding * oval_variable_binding_clone(struct oval_variable_binding *, struct oval_definition_model *)
Definition: oval_variableBinding.c:120
Definition: oscap_source.c:62
char * oval_sysinfo_get_os_name(struct oval_sysinfo *)
Get operating system name.
Definition: oval_sysInfo.c:145
char * oval_sysitem_get_id(struct oval_sysitem *)
Get system data ID.
Definition: oval_sysItem.c:149
char * oval_sysint_get_ip_address(struct oval_sysint *)
Get interface IP address.
Definition: oval_sysInterface.c:84
oval_syschar_status_t oval_sysitem_get_status(struct oval_sysitem *)
Get system data status.
Definition: oval_sysItem.c:179
struct oval_variable_binding_iterator * oval_syschar_get_variable_bindings(struct oval_syschar *)
Get system characteristic variable bindings.
Definition: oval_syschar.c:114
char * oval_sysint_get_name(struct oval_sysint *)
Get interface name.
Definition: oval_sysInterface.c:69
struct oval_message_iterator * oval_syschar_get_messages(struct oval_syschar *)
Get messages bound to this system characteristic.
Definition: oval_syschar.c:78
Oval definition model.
Definition: oval_defModel.c:51
struct oval_syschar_model * oval_syschar_model_new(struct oval_definition_model *definition_model)
Create new oval_syschar_model.
Definition: oval_sysModel.c:67
struct oval_string_iterator * oval_variable_binding_get_values(struct oval_variable_binding *)
Get value of this binding.
Definition: oval_variableBinding.c:84
Definition: oval_sysEnt.c:48
Network interface description.
Definition: oval_sysInterface.c:45
struct oval_sysinfo * oval_syschar_model_get_sysinfo(struct oval_syschar_model *model)
Return default sysinfo bound to syschar model.
Definition: oval_sysModel.c:185
oval_syschar_collection_flag_t
System characteristics result flag.
Definition: oval_system_characteristics.h:49
Characteristics bound to an Oval_object.
Definition: oval_syschar.c:48
oval_syschar_collection_flag_t oval_syschar_get_flag(struct oval_syschar *)
Get system characteristic flag.
Definition: oval_syschar.c:59
oval_message_level_t
Message level.
Definition: oval_system_characteristics.h:69
char * oval_message_get_text(struct oval_message *message)
Get OVAL message text.
Definition: oval_message.c:102
The OVAL variable model facilitates access to external variable value bindings used to to constrain t...
Definition: oval_varModel.c:56
struct oval_syschar * oval_syschar_model_get_syschar(struct oval_syschar_model *model, const char *object_id)
Return the oval_syschar bound to a specified object_id.
Definition: oval_sysModel.c:285
int oval_syschar_model_compute_variable(struct oval_syschar_model *, struct oval_variable *)
Get the oval_values bound to a specified variable.
Definition: oval_variable.c:442
Definition: oval_generator.c:44
int oval_syschar_model_export(struct oval_syschar_model *, const char *file)
Export system characteristics into file.
Definition: oval_sysModel.c:408
struct oval_object * oval_syschar_get_object(struct oval_syschar *)
Get object associated with this system characteristic.
Definition: oval_syschar.c:100
Definition: oval_system_characteristics.h:150
char * oval_sysinfo_get_os_architecture(struct oval_sysinfo *)
Get operating system architecture.
Definition: oval_sysInfo.c:174
char * oval_sysent_get_value(struct oval_sysent *)
Get system data item value.
Definition: oval_sysEnt.c:144
Definition: oval_system_characteristics.h:134
struct oval_variable * oval_variable_binding_get_variable(struct oval_variable_binding *)
Get variable for this binding.
Definition: oval_variableBinding.c:75
struct oval_sysint * oval_sysint_clone(struct oval_syschar_model *new_model, struct oval_sysint *old_sysint)
Definition: oval_sysInterface.c:125
An Oval_object instance describes a set of items to look for on an instrumented host platform...
Definition: oval_object.c:46
Definition: oval_system_characteristics.h:121
struct oval_sysint_iterator * oval_sysinfo_get_interfaces(struct oval_sysinfo *)
Get an iterator to the list of network interfaces.
Definition: oval_sysInfo.c:201
Definition: oval_definitions.h:462