Open SCAP Library
oval_system_characteristics.h
Go to the documentation of this file.
1 
16 /*
17  * Copyright 2009--2013 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 "oval_types.h"
44 #include "oval_definitions.h"
45 
47 typedef enum {
48  SYSCHAR_FLAG_UNKNOWN = 0,
49  SYSCHAR_FLAG_ERROR = 1,
50  SYSCHAR_FLAG_COMPLETE = 2,
51  SYSCHAR_FLAG_INCOMPLETE = 3,
52  SYSCHAR_FLAG_DOES_NOT_EXIST = 4,
53  SYSCHAR_FLAG_NOT_COLLECTED = 5,
54  SYSCHAR_FLAG_NOT_APPLICABLE = 6
56 
58 typedef enum {
59  SYSCHAR_STATUS_UNKNOWN = 0,
60  SYSCHAR_STATUS_ERROR = 1,
61  SYSCHAR_STATUS_EXISTS = 2,
62  SYSCHAR_STATUS_DOES_NOT_EXIST = 3,
63  SYSCHAR_STATUS_NOT_COLLECTED = 4
65 
67 typedef enum {
68  OVAL_MESSAGE_LEVEL_NONE = 0,
69  OVAL_MESSAGE_LEVEL_DEBUG = 1,
70  OVAL_MESSAGE_LEVEL_INFO = 2,
71  OVAL_MESSAGE_LEVEL_WARNING = 3,
72  OVAL_MESSAGE_LEVEL_ERROR = 4,
73  OVAL_MESSAGE_LEVEL_FATAL = 5
75 
76 const char *oval_syschar_collection_flag_get_text(oval_syschar_collection_flag_t flag);
77 const char *oval_syschar_status_get_text(oval_syschar_status_t status);
78 const char *oval_message_level_text(oval_message_level_t);
79 
80 
81 
82 
83 
84 
91 struct oval_syschar_model;
92 
99 struct oval_sysinfo;
103 struct oval_sysinfo_iterator;
104 
124 struct oval_syschar_iterator;
125 
132 struct oval_sysint;
137 struct oval_sysint_iterator;
138 
153 struct oval_sysitem_iterator;
154 
158 struct oval_sysent;
163 struct oval_sysent_iterator;
164 
173 struct oval_message_iterator;
174 
184 
185 
186 
187 
188 
195 struct oval_syschar_model *oval_syschar_model_new(struct oval_definition_model *definition_model);
196 
205 int oval_syschar_model_import(struct oval_syschar_model *model, const char *file);
216 int oval_syschar_model_export(struct oval_syschar_model *, const char *file);
222 void oval_syschar_model_free(struct oval_syschar_model *model);
223 
228 void oval_syschar_model_set_generator(struct oval_syschar_model *model, struct oval_generator *generator);
238 void oval_syschar_model_set_sysinfo(struct oval_syschar_model *model, struct oval_sysinfo *sysinfo);
245 struct oval_generator *oval_syschar_model_get_generator(struct oval_syschar_model *model);
271 struct oval_syschar *oval_syschar_model_get_syschar(struct oval_syschar_model *model, const char *object_id);
277 oval_syschar_collection_flag_t oval_variable_get_collection_flag(struct oval_variable *);
281 struct oval_sysitem *oval_syschar_model_get_sysitem(struct oval_syschar_model *, const char *);
298 struct oval_sysinfo *oval_sysinfo_new(struct oval_syschar_model *);
303 struct oval_sysinfo *oval_sysinfo_clone(struct oval_syschar_model *new_model, struct oval_sysinfo *old_sysinfo);
307 void oval_sysinfo_free(struct oval_sysinfo *);
308 
316 void oval_sysinfo_set_os_name(struct oval_sysinfo *, char *);
320 void oval_sysinfo_set_os_version(struct oval_sysinfo *, char *);
324 void oval_sysinfo_set_os_architecture(struct oval_sysinfo *, char *);
328 void oval_sysinfo_set_primary_host_name(struct oval_sysinfo *, char *);
332 void oval_sysinfo_add_interface(struct oval_sysinfo *, struct oval_sysint *);
343 char *oval_sysinfo_get_os_name(struct oval_sysinfo *);
344 
350 
356 
362 
377 bool oval_sysinfo_iterator_has_more(struct oval_sysinfo_iterator *);
381 struct oval_sysinfo *oval_sysinfo_iterator_next(struct oval_sysinfo_iterator *);
385 void oval_sysinfo_iterator_free(struct oval_sysinfo_iterator *);
402 struct oval_syschar *oval_syschar_new(struct oval_syschar_model *, struct oval_object *);
407 struct oval_syschar *oval_syschar_clone(struct oval_syschar_model *new_model, struct oval_syschar *old_syschar);
411 void oval_syschar_free(struct oval_syschar *);
412 
420 void oval_syschar_add_variable_binding(struct oval_syschar *, struct oval_variable_binding *);
424 void oval_syschar_set_flag(struct oval_syschar *model, oval_syschar_collection_flag_t flag);
428 void oval_syschar_set_object(struct oval_syschar *, struct oval_object *);
434 int oval_syschar_get_variable_instance(const struct oval_syschar *syschar);
441 void oval_syschar_set_variable_instance(struct oval_syschar *syschar, int variable_instance_in);
445 void oval_syschar_add_sysitem(struct oval_syschar *, struct oval_sysitem *);
449 void oval_syschar_add_message(struct oval_syschar *syschar, struct oval_message *message);
453 void oval_syschar_add_new_message(struct oval_syschar *syschar, char *text, oval_message_level_t level);
465 
471 
477 
483 
498 bool oval_syschar_iterator_has_more(struct oval_syschar_iterator *);
502 struct oval_syschar *oval_syschar_iterator_next(struct oval_syschar_iterator *);
506 void oval_syschar_iterator_free(struct oval_syschar_iterator *);
523 struct oval_sysint *oval_sysint_new(struct oval_syschar_model *);
528 struct oval_sysint *oval_sysint_clone(struct oval_syschar_model *new_model, struct oval_sysint *old_sysint);
532 void oval_sysint_free(struct oval_sysint *);
533 
541 void oval_sysint_set_name(struct oval_sysint *, char *);
545 void oval_sysint_set_ip_address(struct oval_sysint *, char *);
549 void oval_sysint_set_mac_address(struct oval_sysint *, char *);
560 char *oval_sysint_get_name(struct oval_sysint *);
561 
567 
582 bool oval_sysint_iterator_has_more(struct oval_sysint_iterator *);
586 struct oval_sysint *oval_sysint_iterator_next(struct oval_sysint_iterator *);
590 void oval_sysint_iterator_free(struct oval_sysint_iterator *);
607 struct oval_sysitem *oval_sysitem_new(struct oval_syschar_model *, const char *id);
612 struct oval_sysitem *oval_sysitem_clone(struct oval_syschar_model *new_model, struct oval_sysitem *old_data);
616 void oval_sysitem_free(struct oval_sysitem *);
617 
625 void oval_sysitem_set_status(struct oval_sysitem *, oval_syschar_status_t);
629 void oval_sysitem_set_subtype(struct oval_sysitem *sysitem, oval_subtype_t subtype);
633 void oval_sysitem_add_message(struct oval_sysitem *, struct oval_message *);
637 void oval_sysitem_add_sysent(struct oval_sysitem *, struct oval_sysent *);
648 char *oval_sysitem_get_id(struct oval_sysitem *);
678 bool oval_sysitem_iterator_has_more(struct oval_sysitem_iterator *);
682 struct oval_sysitem *oval_sysitem_iterator_next(struct oval_sysitem_iterator *);
686 void oval_sysitem_iterator_free(struct oval_sysitem_iterator *);
703 struct oval_sysent *oval_sysent_new(struct oval_syschar_model *);
708 struct oval_sysent *oval_sysent_clone(struct oval_syschar_model *new_model, struct oval_sysent *old_item);
712 void oval_sysent_free(struct oval_sysent *);
720 void oval_sysent_set_name(struct oval_sysent *sysent, char *name);
724 void oval_sysent_set_value(struct oval_sysent *sysent, char *value);
728 void oval_sysent_add_record_field(struct oval_sysent *, struct oval_record_field *);
732 void oval_sysent_set_status(struct oval_sysent *sysent, oval_syschar_status_t status);
736 void oval_sysent_set_datatype(struct oval_sysent *sysent, oval_datatype_t type);
740 void oval_sysent_set_mask(struct oval_sysent *sysent, int mask);
751 char *oval_sysent_get_name(struct oval_sysent *);
752 
757 char *oval_sysent_get_value(struct oval_sysent *);
758 
762 struct oval_record_field_iterator *oval_sysent_get_record_fields(struct oval_sysent *);
763 
769 
775 
780 int oval_sysent_get_mask(struct oval_sysent *);
790 bool oval_sysent_iterator_has_more(struct oval_sysent_iterator *);
794 struct oval_sysent *oval_sysent_iterator_next(struct oval_sysent_iterator *);
798 void oval_sysent_iterator_free(struct oval_sysent_iterator *);
814 void oval_record_field_set_status(struct oval_record_field *, oval_syschar_status_t);
823 oval_syschar_status_t oval_record_field_get_status(struct oval_record_field *);
829 struct oval_message *oval_message_new(void);
834 struct oval_message *oval_message_clone(struct oval_message *old_message);
838 void oval_message_free(struct oval_message *);
839 
847 void oval_message_set_text(struct oval_message *, char *);
851 void oval_message_set_level(struct oval_message *, oval_message_level_t);
862 char *oval_message_get_text(struct oval_message *message);
877 bool oval_message_iterator_has_more(struct oval_message_iterator *oc_message);
881 struct oval_message *oval_message_iterator_next(struct oval_message_iterator *oc_message);
885 void oval_message_iterator_free(struct oval_message_iterator *oc_message);
892 struct oval_variable_binding *oval_variable_binding_new(struct oval_variable *, char *);
898  struct oval_definition_model *);
902 void oval_variable_binding_free(struct oval_variable_binding *);
903 
911 void oval_variable_binding_set_variable(struct oval_variable_binding *, struct oval_variable *);
915 void oval_variable_binding_add_value(struct oval_variable_binding *, char *);
941 bool oval_variable_binding_iterator_has_more(struct oval_variable_binding_iterator *);
945 struct oval_variable_binding *oval_variable_binding_iterator_next(struct oval_variable_binding_iterator *);
949 void oval_variable_binding_iterator_free(struct oval_variable_binding_iterator *);
956 #endif
char * oval_sysint_get_mac_address(struct oval_sysint *)
Get interface MAC address.
Definition: oval_sysInterface.c:98
OVAL System Characteristics model.
Definition: oval_sysModel.c:52
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:188
oval_subtype_t
Unknown subtypes.
Definition: oval_types.h:120
General instrumented host description.
Definition: oval_sysInfo.c:44
Definition: oval_system_characteristics.h:158
struct oval_sysinfo * oval_sysinfo_clone(struct oval_syschar_model *new_model, struct oval_sysinfo *old_sysinfo)
Definition: oval_sysInfo.c:70
char * oval_sysinfo_get_primary_host_name(struct oval_sysinfo *)
Get primary host name of the tested machine.
Definition: oval_sysInfo.c:186
Definition: oval_system_characteristics.h:179
char * oval_sysent_get_name(struct oval_sysent *)
Get system data item name.
Definition: oval_sysEnt.c:129
Definition: oval_system_characteristics.h:99
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:109
oval_syschar_status_t oval_sysent_get_status(struct oval_sysent *)
Get system data item status.
Definition: oval_sysEnt.c:136
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:243
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:166
oval_syschar_status_t
System characteristics status.
Definition: oval_system_characteristics.h:58
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:44
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:181
Binding of an value to an OVAL variable.
Definition: oval_variableBinding.c:44
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:285
Each instance of Oval_sysitem represents one item.
Definition: oval_sysItem.c:45
oval_datatype_t
Datatypes.
Definition: oval_definitions.h:146
void oval_syschar_model_free(struct oval_syschar_model *model)
Free memory allocated to a specified syschar model.
Definition: oval_sysModel.c:136
Definition: oval_system_characteristics.h:169
char * oval_sysinfo_get_os_version(struct oval_sysinfo *)
Get operating system version.
Definition: oval_sysInfo.c:160
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:159
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:46
struct oval_sysitem_iterator * oval_syschar_get_sysitem(struct oval_syschar *)
Get system characteristic data.
Definition: oval_syschar.c:124
Definition: oval_recordField.c:38
struct oval_sysent * oval_sysent_clone(struct oval_syschar_model *new_model, struct oval_sysent *old_item)
Definition: oval_sysEnt.c:73
struct oval_syschar_model * oval_syschar_model_clone(struct oval_syschar_model *)
Copy an oval_syschar_model.
Definition: oval_sysModel.c:116
struct oval_message * oval_message_clone(struct oval_message *old_message)
Definition: oval_message.c:61
struct oval_variable_binding * oval_variable_binding_clone(struct oval_variable_binding *, struct oval_definition_model *)
Definition: oval_variableBinding.c:119
char * oval_sysinfo_get_os_name(struct oval_sysinfo *)
Get operating system name.
Definition: oval_sysInfo.c:144
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:83
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:68
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:49
struct oval_syschar_model * oval_syschar_model_new(struct oval_definition_model *definition_model)
Create new oval_syschar_model.
Definition: oval_sysModel.c:65
struct oval_string_iterator * oval_variable_binding_get_values(struct oval_variable_binding *)
Get value of this binding.
Definition: oval_variableBinding.c:83
Definition: oval_sysEnt.c:47
Network interface description.
Definition: oval_sysInterface.c:44
struct oval_sysinfo * oval_syschar_model_get_sysinfo(struct oval_syschar_model *model)
Return default sysinfo bound to syschar model.
Definition: oval_sysModel.c:195
oval_syschar_collection_flag_t
System characteristics result flag.
Definition: oval_system_characteristics.h:47
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:67
char * oval_message_get_text(struct oval_message *message)
Get OVAL message text.
Definition: oval_message.c:101
The OVAL variable model facilitates access to external variable value bindings used to to constrain t...
Definition: oval_varModel.c:54
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:292
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:206
Definition: oval_generator.c:43
int oval_syschar_model_export(struct oval_syschar_model *, const char *file)
Export system characteristics into file.
Definition: oval_sysModel.c:411
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:148
char * oval_sysinfo_get_os_architecture(struct oval_sysinfo *)
Get operating system architecture.
Definition: oval_sysInfo.c:173
char * oval_sysent_get_value(struct oval_sysent *)
Get system data item value.
Definition: oval_sysEnt.c:143
Definition: oval_system_characteristics.h:132
struct oval_variable * oval_variable_binding_get_variable(struct oval_variable_binding *)
Get variable for this binding.
Definition: oval_variableBinding.c:74
struct oval_sysint * oval_sysint_clone(struct oval_syschar_model *new_model, struct oval_sysint *old_sysint)
Definition: oval_sysInterface.c:124
An Oval_object instance describes a set of items to look for on an instrumented host platform...
Definition: oval_object.c:44
Definition: oval_system_characteristics.h:119
struct oval_sysint_iterator * oval_sysinfo_get_interfaces(struct oval_sysinfo *)
Get an iterator to the list of network interfaces.
Definition: oval_sysInfo.c:200
Definition: oval_definitions.h:441