Open SCAP Library
oval_system_characteristics.h
Go to the documentation of this file.
1 
16 /*
17  * Copyright 2009-2010 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  */
37 
38 
39 #ifndef OVAL_SYSTEM_CHARACTERISTICS
40 #define OVAL_SYSTEM_CHARACTERISTICS
41 
42 #include "oval_types.h"
43 #include "oval_definitions.h"
44 
46 typedef enum {
47  SYSCHAR_FLAG_UNKNOWN = 0,
48  SYSCHAR_FLAG_ERROR = 1,
49  SYSCHAR_FLAG_COMPLETE = 2,
50  SYSCHAR_FLAG_INCOMPLETE = 3,
51  SYSCHAR_FLAG_DOES_NOT_EXIST = 4,
52  SYSCHAR_FLAG_NOT_COLLECTED = 5,
53  SYSCHAR_FLAG_NOT_APPLICABLE = 6
55 
57 typedef enum {
58  SYSCHAR_STATUS_UNKNOWN = 0,
59  SYSCHAR_STATUS_ERROR = 1,
60  SYSCHAR_STATUS_EXISTS = 2,
61  SYSCHAR_STATUS_DOES_NOT_EXIST = 3,
62  SYSCHAR_STATUS_NOT_COLLECTED = 4
64 
66 typedef enum {
67  OVAL_MESSAGE_LEVEL_NONE = 0,
68  OVAL_MESSAGE_LEVEL_DEBUG = 1,
69  OVAL_MESSAGE_LEVEL_INFO = 2,
70  OVAL_MESSAGE_LEVEL_WARNING = 3,
71  OVAL_MESSAGE_LEVEL_ERROR = 4,
72  OVAL_MESSAGE_LEVEL_FATAL = 5
74 
75 const char *oval_syschar_collection_flag_get_text(oval_syschar_collection_flag_t flag);
76 const char *oval_syschar_status_get_text(oval_syschar_status_t status);
77 const char *oval_message_level_text(oval_message_level_t);
78 
79 
80 
81 
82 
83 
90 struct oval_syschar_model;
91 
98 struct oval_sysinfo;
102 struct oval_sysinfo_iterator;
103 
123 struct oval_syschar_iterator;
124 
131 struct oval_sysint;
136 struct oval_sysint_iterator;
137 
152 struct oval_sysitem_iterator;
153 
157 struct oval_sysent;
162 struct oval_sysent_iterator;
163 
172 struct oval_message_iterator;
173 
183 
184 
185 
186 
187 
194 struct oval_syschar_model *oval_syschar_model_new(struct oval_definition_model *definition_model);
195 
204 int oval_syschar_model_import(struct oval_syschar_model *model, const char *file);
215 int oval_syschar_model_export(struct oval_syschar_model *, const char *file);
221 void oval_syschar_model_free(struct oval_syschar_model *model);
222 
227 void oval_syschar_model_set_generator(struct oval_syschar_model *model, struct oval_generator *generator);
237 void oval_syschar_model_set_sysinfo(struct oval_syschar_model *model, struct oval_sysinfo *sysinfo);
244 struct oval_generator *oval_syschar_model_get_generator(struct oval_syschar_model *model);
270 struct oval_syschar *oval_syschar_model_get_syschar(struct oval_syschar_model *model, const char *object_id);
276 oval_syschar_collection_flag_t oval_variable_get_collection_flag(struct oval_variable *);
280 struct oval_sysitem *oval_syschar_model_get_sysitem(struct oval_syschar_model *, const char *);
297 struct oval_sysinfo *oval_sysinfo_new(struct oval_syschar_model *);
302 struct oval_sysinfo *oval_sysinfo_clone(struct oval_syschar_model *new_model, struct oval_sysinfo *old_sysinfo);
306 void oval_sysinfo_free(struct oval_sysinfo *);
307 
315 void oval_sysinfo_set_os_name(struct oval_sysinfo *, char *);
319 void oval_sysinfo_set_os_version(struct oval_sysinfo *, char *);
323 void oval_sysinfo_set_os_architecture(struct oval_sysinfo *, char *);
327 void oval_sysinfo_set_primary_host_name(struct oval_sysinfo *, char *);
331 void oval_sysinfo_add_interface(struct oval_sysinfo *, struct oval_sysint *);
342 char *oval_sysinfo_get_os_name(struct oval_sysinfo *);
343 
349 
355 
361 
376 bool oval_sysinfo_iterator_has_more(struct oval_sysinfo_iterator *);
380 struct oval_sysinfo *oval_sysinfo_iterator_next(struct oval_sysinfo_iterator *);
384 void oval_sysinfo_iterator_free(struct oval_sysinfo_iterator *);
401 struct oval_syschar *oval_syschar_new(struct oval_syschar_model *, struct oval_object *);
406 struct oval_syschar *oval_syschar_clone(struct oval_syschar_model *new_model, struct oval_syschar *old_syschar);
410 void oval_syschar_free(struct oval_syschar *);
411 
419 void oval_syschar_add_variable_binding(struct oval_syschar *, struct oval_variable_binding *);
423 void oval_syschar_set_flag(struct oval_syschar *model, oval_syschar_collection_flag_t flag);
427 void oval_syschar_set_object(struct oval_syschar *, struct oval_object *);
431 void oval_syschar_add_sysitem(struct oval_syschar *, struct oval_sysitem *);
435 void oval_syschar_add_message(struct oval_syschar *syschar, struct oval_message *message);
439 void oval_syschar_add_new_message(struct oval_syschar *syschar, char *text, oval_message_level_t level);
451 
457 
463 
469 
484 bool oval_syschar_iterator_has_more(struct oval_syschar_iterator *);
488 struct oval_syschar *oval_syschar_iterator_next(struct oval_syschar_iterator *);
492 void oval_syschar_iterator_free(struct oval_syschar_iterator *);
509 struct oval_sysint *oval_sysint_new(struct oval_syschar_model *);
514 struct oval_sysint *oval_sysint_clone(struct oval_syschar_model *new_model, struct oval_sysint *old_sysint);
518 void oval_sysint_free(struct oval_sysint *);
519 
527 void oval_sysint_set_name(struct oval_sysint *, char *);
531 void oval_sysint_set_ip_address(struct oval_sysint *, char *);
535 void oval_sysint_set_mac_address(struct oval_sysint *, char *);
546 char *oval_sysint_get_name(struct oval_sysint *);
547 
553 
568 bool oval_sysint_iterator_has_more(struct oval_sysint_iterator *);
572 struct oval_sysint *oval_sysint_iterator_next(struct oval_sysint_iterator *);
576 void oval_sysint_iterator_free(struct oval_sysint_iterator *);
593 struct oval_sysitem *oval_sysitem_new(struct oval_syschar_model *, const char *id);
598 struct oval_sysitem *oval_sysitem_clone(struct oval_syschar_model *new_model, struct oval_sysitem *old_data);
602 void oval_sysitem_free(struct oval_sysitem *);
603 
611 void oval_sysitem_set_status(struct oval_sysitem *, oval_syschar_status_t);
615 void oval_sysitem_set_subtype(struct oval_sysitem *sysitem, oval_subtype_t subtype);
619 void oval_sysitem_add_message(struct oval_sysitem *, struct oval_message *);
623 void oval_sysitem_add_sysent(struct oval_sysitem *, struct oval_sysent *);
634 char *oval_sysitem_get_id(struct oval_sysitem *);
664 bool oval_sysitem_iterator_has_more(struct oval_sysitem_iterator *);
668 struct oval_sysitem *oval_sysitem_iterator_next(struct oval_sysitem_iterator *);
672 void oval_sysitem_iterator_free(struct oval_sysitem_iterator *);
689 struct oval_sysent *oval_sysent_new(struct oval_syschar_model *);
694 struct oval_sysent *oval_sysent_clone(struct oval_syschar_model *new_model, struct oval_sysent *old_item);
698 void oval_sysent_free(struct oval_sysent *);
706 void oval_sysent_set_name(struct oval_sysent *sysent, char *name);
710 void oval_sysent_set_value(struct oval_sysent *sysent, char *value);
714 void oval_sysent_add_record_field(struct oval_sysent *, struct oval_record_field *);
718 void oval_sysent_set_status(struct oval_sysent *sysent, oval_syschar_status_t status);
722 void oval_sysent_set_datatype(struct oval_sysent *sysent, oval_datatype_t type);
726 void oval_sysent_set_mask(struct oval_sysent *sysent, int mask);
737 char *oval_sysent_get_name(struct oval_sysent *);
738 
743 char *oval_sysent_get_value(struct oval_sysent *);
744 
748 struct oval_record_field_iterator *oval_sysent_get_record_fields(struct oval_sysent *);
749 
755 
761 
766 int oval_sysent_get_mask(struct oval_sysent *);
776 bool oval_sysent_iterator_has_more(struct oval_sysent_iterator *);
780 struct oval_sysent *oval_sysent_iterator_next(struct oval_sysent_iterator *);
784 void oval_sysent_iterator_free(struct oval_sysent_iterator *);
800 void oval_record_field_set_status(struct oval_record_field *, oval_syschar_status_t);
809 oval_syschar_status_t oval_record_field_get_status(struct oval_record_field *);
815 struct oval_message *oval_message_new(void);
820 struct oval_message *oval_message_clone(struct oval_message *old_message);
824 void oval_message_free(struct oval_message *);
825 
833 void oval_message_set_text(struct oval_message *, char *);
837 void oval_message_set_level(struct oval_message *, oval_message_level_t);
848 char *oval_message_get_text(struct oval_message *message);
863 bool oval_message_iterator_has_more(struct oval_message_iterator *oc_message);
867 struct oval_message *oval_message_iterator_next(struct oval_message_iterator *oc_message);
871 void oval_message_iterator_free(struct oval_message_iterator *oc_message);
878 struct oval_variable_binding *oval_variable_binding_new(struct oval_variable *, char *);
884  struct oval_definition_model *);
888 void oval_variable_binding_free(struct oval_variable_binding *);
889 
897 void oval_variable_binding_set_variable(struct oval_variable_binding *, struct oval_variable *);
901 void oval_variable_binding_add_value(struct oval_variable_binding *, char *);
927 bool oval_variable_binding_iterator_has_more(struct oval_variable_binding_iterator *);
931 struct oval_variable_binding *oval_variable_binding_iterator_next(struct oval_variable_binding_iterator *);
935 void oval_variable_binding_iterator_free(struct oval_variable_binding_iterator *);
942 #endif