Open SCAP Library

cvrf.h

Go to the documentation of this file.
00001 
00029 #ifndef _CVRF_H_
00030 #define _CVRF_H_
00031 
00032 #include <stdbool.h>
00033 #include "oscap.h"
00034 #include "oscap_source.h"
00035 #include "cvss_score.h"
00036 
00037 
00038 /************************************************************************************************
00039  * @struct cvrf_product_status
00040  * Structure holding CVRF Status element (within a ProductStatuses container)
00041  * Contains a list of ProductIDs and their status with respect to the parent Vulnerability
00042  *
00043  * PARENT NODE: ProductStatuses container (which is child of Vulnerability)
00044  * REQUIRED: Type attribute [max. 1], ProductID(s) [min. 1, max. unbounded]
00045  */
00046 struct cvrf_product_status;
00047 
00053 struct cvrf_product_status *cvrf_product_status_new(void);
00054 
00060 void cvrf_product_status_free(struct cvrf_product_status *status);
00061 
00067 struct cvrf_product_status *cvrf_product_status_clone(const struct cvrf_product_status *stat);
00068 
00074 struct oscap_string_iterator *cvrf_product_status_get_ids(struct cvrf_product_status *stat);
00075 
00076 
00077 /************************************************************************************************
00078  * @struct cvrf_threat
00079  * Gives context about the type of Vulnerability and how much threat it poses
00080  * Contained within a list representing a Threats container in Vulnerability structure
00081  *
00082  * PARENT NODE: Threats container (which is child of Vulnerability)
00083  * REQUIRED: Type attribute [max 1], Description element [max. 1]
00084  * OPTIONAL: ProductID(s) [min. 0, max. unbounded], GroupID(s) [min. 0, max.unbounded]
00085  */
00086 struct cvrf_threat;
00087 
00093 struct cvrf_threat *cvrf_threat_new(void);
00094 
00100 void cvrf_threat_free(struct cvrf_threat *threat);
00101 
00107 struct cvrf_threat *cvrf_threat_clone(const struct cvrf_threat *threat);
00108 
00115 const char *cvrf_threat_get_date(const struct cvrf_threat *threat);
00116 
00123 const char *cvrf_threat_get_description(const struct cvrf_threat *threat);
00124 
00132 struct oscap_string_iterator *cvrf_threat_get_product_ids(struct cvrf_threat *threat);
00133 
00141 struct oscap_string_iterator *cvrf_threat_get_group_ids(struct cvrf_threat *threat);
00142 
00149 bool cvrf_threat_set_date(struct cvrf_threat *threat, const char *date);
00150 
00157 bool cvrf_threat_set_description(struct cvrf_threat *threat, const char *description);
00158 
00159 
00160 /************************************************************************************************
00161  * @struct cvrf_remediation
00162  * Structure holding info for handling or fixing a particular Vulnerability
00163  *
00164  * PARENT NODE: Remediations container (which is child of Vulnerability)
00165  * REQUIRED: Type attribute [max: 1], Description element [max: 1]
00166  * OPTIONAL: ProductID(s) [min: 0, max: unbounded], GroupID(s) [min: 0, max: unbounded],
00167  *              Entitlement element [min: 0, max: 1], URL element [min: 0, max: 1]
00168  */
00169 struct cvrf_remediation;
00170 
00176 struct cvrf_remediation *cvrf_remediation_new(void);
00177 
00183 void cvrf_remediation_free(struct cvrf_remediation *remed);
00184 
00190 struct cvrf_remediation *cvrf_remediation_clone(const struct cvrf_remediation *remed);
00191 
00198 const char *cvrf_remediation_get_date(const struct cvrf_remediation *remed);
00199 
00206 const char *cvrf_remediation_get_description(const struct cvrf_remediation *remed);
00207 
00214 const char *cvrf_remediation_get_url(const struct cvrf_remediation *remed);
00215 
00222 const char *cvrf_remediation_get_entitlement(const struct cvrf_remediation *remed);
00223 
00231 struct oscap_string_iterator *cvrf_remediation_get_product_ids(struct cvrf_remediation *remed);
00232 
00240 struct oscap_string_iterator *cvrf_remediation_get_group_ids(struct cvrf_remediation *remed);
00241 
00248 bool cvrf_remediation_set_date(struct cvrf_remediation *remed, const char *date);
00249 
00256 bool cvrf_remediation_set_description(struct cvrf_remediation *remed, const char *description);
00257 
00264 bool cvrf_remediation_set_url(struct cvrf_remediation *remed, const char *url);
00265 
00272 bool cvrf_remediation_set_entitlement(struct cvrf_remediation *remed, const char *entitlement);
00273 
00274 
00275 /************************************************************************************************
00276  * @struct cvrf_score_set
00277  * Contains CVSS metrics for a given Vulnerability. No ProductID indicates that it pertains to all
00278  * Products in a given CVRF file
00279  *
00280  * PARENT NODE: CVSSScoreSets container (which is child of Vulnerability)
00281  * REQUIRED: BaseScore element [max: 1]
00282  * OPTIONAL: TemporalScore element [min: 0, max:1], EnvironmentalScore element [min: 0, max: 1],
00283  *               ProductID(s) [min: 0, max: unbounded], Vector element [min: 0, max: 1]
00284  */
00285 struct cvrf_score_set;
00286 
00292 struct cvrf_score_set *cvrf_score_set_new(void);
00293 
00299 void cvrf_score_set_free(struct cvrf_score_set *score_set);
00300 
00306 struct cvrf_score_set *cvrf_score_set_clone(const struct cvrf_score_set *score_set);
00307 
00314 const char *cvrf_score_set_get_vector(const struct cvrf_score_set *score_set);
00315 
00323 struct oscap_string_iterator *cvrf_score_set_get_product_ids(struct cvrf_score_set *score_set);
00324 
00330 struct cvss_impact *cvrf_score_set_get_impact(const struct cvrf_score_set *score_set);
00331 
00338 char *cvrf_score_set_get_base_score(const struct cvrf_score_set *score_set);
00339 
00346 char *cvrf_score_set_get_environmental_score(const struct cvrf_score_set *score_set);
00347 
00354 char *cvrf_score_set_get_temporal_score(const struct cvrf_score_set *score_set);
00355 
00362 bool cvrf_score_set_set_vector(struct cvrf_score_set *score_set, const char *vector);
00363 
00370 bool cvrf_score_set_set_impact(struct cvrf_score_set *score_set, struct cvss_impact *impact);
00371 
00379 bool cvrf_score_set_add_metric(struct cvrf_score_set *score_set, enum cvss_category category, const char *score);
00380 
00381 
00382 /************************************************************************************************
00383  * @struct cvrf_involvement
00384  * Gives information about the Document Publisher's level of involvement
00385  * The 'Party' attribute gives the type of publisher (identical to DocumentPublisher Type)
00386  *
00387  * PARENT NODE: Involvements container
00388  * REQUIRED: Status attribute [max: 1], Party attribute [max: 1]
00389  * OPTIONAL: Description element [min: 0, max: 1]
00390  */
00391 struct cvrf_involvement;
00392 
00398 struct cvrf_involvement *cvrf_involvement_new(void);
00399 
00405 void cvrf_involvement_free(struct cvrf_involvement *involve);
00406 
00412 struct cvrf_involvement *cvrf_involvement_clone(const struct cvrf_involvement *involve);
00413 
00420 const char *cvrf_involvement_get_description(const struct cvrf_involvement *involve);
00421 
00428 bool cvrf_involvement_set_description(struct cvrf_involvement *involve, const char *description);
00429 
00430 /************************************************************************************************
00431  * @struct cvrf_vulnerability_cwe
00432  *
00433  * PARENT NODE: Vulnerability
00434  * REQUIRED: ID attribute [max: 1], CWE string content [max: 1]
00435  */
00436 struct cvrf_vulnerability_cwe;
00437 
00443 struct cvrf_vulnerability_cwe *cvrf_vulnerability_cwe_new(void);
00444 
00450 void cvrf_vulnerability_cwe_free(struct cvrf_vulnerability_cwe *cwe);
00451 
00457 struct cvrf_vulnerability_cwe *cvrf_vulnerability_cwe_clone(const struct cvrf_vulnerability_cwe *cwe);
00458 
00465 const char *cvrf_vulnerability_cwe_get_cwe(const struct cvrf_vulnerability_cwe *vuln_cwe);
00466 
00473 const char *cvrf_vulnerability_cwe_get_id(const struct cvrf_vulnerability_cwe *vuln_cwe);
00474 
00475 
00482 bool cvrf_vulnerability_cwe_set_cwe(struct cvrf_vulnerability_cwe *vuln_cwe, const char *cwe);
00483 
00490 bool cvrf_vulnerability_cwe_set_id(struct cvrf_vulnerability_cwe *vuln_cwe, const char *id);
00491 
00492 /************************************************************************************************
00493  * @struct cvrf_vulnerability
00494  * Provides information about Vulnerabilities for products and packages referenced in
00495  * ProductTree branches and relationships
00496  *
00497  * PARENT NODE: cvrfdoc
00498  * REQUIRED: Ordinal attribute [max: 1]
00499  * OPTIONAL: Title element [min: 0, max:1], ID element [min: 0, max: 1], DiscoveryDate element [min: 0, max: 1],
00500  *              ReleaseDate element [min: 0, max: 1], Description element [min: 0, max: 1], CVE element [min: 0, max: 1],
00501  *              CWE ID(s) [min: 0, max: unbounded]
00502  *
00503  * CONTAINERS: Notes, Involvements, ProductStatuses, Threats, CVSSScoreSets, Remediations,
00504  *              References, Acknowledgments [min: 0, max: 1 for all containers]
00505  */
00506 struct cvrf_vulnerability;
00507 
00513 struct cvrf_vulnerability *cvrf_vulnerability_new(void);
00514 
00520 void cvrf_vulnerability_free(struct cvrf_vulnerability *vulnerability);
00521 
00527 struct cvrf_vulnerability *cvrf_vulnerability_clone(const struct cvrf_vulnerability *vuln);
00528 
00535 int cvrf_vulnerability_filter_by_product(struct cvrf_vulnerability *vuln, const char *prod);
00536 
00543 int cvrf_vulnerability_get_ordinal(const struct cvrf_vulnerability *vuln);
00544 
00551 const char *cvrf_vulnerability_get_title(const struct cvrf_vulnerability *vuln);
00552 
00559 const char *cvrf_vulnerability_get_system_id(const struct cvrf_vulnerability *vuln);
00560 
00567 const char *cvrf_vulnerability_get_system_name(const struct cvrf_vulnerability *vuln);
00568 
00575 const char *cvrf_vulnerability_get_discovery_date(const struct cvrf_vulnerability *vuln);
00576 
00583 const char *cvrf_vulnerability_get_release_date(const struct cvrf_vulnerability *vuln);
00584 
00591 const char *cvrf_vulnerability_get_cve_id(const struct cvrf_vulnerability *vuln);
00592 
00599 bool cvrf_vulnerability_set_ordinal(struct cvrf_vulnerability *vuln, int ordinal);
00600 
00607 bool cvrf_vulnerability_set_title(struct cvrf_vulnerability *vuln, const char *vulnerability_title);
00608 
00615 bool cvrf_vulnerability_set_system_id(struct cvrf_vulnerability *vuln, const char *id);
00616 
00623 bool cvrf_vulnerability_set_system_name(struct cvrf_vulnerability *vuln, const char *sys_name);
00624 
00631 bool cvrf_vulnerability_set_discovery_date(struct cvrf_vulnerability *vuln, const char *discovery_date);
00632 
00639 bool cvrf_vulnerability_set_release_date(struct cvrf_vulnerability *vuln, const char *release_date);
00640 
00647 bool cvrf_vulnerability_set_cve_id(struct cvrf_vulnerability *vuln, const char *cve_id);
00648 
00649 
00650 /*-------------------------------------------------------------------------*\
00651 |                               Iterators of child elements of Vulnerability                            |
00652 \*-------------------------------------------------------------------------*/
00653 
00659 struct oscap_iterator *cvrf_vulnerability_get_references(struct cvrf_vulnerability *vuln);
00660 
00666 struct oscap_iterator *cvrf_vulnerability_get_acknowledgments(struct cvrf_vulnerability *vuln);
00667 
00673 struct oscap_iterator *cvrf_vulnerability_get_notes(struct cvrf_vulnerability *vuln);
00674 
00675 /*******************************************
00676  * @struct cvrf_vulnerability_cwe_iterator
00677  * Iterator representing all CWE elements in the Vulnerability
00678  * Contained as a list within the CVRF Vulnerability structure
00679  */
00680 struct cvrf_vulnerability_cwe_iterator;
00681 
00688 bool cvrf_vulnerability_add_vulnerability_cwe(struct cvrf_vulnerability *vuln, struct cvrf_vulnerability_cwe *vulnerability_cwe);
00689 
00695 struct cvrf_vulnerability_cwe_iterator *cvrf_vulnerability_get_vulnerability_cwes(const struct cvrf_vulnerability *vuln);
00696 
00702 struct cvrf_vulnerability_cwe *cvrf_vulnerability_cwe_iterator_next(struct cvrf_vulnerability_cwe_iterator *it);
00703 
00709 bool cvrf_vulnerability_cwe_iterator_has_more(struct cvrf_vulnerability_cwe_iterator *it);
00710 
00716 void cvrf_vulnerability_cwe_iterator_free(struct cvrf_vulnerability_cwe_iterator *it);
00717 
00723 void cvrf_vulnerability_cwe_iterator_reset(struct cvrf_vulnerability_cwe_iterator *it);
00724 
00730 void cvrf_vulnerability_cwe_iterator_remove(struct cvrf_vulnerability_cwe_iterator *it);
00731 
00732 /*******************************************
00733  * @struct cvrf_involvement_iterator
00734  * Iterator representing all Involvement elements in the Involvements container
00735  * Contained as a list within the CVRF Vulnerability structure
00736  */
00737 struct cvrf_involvement_iterator;
00738 
00745 bool cvrf_vulnerability_add_involvement(struct cvrf_vulnerability *vuln, struct cvrf_involvement *involvement);
00746 
00752 struct cvrf_involvement_iterator *cvrf_vulnerability_get_involvements(const struct cvrf_vulnerability *vuln);
00753 
00759 struct cvrf_involvement *cvrf_involvement_iterator_next(struct cvrf_involvement_iterator *it);
00760 
00766 bool cvrf_involvement_iterator_has_more(struct cvrf_involvement_iterator *it);
00767 
00773 void cvrf_involvement_iterator_free(struct cvrf_involvement_iterator *it);
00774 
00780 void cvrf_involvement_iterator_reset(struct cvrf_involvement_iterator *it);
00781 
00787 void cvrf_involvement_iterator_remove(struct cvrf_involvement_iterator *it);
00788 
00789 /*******************************************
00790  * @struct cvrf_score_set_iterator
00791  * Iterator representing all ScoreSet elements in the CVSSScoreSets container
00792  * Contained as a list within the CVRF Vulnerability structure
00793  */
00794 struct cvrf_score_set_iterator;
00795 
00802 bool cvrf_vulnerability_add_score_set(struct cvrf_vulnerability *vuln, struct cvrf_score_set *score_set);
00803 
00809 struct cvrf_score_set_iterator *cvrf_vulnerability_get_score_sets(const struct cvrf_vulnerability *vuln);
00810 
00816 struct cvrf_score_set *cvrf_score_set_iterator_next(struct cvrf_score_set_iterator *it);
00817 
00823 bool cvrf_score_set_iterator_has_more(struct cvrf_score_set_iterator *it);
00824 
00830 void cvrf_score_set_iterator_free(struct cvrf_score_set_iterator *it);
00831 
00837 void cvrf_score_set_iterator_reset(struct cvrf_score_set_iterator *it);
00838 
00844 void cvrf_score_set_iterator_remove(struct cvrf_score_set_iterator *it);
00845 
00846 /*******************************************
00847  * @struct cvrf_product_status_iterator
00848  * Iterator representing all Status elements in the ProductStatuses container
00849  * Contained as a list within the CVRF Vulnerability structure
00850  */
00851 struct cvrf_product_status_iterator;
00852 
00859 bool cvrf_vulnerability_add_cvrf_product_status(struct cvrf_vulnerability *vuln, struct cvrf_product_status *stat);
00860 
00866 struct cvrf_product_status_iterator *cvrf_vulnerability_get_product_statuses(const struct cvrf_vulnerability *vuln);
00867 
00873 struct cvrf_product_status *cvrf_product_status_iterator_next(struct cvrf_product_status_iterator *it);
00874 
00880 bool cvrf_product_status_iterator_has_more(struct cvrf_product_status_iterator *it);
00881 
00887 void cvrf_product_status_iterator_free(struct cvrf_product_status_iterator *it);
00888 
00894 void cvrf_product_status_iterator_reset(struct cvrf_product_status_iterator *it);
00895 
00901 void cvrf_product_status_iterator_remove(struct cvrf_product_status_iterator *it);
00902 
00903 /*******************************************
00904  * @struct cvrf_remediation_iterator
00905  * Iterator representing all Remediation elements in the Remediations container
00906  * Contained as a list within the CVRF Vulnerability structure
00907  */
00908 struct cvrf_remediation_iterator;
00909 
00916 bool cvrf_vulnerability_add_remediation(struct cvrf_vulnerability *vuln, struct cvrf_remediation *remed);
00917 
00923 struct cvrf_remediation_iterator *cvrf_vulnerability_get_remediations(const struct cvrf_vulnerability *vuln);
00924 
00930 struct cvrf_remediation *cvrf_remediation_iterator_next(struct cvrf_remediation_iterator *it);
00931 
00937 bool cvrf_remediation_iterator_has_more(struct cvrf_remediation_iterator *it);
00938 
00944 void cvrf_remediation_iterator_free(struct cvrf_remediation_iterator *it);
00945 
00951 void cvrf_remediation_iterator_reset(struct cvrf_remediation_iterator *it);
00952 
00958 void cvrf_remediation_iterator_remove(struct cvrf_remediation_iterator *it);
00959 
00960 /*******************************************
00961  * @struct cvrf_threat_iterator
00962  * Iterator representing all Threat elements in the Threats container
00963  * Contained as a list within the CVRF Vulnerability structure
00964  */
00965 struct cvrf_threat_iterator;
00966 
00973 bool cvrf_vulnerability_add_threat(struct cvrf_vulnerability *vuln, struct cvrf_threat *threat);
00974 
00980 struct cvrf_threat_iterator *cvrf_vulnerability_get_threats(const struct cvrf_vulnerability *vuln);
00981 
00987 struct cvrf_threat *cvrf_threat_iterator_next(struct cvrf_threat_iterator *it);
00988 
00994 bool cvrf_threat_iterator_has_more(struct cvrf_threat_iterator *it);
00995 
01001 void cvrf_threat_iterator_free(struct cvrf_threat_iterator *it);
01002 
01008 void cvrf_threat_iterator_reset(struct cvrf_threat_iterator *it);
01009 
01015 void cvrf_threat_iterator_remove(struct cvrf_threat_iterator *it);
01016 
01017 /************************************************************************************************
01018  * @struct cvrf_product_name
01019  * Represents FullProductName element, which is a child of both Branch and Relationship elements
01020  * Links a CPE to its ProductID or a package ProductID. No two FullProductName elements can
01021  * have the same ProductID
01022  *
01023  * PARENT NODE: ProductTree, Branch, or Relationship
01024  * REQUIRED: ProductID attribute [max: 1], CPE element [max: 1]
01025  */
01026 struct cvrf_product_name;
01027 
01033 struct cvrf_product_name *cvrf_product_name_new(void);
01034 
01040 void cvrf_product_name_free(struct cvrf_product_name *full_name);
01041 
01047 struct cvrf_product_name *cvrf_product_name_clone(const struct cvrf_product_name *full_name);
01048 
01055 const char *cvrf_product_name_get_product_id(const struct cvrf_product_name *full_name);
01056 
01063 const char *cvrf_product_name_get_cpe(const struct cvrf_product_name *full_name);
01064 
01071 bool cvrf_product_name_set_product_id(struct cvrf_product_name *full_name, const char *product_id);
01072 
01079 bool cvrf_product_name_set_cpe(struct cvrf_product_name *full_name, const char *cpe);
01080 
01081 /************************************************************************************************
01082  * @struct cvrf_group
01083  * Structure that categorically groups different products referenced in the document.
01084  * One ProductID is used per group member. The GroupID can be used as a reference for
01085  * other elements.
01086  *
01087  * PARENT NODE: ProductGroups container (which is a child of ProductTree)
01088  * REQUIRED: GroupID attribute [max: 1], ProductID element [min:2, max: unbounded]
01089  * OPTIONAL: Description element [min: 0, max: 1]
01090  */
01091 struct cvrf_group;
01092 
01098 struct cvrf_group *cvrf_group_new(void);
01099 
01105 void cvrf_group_free(struct cvrf_group *group);
01106 
01112 struct cvrf_group *cvrf_group_clone(const struct cvrf_group *group);
01113 
01120 const char *cvrf_group_get_group_id(const struct cvrf_group *group);
01121 
01128 const char *cvrf_group_get_description(const struct cvrf_group *group);
01129 
01136 bool cvrf_group_set_group_id(struct cvrf_group *group, const char *group_id);
01137 
01144 bool cvrf_group_set_description(struct cvrf_group *group, const char *description);
01145 
01152 struct oscap_string_iterator *cvrf_group_get_product_ids(struct cvrf_group *group);
01153 
01154 
01155 /************************************************************************************************
01156  * @struct cvrf_relationship
01157  * Structure within a parent ProductTree. Establishes a link between two products (FullProductNames)
01158  * referenced in the document. Thus, at least two FullProductName elements must exist in the document.
01159  *
01160  * PARENT NODE: ProductTree
01161  * REQUIRED: ProductReference attribute [max: 1], RelationType attribute [max: 1],
01162  *              RelatesToProductReference attribute [max: 1], FullProductName element [max: 1]
01163  */
01164 struct cvrf_relationship;
01165 
01171 struct cvrf_relationship *cvrf_relationship_new(void);
01172 
01178 void cvrf_relationship_free(struct cvrf_relationship *relationship);
01179 
01185 struct cvrf_relationship *cvrf_relationship_clone(const struct cvrf_relationship *relation);
01186 
01193 const char *cvrf_relationship_get_product_reference(const struct cvrf_relationship *relation);
01194 
01201 const char *cvrf_relationship_get_relates_to_ref(const struct cvrf_relationship *relation);
01202 
01209 struct cvrf_product_name *cvrf_relationship_get_product_name(const struct cvrf_relationship *relation);
01210 
01217 bool cvrf_relationship_set_product_reference(struct cvrf_relationship *relation, const char *product_reference);
01218 
01225 bool cvrf_relationship_set_relates_to_ref(struct cvrf_relationship *relation, const char *relates_to_ref);
01226 
01233 bool cvrf_relationship_set_product_name(struct cvrf_relationship *relation, struct cvrf_product_name *name);
01234 
01235 /************************************************************************************************
01236  * @struct cvrf_branch
01237  * Establishes hierarchy and relationships between different CPEs, products, and packages
01238  * Can only have one type of child element: a FullProductName or more Branches
01239  *
01240  * PARENT NODE: ProductTree or Branch
01241  * REQUIRED: Name attribute [max: 1], Type attribute [max: 1], EITHER FullProductName element [max: 1] OR
01242  *              child Branch elements [min: 1, max: unbounded]
01243  */
01244 struct cvrf_branch;
01245 
01251 struct cvrf_branch *cvrf_branch_new(void);
01252 
01258 void cvrf_branch_free(struct cvrf_branch *branch);
01259 
01265 struct cvrf_branch *cvrf_branch_clone(const struct cvrf_branch *branch);
01266 
01273 const char *cvrf_branch_get_branch_name(const struct cvrf_branch *branch);
01274 
01281 struct cvrf_product_name *cvrf_branch_get_product_name(const struct cvrf_branch *branch);
01282 
01289 struct oscap_iterator *cvrf_branch_get_subbranches(struct cvrf_branch *branch);
01290 
01297 bool cvrf_branch_set_branch_name(struct cvrf_branch *branch, const char *branch_name);
01298 
01305 bool cvrf_branch_set_product_name(struct cvrf_branch *branch, struct cvrf_product_name *name);
01306 
01307 /************************************************************************************************
01308  *@struct cvrf_product_tree
01309  * Relates information about CPEs, their given ProductIDs, packages and their given ProductIDs through
01310  * Branch and Relationship child elements
01311  *
01312  * PARENT NODE: cvrfdoc
01313  * OPTIONAL: FullProductName element [min: 0, max: unbounded], Branch element [min: 0, max: unbounded],
01314  *              Relationship element [min: 0, max: unbounded]
01315  */
01316 struct cvrf_product_tree;
01317 
01323 struct cvrf_product_tree *cvrf_product_tree_new(void);
01324 
01331 void cvrf_product_tree_free(struct cvrf_product_tree *tree);
01332 
01338 struct cvrf_product_tree *cvrf_product_tree_clone(const struct cvrf_product_tree *tree);
01339 
01349 const char *get_cvrf_product_id_from_cpe(struct cvrf_product_tree *tree, const char *cpe);
01350 
01359 int cvrf_product_tree_filter_by_cpe(struct cvrf_product_tree *tree, const char *cpe);
01360 
01361 /*---------------------------------------------------------------------*\
01362 |                               Iterators of child elements of ProductTree                              |
01363 \*---------------------------------------------------------------------*/
01364 
01365 struct oscap_iterator *cvrf_product_tree_get_branches(struct cvrf_product_tree *tree);
01366 
01367 /*******************************************
01368  * @struct cvrf_product_name_iterator
01369  * Iterator representing all FullProductName elements in the ProductTree
01370  * Contained as a list within the CVRF ProductTree structure
01371  */
01372 struct cvrf_product_name_iterator;
01373 
01380 bool cvrf_product_tree_add_product_name(struct cvrf_product_tree *tree, struct cvrf_product_name *full_name);
01381 
01387 struct cvrf_product_name_iterator *cvrf_product_tree_get_product_names(const struct cvrf_product_tree *tree);
01388 
01394 struct cvrf_product_name *cvrf_product_name_iterator_next(struct cvrf_product_name_iterator *it);
01395 
01401 bool cvrf_product_name_iterator_has_more(struct cvrf_product_name_iterator *it);
01402 
01408 void cvrf_product_name_iterator_free(struct cvrf_product_name_iterator *it);
01409 
01415 void cvrf_product_name_iterator_reset(struct cvrf_product_name_iterator *it);
01416 
01422 void cvrf_product_name_iterator_remove(struct cvrf_product_name_iterator *it);
01423 
01424 /*******************************************
01425  * @struct cvrf_relationship_iterator
01426  * Iterator representing all Relationship elements in the ProductTree
01427  * Contained as a list within the CVRF Relationship structure
01428  */
01429 struct cvrf_relationship_iterator;
01430 
01437 bool cvrf_product_tree_add_relationship(struct cvrf_product_tree *tree, struct cvrf_relationship *relation);
01438 
01444 struct cvrf_relationship_iterator *cvrf_product_tree_get_relationships(const struct cvrf_product_tree *tree);
01445 
01451 struct cvrf_relationship *cvrf_relationship_iterator_next(struct cvrf_relationship_iterator *it);
01452 
01458 bool cvrf_relationship_iterator_has_more(struct cvrf_relationship_iterator *it);
01459 
01465 void cvrf_relationship_iterator_free(struct cvrf_relationship_iterator *it);
01466 
01472 void cvrf_relationship_iterator_reset(struct cvrf_relationship_iterator *it);
01473 
01479 void cvrf_relationship_iterator_remove(struct cvrf_relationship_iterator *it);
01480 
01481 
01482 /*******************************************
01483  * @struct cvrf_group_iterator
01484  * Iterator representing all Group elements in the ProductTree
01485  * Contained as a list within the CVRF ProductTree structure
01486  */
01487 struct cvrf_group_iterator;
01488 
01495 bool cvrf_product_tree_add_group(struct cvrf_product_tree *tree, struct cvrf_group *group);
01496 
01502 struct cvrf_group_iterator *cvrf_product_tree_get_product_groups(const struct cvrf_product_tree *tree);
01503 
01509 struct cvrf_group *cvrf_group_iterator_next(struct cvrf_group_iterator *it);
01510 
01516 bool cvrf_group_iterator_has_more(struct cvrf_group_iterator *it);
01517 
01523 void cvrf_group_iterator_free(struct cvrf_group_iterator *it);
01524 
01530 void cvrf_group_iterator_reset(struct cvrf_group_iterator *it);
01531 
01537 void cvrf_group_iterator_remove(struct cvrf_group_iterator *it);
01538 
01539 
01540 /************************************************************************************************
01541  * @struct cvrf_acknowledgment
01542  * Metadata giving recognition of external parties who provided information, suggestions, or
01543  * other contributions
01544  *
01545  * PARENT NODE: Acknowledgments container (in cvrfdoc or in Vulnerability)
01546  * OPTIONAL: Name element(s) [min: 0, max: unbounded], Organization(s) element [min: 0, max: unbounded],
01547  *              Description element [min: 0, max: 1], URL element(s) [min: 0, max: unbounded]
01548  */
01549 struct cvrf_acknowledgment;
01550 
01556 struct cvrf_acknowledgment *cvrf_acknowledgment_new(void);
01557 
01563 void cvrf_acknowledgment_free(struct cvrf_acknowledgment *ack);
01564 
01570 struct cvrf_acknowledgment *cvrf_acknowledgment_clone(const struct cvrf_acknowledgment *ack);
01571 
01578 const char *cvrf_acknowledgment_get_description(const struct cvrf_acknowledgment *ack);
01579 
01586 bool cvrf_acknowledgment_set_description(struct cvrf_acknowledgment *ack, const char *description);
01587 
01594 struct oscap_string_iterator *cvrf_acknowledgment_get_names(const struct cvrf_acknowledgment *ack);
01595 
01602 struct oscap_string_iterator *cvrf_acknowledgment_get_organizations(const struct cvrf_acknowledgment *ack);
01603 
01610 struct oscap_string_iterator *cvrf_acknowledgment_get_urls(const struct cvrf_acknowledgment *ack);
01611 
01612 /************************************************************************************************
01613  * @struct cvrf_note
01614  *
01615  * PARENT NODE: DocumentNotes container or Notes container
01616  * REQUIRED: Type attribute [min: 1, max: 1], Ordinal attribute [min: 1, max: 1],
01617  * OPTIONAL: Audience attribute [min: 0, max: 1], Title attribute [min: 0, max: 1]
01618  */
01619 struct cvrf_note;
01620 
01626 struct cvrf_note *cvrf_note_new(void);
01627 
01633 void cvrf_note_free(struct cvrf_note *note);
01634 
01640 struct cvrf_note *cvrf_note_clone(const struct cvrf_note *note);
01641 
01648 int cvrf_note_get_ordinal(const struct cvrf_note *note);
01649 
01656 const char *cvrf_note_get_audience(const struct cvrf_note *note);
01657 
01664 const char *cvrf_note_get_title(const struct cvrf_note *note);
01665 
01672 const char *cvrf_note_get_contents(const struct cvrf_note *note);
01673 
01680 bool cvrf_note_set_ordinal(struct cvrf_note *note, int ordinal);
01681 
01688 bool cvrf_note_set_audience(struct cvrf_note *note, const char *audience);
01689 
01696 bool cvrf_note_set_title(struct cvrf_note *note, const char *title);
01697 
01704 bool cvrf_note_set_contents(struct cvrf_note *note, const char *contents);
01705 
01706 
01707 /************************************************************************************************
01708  * @struct cvrf_revision
01709  * Metadata for tracking the changes made to a CVRF document
01710  *
01711  * PARENT NODE: RevisionHistory container (which is a child of DocumentTracking)
01712  * REQUIRED: Number element [min: 1, max: 1], Date element [min: 1, max: 1],
01713  *              Description element [min: 1, max: 1]
01714  */
01715 struct cvrf_revision;
01716 
01722 struct cvrf_revision *cvrf_revision_new(void);
01723 
01729 void cvrf_revision_free(struct cvrf_revision *revision);
01730 
01736 struct cvrf_revision *cvrf_revision_clone(const struct cvrf_revision *revision);
01737 
01744 const char *cvrf_revision_get_number(const struct cvrf_revision *revision);
01745 
01752 const char *cvrf_revision_get_date(const struct cvrf_revision *revision);
01753 
01760 const char *cvrf_revision_get_description(const struct cvrf_revision *revision);
01761 
01768 bool cvrf_revision_set_number(struct cvrf_revision *revision, const char *number);
01769 
01776 bool cvrf_revision_set_date(struct cvrf_revision *revision, const char *date);
01777 
01784 bool cvrf_revision_set_description(struct cvrf_revision *revision, const char *description);
01785 
01786 /************************************************************************************************
01787  * @struct cvrf_doc_tracking
01788  * Metadata for referencing origin, changes, release dates, IDs, and other information about
01789  * the document
01790  *
01791  * PARENT NODE: cvrfdoc
01792  * REQUIRED: Identification container [max: 1] { ID element [max: 1], Alias [min: 0, max: unbounded] },
01793  *              Status element [max: 1], Version element [max: 1], RevisionHistory container [max: 1],
01794  *              InitialReleaseDate [max: 1], CurrentReleaseDate [max: 1],
01795  *              Generator container [max: 1] { Engine [min: 0, max: 1], Date [min: 0, max: 1] }
01796  */
01797 struct cvrf_doc_tracking;
01798 
01804 struct cvrf_doc_tracking *cvrf_doc_tracking_new(void);
01805 
01811 void cvrf_doc_tracking_free(struct cvrf_doc_tracking *tracking);
01812 
01818 struct cvrf_doc_tracking *cvrf_doc_tracking_clone(const struct cvrf_doc_tracking *tracking);
01819 
01826 const char *cvrf_doc_tracking_get_tracking_id(const struct cvrf_doc_tracking *tracking);
01827 
01834 struct oscap_string_iterator *cvrf_doc_tracking_get_aliases(struct cvrf_doc_tracking *tracking);
01835 
01842 const char *cvrf_doc_tracking_get_version(const struct cvrf_doc_tracking *tracking);
01843 
01850 const char *cvrf_doc_tracking_get_init_release_date(const struct cvrf_doc_tracking *tracking);
01851 
01858 const char *cvrf_doc_tracking_get_cur_release_date(const struct cvrf_doc_tracking *tracking);
01859 
01866 const char *cvrf_doc_tracking_get_generator_engine(const struct cvrf_doc_tracking *tracking);
01867 
01874 const char *cvrf_doc_tracking_get_generator_date(const struct cvrf_doc_tracking *tracking);
01875 
01882 bool cvrf_doc_tracking_set_tracking_id(struct cvrf_doc_tracking *tracking, const char *id);
01883 
01890 bool cvrf_doc_tracking_set_version(struct cvrf_doc_tracking *tracking, const char *version);
01891 
01898 bool cvrf_doc_tracking_set_init_release_date(struct cvrf_doc_tracking *tracking, const char *init_release_date);
01899 
01906 bool cvrf_doc_tracking_set_cur_release_date(struct cvrf_doc_tracking *tracking, const char *cur_release_date);
01907 
01914 bool cvrf_doc_tracking_set_generator_engine(struct cvrf_doc_tracking *tracking, const char *generator_engine);
01915 
01922 bool cvrf_doc_tracking_set_generator_date(struct cvrf_doc_tracking *tracking, const char *generator_date);
01923 
01924 
01925 /*******************************************
01926  * @struct cvrf_revision_iterator
01927  * Iterator representing all Revision elements in the RevisionHistory container
01928  * Contained as a list within the CVRF DocumentTracking structure
01929  */
01930 struct cvrf_revision_iterator;
01931 
01938 bool cvrf_doc_tracking_add_revision(struct cvrf_doc_tracking *tracking, struct cvrf_revision *revision);
01939 
01945 struct cvrf_revision_iterator *cvrf_doc_tracking_get_revision_history(const struct cvrf_doc_tracking *tracking);
01946 
01952 struct cvrf_revision *cvrf_revision_iterator_next(struct cvrf_revision_iterator *it);
01953 
01959 bool cvrf_revision_iterator_has_more(struct cvrf_revision_iterator *it);
01960 
01966 void cvrf_revision_iterator_free(struct cvrf_revision_iterator *it);
01967 
01973 void cvrf_revision_iterator_reset(struct cvrf_revision_iterator *it);
01974 
01980 void cvrf_revision_iterator_remove(struct cvrf_revision_iterator *it);
01981 
01982 
01983 /************************************************************************************************
01984  * @struct cvrf_doc_publisher
01985  * Metadata about the publisher of the CVRF document
01986  *
01987  * PARENT NODE: cvrfdoc
01988  * REQUIRED: Type attribute [max: 1]
01989  * OPTIONAL: VendorID attribute [min: 0, max: 1], ContactDetails element [min: 0, max: 1],
01990  *              IssuingAuthority element [min: 0, max: 1]
01991  */
01992 struct cvrf_doc_publisher;
01993 
01999 struct cvrf_doc_publisher *cvrf_doc_publisher_new(void);
02000 
02006 void cvrf_doc_publisher_free(struct cvrf_doc_publisher *publisher);
02007 
02013 struct cvrf_doc_publisher *cvrf_doc_publisher_clone(const struct cvrf_doc_publisher *publisher);
02014 
02021 const char *cvrf_doc_publisher_get_vendor_id(const struct cvrf_doc_publisher *publisher);
02022 
02029 const char *cvrf_doc_publisher_get_contact_details(const struct cvrf_doc_publisher *publisher);
02030 
02037 const char *cvrf_doc_publisher_get_issuing_authority(const struct cvrf_doc_publisher *publisher);
02038 
02045 bool cvrf_doc_publisher_set_vendor_id(struct cvrf_doc_publisher *publisher, const char *vendor_id);
02046 
02053 bool cvrf_doc_publisher_set_contact_details(struct cvrf_doc_publisher *publisher, const char *contact_details);
02054 
02061 bool cvrf_doc_publisher_set_issuing_authority(struct cvrf_doc_publisher *publisher, const char *issuing_authority);
02062 
02063 /************************************************************************************************
02064  * @struct cvrf_reference
02065  * Refers to resources and information outside of the CVRF document itself
02066  *
02067  * PARENT NODE: DocumentReferences container (child of cvrfdoc) or References container (child of Vulnerability)
02068  * REQUIRED: Type attribute [max: 1], URL element [max: 1], Description element [max: 1]
02069  */
02070 struct cvrf_reference;
02071 
02077 struct cvrf_reference *cvrf_reference_new(void);
02078 
02084 void cvrf_reference_free(struct cvrf_reference *reference);
02085 
02091 struct cvrf_reference *cvrf_reference_clone(const struct cvrf_reference *ref);
02092 
02099 const char *cvrf_reference_get_url(const struct cvrf_reference *reference);
02100 
02107 const char *cvrf_reference_get_description(const struct cvrf_reference *reference);
02108 
02115 bool cvrf_reference_set_url(struct cvrf_reference *reference, const char *url);
02116 
02123 bool cvrf_reference_set_description(struct cvrf_reference *reference, const char *description);
02124 
02125 /************************************************************************************************
02126  * @struct cvrf_document
02127  *
02128  */
02129 struct cvrf_document;
02130 
02136 struct cvrf_document *cvrf_document_new(void);
02137 
02144 void cvrf_document_free(struct cvrf_document *doc);
02145 
02151 struct cvrf_document *cvrf_document_clone(const struct cvrf_document *doc);
02152 
02159 const char *cvrf_document_get_doc_distribution(const struct cvrf_document *doc);
02160 
02167 const char *cvrf_document_get_aggregate_severity(const struct cvrf_document *doc);
02168 
02175 const char *cvrf_document_get_namespace(const struct cvrf_document *doc);
02176 
02183 struct cvrf_doc_tracking *cvrf_document_get_tracking(const struct cvrf_document *doc);
02184 
02191 struct cvrf_doc_publisher *cvrf_document_get_publisher(const struct cvrf_document *doc);
02192 
02199 struct oscap_iterator *cvrf_document_get_notes(struct cvrf_document *doc);
02200 
02207 struct oscap_iterator *cvrf_document_get_references(struct cvrf_document *doc);
02208 
02215 struct oscap_iterator *cvrf_document_get_acknowledgments(struct cvrf_document *doc);
02216 
02223 bool cvrf_document_set_doc_distribution(struct cvrf_document *doc, const char *distribution);
02224 
02231 bool cvrf_document_set_aggregate_severity(struct cvrf_document *doc, const char *severity);
02232 
02239 bool cvrf_document_set_namespace(struct cvrf_document *doc, const char *ns);
02240 
02247 bool cvrf_document_set_publisher(struct cvrf_document *doc, struct cvrf_doc_publisher *publisher);
02248 
02255 bool cvrf_document_set_tracking(struct cvrf_document *doc, struct cvrf_doc_tracking *track);
02256 
02257 /************************************************************************************************
02258  * @struct cvrf_model
02259  * Top level structure; organizationally divided into 3 components: Document, ProductTree, and
02260  * Vulnerability offshoots. This structure contains all information provided by a CVRF file.
02261  *
02262  * REQUIRED: DocumentTitle element [max: 1], DocumentType element [max: 1]
02263  * OPTIONAL: ProductTree element [min: 0, max: 1], Vulnerability [min: 0, max: unbounded]
02264  */
02265 struct cvrf_model;
02266 
02272 struct cvrf_model *cvrf_model_new(void);
02273 
02279 void cvrf_model_free(struct cvrf_model *cvrf);
02280 
02286 struct cvrf_model *cvrf_model_clone(const struct cvrf_model *model);
02287 
02296 int cvrf_model_filter_by_cpe(struct cvrf_model *model, const char *cpe);
02297 
02304 const char *cvrf_model_get_doc_title(const struct cvrf_model *model);
02305 
02312 const char *cvrf_model_get_doc_type(const struct cvrf_model *model);
02313 
02320 bool cvrf_model_set_doc_title(struct cvrf_model *model, const char *doc_title);
02321 
02328 bool cvrf_model_set_doc_type(struct cvrf_model *model, const char *doc_type);
02329 
02336 struct cvrf_product_tree *cvrf_model_get_product_tree(struct cvrf_model *model);
02337 
02345 struct cvrf_document *cvrf_model_get_document(const struct cvrf_model *model);
02346 
02352 const char *cvrf_model_get_identification(struct cvrf_model *model);
02353 
02360 bool cvrf_model_set_document(struct cvrf_model *model, struct cvrf_document *doc);
02361 
02362 /*******************************************
02363  * @struct cvrf_vulnerability_iterator
02364  * Iterator representing all Vulnerabilities in the document
02365  * Contained as a list within the CVRF Model structure
02366  */
02367 struct cvrf_vulnerability_iterator;
02368 
02374 struct cvrf_vulnerability_iterator *cvrf_model_get_vulnerabilities(const struct cvrf_model *model);
02375 
02382 bool cvrf_model_add_vulnerability(struct cvrf_model *model, struct cvrf_vulnerability *vuln);
02383 
02389 struct cvrf_vulnerability *cvrf_vulnerability_iterator_next(struct cvrf_vulnerability_iterator *it);
02390 
02396 bool cvrf_vulnerability_iterator_has_more(struct cvrf_vulnerability_iterator *it);
02397 
02403 void cvrf_vulnerability_iterator_free(struct cvrf_vulnerability_iterator *it);
02404 
02410 void cvrf_vulnerability_iterator_reset(struct cvrf_vulnerability_iterator *it);
02411 
02417 void cvrf_vulnerability_iterator_remove(struct cvrf_vulnerability_iterator *it);
02418 
02419 
02420 /************************************************************************************************
02421  * @struct cvrf_index
02422  * Represents an index of a CVRF feed or directory
02423  * Maintains a list of all CVRF files in the form of cvrf_model structures
02424  */
02425 struct cvrf_index;
02426 
02432 struct cvrf_index *cvrf_index_new(void);
02433 
02439 void cvrf_index_free(struct cvrf_index *index);
02440 
02446 struct cvrf_index *cvrf_index_clone(const struct cvrf_index *index);
02447 
02454 const char *cvrf_index_get_source_url(const struct cvrf_index *index);
02455 
02462 const char *cvrf_index_get_index_file(const struct cvrf_index *index);
02463 
02470 bool cvrf_index_set_source_url(struct cvrf_index *index, const char *url);
02471 
02478 bool cvrf_index_set_index_file(struct cvrf_index *index, const char *index_file);
02479 
02480 /*******************************************
02481  * @struct cvrf_model_iterator
02482  * Iterator representing all CVRF files from an index, feed, or stream
02483  * Contained as a list within the CVRF Index structure
02484  */
02485 struct cvrf_model_iterator;
02486 
02493 bool cvrf_index_add_model(struct cvrf_index *index, struct cvrf_model *model);
02494 
02500 struct cvrf_model_iterator *cvrf_index_get_models(const struct cvrf_index *index);
02501 
02507 struct cvrf_model *cvrf_model_iterator_next(struct cvrf_model_iterator *it);
02508 
02514 bool cvrf_model_iterator_has_more(struct cvrf_model_iterator *it);
02515 
02521 void cvrf_model_iterator_free(struct cvrf_model_iterator *it);
02522 
02528 void cvrf_model_iterator_reset(struct cvrf_model_iterator *it);
02529 
02535 void cvrf_model_iterator_remove(struct cvrf_model_iterator *it);
02536 
02537 
02538 /************************************************************************************************
02539  * @struct cvrf_session
02540  * Structure that holds and processes import source and import for CVRF models or indices
02541  * for later use during evaluation. Has OVAL definition structure that is used for
02542  * evaluation
02543  */
02544 struct cvrf_session;
02545 
02551 struct cvrf_session *cvrf_session_new_from_source_model(struct oscap_source *source);
02552 
02558 struct cvrf_session *cvrf_session_new_from_source_index(struct oscap_source *source);
02559 
02565 void cvrf_session_free(struct cvrf_session *session);
02566 
02572 struct cvrf_model *cvrf_session_get_model(struct cvrf_session *session);
02573 
02579 struct cvrf_index *cvrf_session_get_index(const struct cvrf_session *session);
02580 
02588 struct oscap_string_iterator *cvrf_session_get_product_ids(struct cvrf_session *session);
02589 
02595 const char *cvrf_session_get_os_name(const struct cvrf_session *session);
02596 
02603 void cvrf_session_set_model(struct cvrf_session *session, struct cvrf_model *model);
02604 
02612 bool cvrf_session_set_index(struct cvrf_session *session, struct cvrf_index *index);
02613 
02621 bool cvrf_session_set_os_name(struct cvrf_session *session, const char *os_name);
02622 
02623 /************************************************************************************************
02624  * @struct cvrf_rpm_attributes
02625  * Stores dissected information about RPM package names from CVRF files- the EVR format and
02626  * package name. These are used to check the vulnerability of the system by comparing the
02627  * EVR in the CVRF file to the EVR on the system
02628  */
02629 struct cvrf_rpm_attributes;
02630 
02636 struct cvrf_rpm_attributes *cvrf_rpm_attributes_new(void);
02637 
02643 void cvrf_rpm_attributes_free(struct cvrf_rpm_attributes *attributes);
02644 
02650 const char *cvrf_rpm_attributes_get_full_package_name(const struct cvrf_rpm_attributes *attributes);
02651 
02658 const char *cvrf_rpm_attributes_get_rpm_name(const struct cvrf_rpm_attributes *attributes);
02659 
02667 const char *cvrf_rpm_attributes_get_evr_format(const struct cvrf_rpm_attributes *attributes);
02668 
02675 bool cvrf_rpm_attributes_set_full_package_name(struct cvrf_rpm_attributes *attributes, const char *full_package);
02676 
02683 bool cvrf_rpm_attributes_set_rpm_name(struct cvrf_rpm_attributes *attributes, const char *rpm_name);
02684 
02691 bool cvrf_rpm_attributes_set_evr_format(struct cvrf_rpm_attributes *attributes, const char *evr_format);
02692 
02693 
02694 /************************************************************************************************/
02695 /************************************************************************************************/
02696 
02697 
02703 const char * cvrf_model_supported(void);
02704 
02712 struct cvrf_index *cvrf_index_import(struct oscap_source *index_source);
02713 
02720 struct cvrf_model *cvrf_model_import(struct oscap_source *source);
02721 
02728 struct oscap_source *cvrf_index_get_export_source(struct cvrf_index *index);
02729 
02736 struct oscap_source *cvrf_model_get_export_source(struct cvrf_model *model);
02737 
02746 struct oscap_source *cvrf_model_get_results_source(struct oscap_source *import_source, const char *os_name);
02747 
02756 struct oscap_source *cvrf_index_get_results_source(struct oscap_source *import_source, const char *os_name);
02757 
02758 
02761 #endif                          /* _CVRF_H_ */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines