00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef CVRF_PRIV_H_
00024 #define CVRF_PRIV_H_
00025
00026 #include <libxml/xmlreader.h>
00027 #include <libxml/tree.h>
00028 #include <libxml/xpath.h>
00029 #include <libxml/parser.h>
00030 #include <libxml/xpathInternals.h>
00031
00032 #include "../common/list.h"
00033 #include "../common/elements.h"
00034 #include "cvrf.h"
00035
00036 OSCAP_HIDDEN_START;
00037
00038
00039 #define CVRF_NS BAD_CAST "http://www.icasi.org/CVRF/schema/cvrf/1.1"
00040 #define PROD_NS BAD_CAST "http://www.icasi.org/CVRF/schema/prod/1.1"
00041 #define VULN_NS BAD_CAST "http://www.icasi.org/CVRF/schema/vuln/1.1"
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 typedef enum {
00052 CVRF_DOC_PUBLISHER_UNKNOWN = 0,
00053 CVRF_DOC_PUBLISHER_VENDOR,
00054 CVRF_DOC_PUBLISHER_DISCOVERER,
00055 CVRF_DOC_PUBLISHER_COORDINATOR,
00056 CVRF_DOC_PUBLISHER_USER,
00057 CVRF_DOC_PUBLISHER_OTHER,
00058 } cvrf_doc_publisher_type_t;
00059
00066 cvrf_doc_publisher_type_t cvrf_doc_publisher_get_type(struct cvrf_doc_publisher *publisher);
00067
00074 cvrf_doc_publisher_type_t cvrf_involvement_get_party(struct cvrf_involvement *involve);
00075
00081 cvrf_doc_publisher_type_t cvrf_doc_publisher_type_parse(xmlTextReaderPtr reader);
00082
00089 cvrf_doc_publisher_type_t cvrf_involvement_party_parse(xmlTextReaderPtr reader);
00090
00096 const char *cvrf_doc_publisher_type_get_text(cvrf_doc_publisher_type_t type);
00097
00098
00099
00100
00101
00102 typedef enum {
00103 CVRF_DOC_STATUS_UNKNOWN = 0,
00104 CVRF_DOC_STATUS_DRAFT,
00105 CVRF_DOC_STATUS_INTERIM,
00106 CVRF_DOC_STATUS_FINAL,
00107 } cvrf_doc_status_type_t;
00108
00115 cvrf_doc_status_type_t cvrf_doc_tracking_get_status(struct cvrf_doc_tracking *tracking);
00116
00122 cvrf_doc_status_type_t cvrf_doc_status_type_parse(xmlTextReaderPtr reader);
00123
00129 const char *cvrf_doc_status_type_get_text(cvrf_doc_status_type_t type);
00130
00131
00132
00133
00134
00135 typedef enum {
00136 CVRF_NOTE_UNKNOWN = 0,
00137 CVRF_NOTE_GENERAL,
00138 CVRF_NOTE_DETAILS,
00139 CVRF_NOTE_DESCRIPTION,
00140 CVRF_NOTE_SUMMARY,
00141 CVRF_NOTE_FAQ,
00142 CVRF_NOTE_LEGAL_DISCLAIMER,
00143 CVRF_NOTE_OTHER,
00144 } cvrf_note_type_t;
00145
00152 cvrf_note_type_t cvrf_note_get_note_type(const struct cvrf_note *note);
00153
00159 cvrf_note_type_t cvrf_note_type_parse(xmlTextReaderPtr reader);
00160
00166 const char *cvrf_note_type_get_text(cvrf_note_type_t type);
00167
00168
00169
00170
00171
00172 typedef enum {
00173 CVRF_REFERENCE_UNKNOWN = 0,
00174 CVRF_REFERENCE_EXTERNAL,
00175 CVRF_REFERENCE_SELF,
00176 } cvrf_reference_type_t;
00177
00184 cvrf_reference_type_t cvrf_reference_get_reference_type(struct cvrf_reference *reference);
00185
00191 cvrf_reference_type_t cvrf_reference_type_parse(xmlTextReaderPtr reader);
00192
00198 const char *cvrf_reference_type_get_text(cvrf_reference_type_t type);
00199
00200
00201
00202
00203
00204 typedef enum {
00205 CVRF_BRANCH_UNKNOWN = 0,
00206 CVRF_BRANCH_VENDOR,
00207 CVRF_BRANCH_PRODUCT_FAMILY,
00208 CVRF_BRANCH_PRODUCT_NAME,
00209 CVRF_BRANCH_PRODUCT_VERSION,
00210 CVRF_BRANCH_PATCH_LEVEL,
00211 CVRF_BRANCH_SERVICE_PACK,
00212 CVRF_BRANCH_ARCHITECTURE,
00213 CVRF_BRANCH_LANGUAGE,
00214 CVRF_BRANCH_LEGACY,
00215 CVRF_BRANCH_SPECIFICATION,
00216 } cvrf_branch_type_t;
00217
00224 cvrf_branch_type_t cvrf_branch_get_branch_type(struct cvrf_branch *branch);
00225
00231 cvrf_branch_type_t cvrf_branch_type_parse(xmlTextReaderPtr reader);
00232
00238 const char *cvrf_branch_type_get_text(cvrf_branch_type_t type);
00239
00240
00241
00242
00243
00244
00245
00246
00247 typedef enum {
00248 CVRF_RELATIONSHIP_UNKNOWN = 0,
00249 CVRF_RELATIONSHIP_DEFAULT_COMPONENT,
00250 CVRF_RELATIONSHIP_OPTIONAL_COMPONENT,
00251 CVRF_RELATIONSHIP_EXTERNAL_COMPONENT,
00252 CVRF_RELATIONSHIP_INSTALLED_ON,
00253 CVRF_RELATIONSHIP_INSTALLED_WITH,
00254 } cvrf_relationship_type_t;
00255
00262 cvrf_relationship_type_t cvrf_relationship_get_relation_type(struct cvrf_relationship *relation);
00263
00269 cvrf_relationship_type_t cvrf_relationship_type_parse(xmlTextReaderPtr reader);
00270
00276 const char *cvrf_relationship_type_get_text(cvrf_relationship_type_t type);
00277
00278
00279
00280
00281
00282 typedef enum {
00283 CVRF_INVOLVEMENT_UNKNOWN = 0,
00284 CVRF_INVOLVEMENT_OPEN,
00285 CVRF_INVOLVEMENT_DISPUTED,
00286 CVRF_INVOLVEMENT_IN_PROGRESS,
00287 CVRF_INVOLVEMENT_COMPLETED,
00288 CVRF_INVOLVEMENT_CONTACT_ATTEMPTED,
00289 CVRF_INVOLVEMENT_NOT_CONTACTED,
00290 } cvrf_involvement_status_type_t;
00291
00298 cvrf_involvement_status_type_t cvrf_involvement_get_status_type(struct cvrf_involvement *involve);
00299
00305 cvrf_involvement_status_type_t cvrf_involvement_status_type_parse(xmlTextReaderPtr reader);
00306
00312 const char *cvrf_involvement_status_type_get_text(cvrf_involvement_status_type_t type);
00313
00314
00315
00316
00317
00318
00319
00320 typedef enum {
00321 CVRF_PRODUCT_STATUS_UNKNOWN = 0,
00322 CVRF_PRODUCT_STATUS_FIRST_AFFECTED,
00323 CVRF_PRODUCT_STATUS_KNOWN_AFFECTED,
00324 CVRF_PRODUCT_STATUS_KNOWN_NOT_AFFECTED,
00325 CVRF_PRODUCT_STATUS_FIRST_FIXED,
00326 CVRF_PRODUCT_STATUS_FIXED,
00327 CVRF_PRODUCT_STATUS_RECOMMENDED,
00328 CVRF_PRODUCT_STATUS_LAST_AFFECTED,
00329 } cvrf_product_status_type_t;
00330
00331
00338 cvrf_product_status_type_t cvrf_product_status_get_type(struct cvrf_product_status *stat);
00339
00345 cvrf_product_status_type_t cvrf_product_status_type_parse(xmlTextReaderPtr reader);
00346
00352 const char *cvrf_product_status_type_get_text(cvrf_product_status_type_t product_status_type);
00353
00354
00355
00356
00357
00358
00359 typedef enum {
00360 CVRF_THREAT_UNKNOWN = 0,
00361 CVRF_THREAT_IMPACT,
00362 CVRF_THREAT_EXPLOIT_STATUS,
00363 CVRF_THREAT_TARGET_SET,
00364 } cvrf_threat_type_t;
00365
00372 cvrf_threat_type_t cvrf_threat_get_threat_type(struct cvrf_threat *threat);
00373
00379 cvrf_threat_type_t cvrf_threat_type_parse(xmlTextReaderPtr reader);
00380
00386 const char *cvrf_threat_type_get_text(cvrf_threat_type_t threat_type);
00387
00388
00389
00390
00391
00392 typedef enum {
00393 CVRF_REMEDIATION_UNKNOWN = 0,
00394 CVRF_REMEDIATION_WORKAROUND,
00395 CVRF_REMEDIATION_MITIGATION,
00396 CVRF_REMEDIATION_VENDOR_FIX,
00397 CVRF_REMEDIATION_NONE_AVAILABLE,
00398 CVRF_REMEDIATION_WILL_NOT_FIX,
00399 } cvrf_remediation_type_t;
00400
00407 cvrf_remediation_type_t cvrf_remediation_get_type(struct cvrf_remediation *remed);
00408
00414 cvrf_remediation_type_t cvrf_remediation_type_parse(xmlTextReaderPtr reader);
00415
00421 const char *cvrf_remediation_type_get_text(cvrf_remediation_type_t remediation_type);
00422
00423
00424
00425
00426
00427
00428
00429 struct cvrf_item_spec;
00430
00431 typedef enum {
00432 CVRF_ITEM_UNKNOWN = 0,
00433 CVRF_DOCUMENT_PUBLISHER,
00434 CVRF_DOCUMENT_TRACKING,
00435 CVRF_REVISION,
00436 CVRF_DOCUMENT_NOTE,
00437 CVRF_DOCUMENT_REFERENCE,
00438 CVRF_ACKNOWLEDGMENT,
00439 CVRF_PRODUCT_TREE,
00440 CVRF_BRANCH,
00441 CVRF_GROUP,
00442 CVRF_RELATIONSHIP,
00443 CVRF_PRODUCT_NAME,
00444 CVRF_VULNERABILITY,
00445 CVRF_VULNERABILITY_CWE,
00446 CVRF_NOTE,
00447 CVRF_INVOLVEMENT,
00448 CVRF_SCORE_SET,
00449 CVRF_PRODUCT_STATUS,
00450 CVRF_THREAT,
00451 CVRF_REMEDIATION,
00452 CVRF_REFERENCE,
00453 } cvrf_item_type_t;
00454
00460 const char *cvrf_item_type_get_text(cvrf_item_type_t type);
00461
00467 cvrf_item_type_t cvrf_item_type_from_text(const char *item);
00468
00473 bool cvrf_is_valid_item_type(const char *item);
00474
00480 const char *cvrf_item_type_get_container(cvrf_item_type_t type);
00481
00488 bool cvrf_item_type_has_container(cvrf_item_type_t type);
00489
00490
00491
00492
00493
00494
00500 struct cvrf_remediation *cvrf_remediation_parse(xmlTextReaderPtr reader);
00501
00507 struct cvrf_score_set *cvrf_score_set_parse(xmlTextReaderPtr reader);
00508
00514 struct cvrf_threat *cvrf_threat_parse(xmlTextReaderPtr reader);
00515
00521 struct cvrf_product_status *cvrf_product_status_parse(xmlTextReaderPtr reader);
00522
00528 struct cvrf_involvement *cvrf_involvement_parse(xmlTextReaderPtr reader);
00529
00535 struct cvrf_vulnerability_cwe *cvrf_vulnerability_cwe_parse(xmlTextReaderPtr reader);
00536
00542 struct cvrf_vulnerability *cvrf_vulnerability_parse(xmlTextReaderPtr reader);
00543
00549 struct cvrf_product_name *cvrf_product_name_parse(xmlTextReaderPtr reader);
00550
00556 struct cvrf_group *cvrf_group_parse(xmlTextReaderPtr reader);
00557
00563 struct cvrf_relationship *cvrf_relationship_parse(xmlTextReaderPtr reader);
00564
00570 struct cvrf_branch *cvrf_branch_parse(xmlTextReaderPtr reader);
00571
00577 struct cvrf_product_tree *cvrf_product_tree_parse(xmlTextReaderPtr reader);
00578
00584 struct cvrf_acknowledgment *cvrf_acknowledgment_parse(xmlTextReaderPtr reader);
00585
00591 struct cvrf_reference *cvrf_reference_parse(xmlTextReaderPtr reader);
00592
00598 struct cvrf_note *cvrf_note_parse(xmlTextReaderPtr reader);
00599
00605 struct cvrf_revision *cvrf_revision_parse(xmlTextReaderPtr reader);
00606
00612 struct cvrf_doc_tracking *cvrf_doc_tracking_parse(xmlTextReaderPtr reader);
00613
00619 struct cvrf_doc_publisher *cvrf_doc_publisher_parse(xmlTextReaderPtr reader);
00620
00627 struct cvrf_document *cvrf_document_parse(xmlTextReaderPtr reader);
00628
00634 struct cvrf_model *cvrf_model_parse(xmlTextReaderPtr reader);
00635
00641 struct cvrf_index *cvrf_index_parse_xml(struct oscap_source *index_source);
00642
00643
00651 void cvrf_element_add_container(struct oscap_list *list, cvrf_item_type_t cvrf_type, xmlNode *parent);
00652
00660 void cvrf_element_add_stringlist(struct oscap_stringlist *list, const char *tag_name, xmlNode *parent);
00661
00669 void cvrf_element_add_attribute(const char *attr_name, const char *attr_value, xmlNode *element);
00670
00678 void cvrf_element_add_child(const char *elm_name, const char *elm_value, xmlNode *parent);
00679
00686 xmlNode *cvrf_element_to_dom(const char *elm_name, const char *elm_value);
00687
00694 xmlNode *cvrf_remediation_to_dom(const struct cvrf_remediation *remed);
00695
00702 xmlNode *cvrf_threat_to_dom(const struct cvrf_threat *threat);
00703
00710 xmlNode *cvrf_score_set_to_dom(const struct cvrf_score_set *score_set);
00711
00718 xmlNode *cvrf_product_status_to_dom(const struct cvrf_product_status *stat);
00719
00726 xmlNode *cvrf_involvement_to_dom(const struct cvrf_involvement *involve);
00727
00734 xmlNode *cvrf_vulnerability_cwe_to_dom(const struct cvrf_vulnerability_cwe *vuln_cwe);
00735
00742 xmlNode *cvrf_vulnerability_to_dom(const struct cvrf_vulnerability *vuln);
00743
00750 xmlNode *cvrf_product_name_to_dom(struct cvrf_product_name *full_name);
00751
00758 xmlNode *cvrf_group_to_dom(const struct cvrf_group *group);
00759
00766 xmlNode *cvrf_relationship_to_dom(const struct cvrf_relationship *relation);
00767
00774 xmlNode *cvrf_branch_to_dom(struct cvrf_branch *branch);
00775
00782 xmlNode *cvrf_product_tree_to_dom(struct cvrf_product_tree *tree);
00783
00790 xmlNode *cvrf_acknowledgment_to_dom(struct cvrf_acknowledgment *ack);
00791
00798 xmlNode *cvrf_reference_to_dom(struct cvrf_reference *ref);
00799
00807 xmlNode *cvrf_note_to_dom(struct cvrf_note *note);
00808
00815 xmlNode *cvrf_revision_to_dom(struct cvrf_revision *revision);
00816
00823 xmlNode *cvrf_doc_tracking_to_dom(struct cvrf_doc_tracking *tracking);
00824
00831 xmlNode *cvrf_doc_publisher_to_dom(struct cvrf_doc_publisher *publisher);
00832
00840 xmlNode *cvrf_document_to_dom(struct cvrf_document *document);
00841
00850 xmlNode *cvrf_model_to_dom(struct cvrf_model *model, xmlDocPtr doc, xmlNode *parent, void *user_args);
00851
00859 xmlNode *cvrf_index_to_dom(struct cvrf_index *index, xmlDocPtr doc, xmlNode *parent, void *user_args);
00860
00861 bool cvrf_product_vulnerability_fixed(struct cvrf_vulnerability *vuln, const char *product);
00862
00863 OSCAP_HIDDEN_END;
00864
00865 #endif