Open SCAP Library
/home/pvrabec/project/openscap/openscap-0.7.4/src/CPE/public/cpedict.h
Go to the documentation of this file.
00001 
00013 /*
00014  * Copyright 2009 Red Hat Inc., Durham, North Carolina.
00015  * All Rights Reserved.
00016  *
00017  * This library is free software; you can redistribute it and/or
00018  * modify it under the terms of the GNU Lesser General Public
00019  * License as published by the Free Software Foundation; either
00020  * version 2.1 of the License, or (at your option) any later version.
00021  *
00022  * This library is distributed in the hope that it will be useful, 
00023  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00024  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00025  * Lesser General Public License for more details.
00026  *
00027  * You should have received a copy of the GNU Lesser General Public
00028  * License along with this library; if not, write to the Free Software 
00029  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00030  *
00031  * Authors:
00032  *      Maros Barabas <mbarabas@redhat.com>
00033  *      Lukas Kuklinek <lkuklinek@redhat.com>
00034  */
00035 
00036 #ifndef CPEDICT_H_
00037 #define CPEDICT_H_
00038 
00039 #include "cpeuri.h"
00040 #include "oscap.h"
00041 
00046 struct cpe_dict_model;
00047 
00052 struct cpe_item;
00053 
00058 struct cpe_vendor;
00059 
00064 struct cpe_generator;
00065 
00070 struct cpe_check;
00071 
00076 struct cpe_reference;
00077 
00082 struct cpe_item_metadata;
00083 
00088 struct cpe_product;
00093 struct cpe_version;
00098 struct cpe_update;
00103 struct cpe_edition;
00108 struct cpe_language;
00109 
00110 /************************************************************/
00122 const char *cpe_item_metadata_get_modification_date(const struct cpe_item_metadata *item);
00123 
00128 const char *cpe_item_metadata_get_status(const struct cpe_item_metadata *item);
00129 
00134 const char *cpe_item_metadata_get_nvd_id(const struct cpe_item_metadata *item);
00135 
00140 const char *cpe_item_metadata_get_deprecated_by_nvd_id(const struct cpe_item_metadata *item);
00141 
00146 const char *cpe_check_get_system(const struct cpe_check *item);
00147 
00152 const char *cpe_check_get_href(const struct cpe_check *item);
00153 
00158 const char *cpe_check_get_identifier(const struct cpe_check *item);
00159 
00164 const char *cpe_reference_get_href(const struct cpe_reference *item);
00165 
00170 const char *cpe_reference_get_content(const struct cpe_reference *item);
00171 
00176 struct cpe_name *cpe_item_get_name(const struct cpe_item *item);
00177 
00182 struct cpe_name *cpe_item_get_deprecated(const struct cpe_item *item);
00183 
00188 const char *cpe_item_get_deprecation_date(const struct cpe_item *item);
00189 
00194 struct cpe_item_metadata *cpe_item_get_metadata(const struct cpe_item *item);
00195 
00200 struct cpe_reference_iterator *cpe_item_get_references(const struct cpe_item *item);
00201 
00206 struct cpe_check_iterator *cpe_item_get_checks(const struct cpe_item *item);
00207 
00212 struct oscap_text_iterator *cpe_item_get_titles(const struct cpe_item *item);
00213 
00218 struct oscap_text_iterator *cpe_item_get_notes(const struct cpe_item *item);
00219 
00224 const char *cpe_generator_get_product_name(const struct cpe_generator *item);
00225 
00230 const char *cpe_generator_get_product_version(const struct cpe_generator *item);
00231 
00236 const char *cpe_generator_get_schema_version(const struct cpe_generator *item);
00237 
00242 const char *cpe_generator_get_timestamp(const struct cpe_generator *item);
00243 
00249 struct cpe_generator *cpe_dict_model_get_generator(const struct cpe_dict_model *item);
00250 
00255 struct cpe_item_iterator *cpe_dict_model_get_items(const struct cpe_dict_model *item);
00256 
00261 struct cpe_vendor_iterator *cpe_dict_model_get_vendors(const struct cpe_dict_model *item);
00262 
00267 const char *cpe_vendor_get_value(const struct cpe_vendor *item);
00268 
00273 struct oscap_text_iterator *cpe_vendor_get_titles(const struct cpe_vendor *item);
00274 
00279 struct cpe_product_iterator *cpe_vendor_get_products(const struct cpe_vendor *item);
00280 
00285 const char *cpe_product_get_value(const struct cpe_product *item);
00286 
00291 cpe_part_t cpe_product_get_part(const struct cpe_product *item);
00292 
00298 struct cpe_version_iterator *cpe_product_get_versions(const struct cpe_product *item);
00299 
00304 const char *cpe_version_get_value(const struct cpe_version *item);
00305 
00311 struct cpe_update_iterator *cpe_version_get_updates(const struct cpe_version *items);
00312 
00317 const char *cpe_update_get_value(const struct cpe_update *item);
00318 
00324 struct cpe_edition_iterator *cpe_update_get_editions(const struct cpe_update *items);
00325 
00330 const char *cpe_edition_get_value(const struct cpe_edition *item);
00331 
00337 struct cpe_language_iterator *cpe_edition_get_languages(const struct cpe_edition *items);
00338 
00343 const char *cpe_language_get_value(const struct cpe_language *item);
00344 
00345 /************************************************************/
00348 
00349 void cpe_check_free(struct cpe_check *check);
00351 void cpe_reference_free(struct cpe_reference *ref);
00353 void cpe_vendor_free(struct cpe_vendor *vendor);
00355 void cpe_product_free(struct cpe_product *product);
00357 void cpe_version_free(struct cpe_version *version);
00359 void cpe_update_free(struct cpe_update *update);
00361 void cpe_edition_free(struct cpe_edition *edition);
00363 void cpe_language_free(struct cpe_language *language);
00365 void cpe_itemmetadata_free(struct cpe_item_metadata *meta);
00367 void cpe_dict_model_free(struct cpe_dict_model *dict);
00369 void cpe_generator_free(struct cpe_generator *generator);
00371 void cpe_item_free(struct cpe_item *item);
00372 
00374 struct cpe_dict_model *cpe_dict_model_new(void);
00376 struct cpe_generator *cpe_generator_new(void);
00378 struct cpe_check *cpe_check_new(void);
00380 struct cpe_reference *cpe_reference_new(void);
00382 struct cpe_item *cpe_item_new(void);
00384 struct cpe_vendor *cpe_vendor_new(void);
00386 struct cpe_product *cpe_product_new(void);
00388 struct cpe_version *cpe_version_new(void);
00390 struct cpe_update *cpe_update_new(void);
00392 struct cpe_edition *cpe_edition_new(void);
00394 struct cpe_language *cpe_language_new(void);
00396 struct cpe_item_metadata *cpe_item_metadata_new(void);
00397 
00398 /************************************************************/
00406 
00407 bool cpe_item_set_deprecation_date(struct cpe_item *item, const char *new_deprecation_date);
00408 
00410 bool cpe_item_metadata_set_modification_date(struct cpe_item_metadata *item_metadata,
00411                                              const char *new_modification_date);
00412 
00414 bool cpe_item_metadata_set_status(struct cpe_item_metadata *item_metadata, const char *new_status);
00415 
00417 bool cpe_item_metadata_set_nvd_id(struct cpe_item_metadata *item_metadata, const char *new_nvd_id);
00418 
00420 bool cpe_item_metadata_set_deprecated_by_nvd_id(struct cpe_item_metadata *item_metadata,
00421                                                 const char *new_deprecated_by_nvd_id);
00422 
00424 bool cpe_check_set_system(struct cpe_check *check, const char *new_system);
00425 
00427 bool cpe_check_set_href(struct cpe_check *check, const char *new_href);
00428 
00430 bool cpe_check_set_identifier(struct cpe_check *check, const char *new_identifier);
00431 
00433 bool cpe_reference_set_href(struct cpe_reference *reference, const char *new_href);
00434 
00436 bool cpe_reference_set_content(struct cpe_reference *reference, const char *new_content);
00437 
00439 bool cpe_generator_set_product_name(struct cpe_generator *generator, const char *new_product_name);
00440 
00442 bool cpe_generator_set_product_version(struct cpe_generator *generator, const char *new_product_version);
00443 
00445 bool cpe_generator_set_schema_version(struct cpe_generator *generator, const char *new_schema_version);
00446 
00448 bool cpe_generator_set_timestamp(struct cpe_generator *generator, const char *new_timestamp);
00449 
00451 bool cpe_vendor_set_value(struct cpe_vendor *vendor, const char *new_value);
00452 
00454 bool cpe_product_set_value(struct cpe_product *product, const char *new_value);
00455 
00457 bool cpe_product_set_part(struct cpe_product *product, cpe_part_t new_part);
00458 
00460 bool cpe_version_set_value(struct cpe_version *version, const char *new_value);
00461 
00463 bool cpe_update_set_value(struct cpe_update *update, const char *new_value);
00464 
00466 bool cpe_edition_set_value(struct cpe_edition *edition, const char *new_value);
00467 
00469 bool cpe_language_set_value(struct cpe_language *language, const char *new_value);
00470 
00471 /*
00472  * Add functions
00473  */
00474 
00476 bool cpe_item_add_reference(struct cpe_item *item, struct cpe_reference *new_reference);
00477 
00479 bool cpe_item_add_check(struct cpe_item *item, struct cpe_check *new_check);
00480 
00482 bool cpe_item_add_title(struct cpe_item *item, struct oscap_text *new_title);
00483 
00485 bool cpe_item_add_note(struct cpe_item *item, struct oscap_text *new_title);
00486 
00488 bool cpe_dict_model_add_vendor(struct cpe_dict_model *dict, struct cpe_vendor *new_vendor);
00489 
00491 bool cpe_vendor_add_title(struct cpe_vendor *vendor, struct oscap_text *new_title);
00492 
00494 bool cpe_vendor_add_product(struct cpe_vendor *vendor, struct cpe_product *new_product);
00495 
00497 bool cpe_product_add_version(struct cpe_product *product, struct cpe_version *new_version);
00498 
00500 bool cpe_version_add_update(struct cpe_version *version, struct cpe_update *new_update);
00501 
00503 bool cpe_update_add_edition(struct cpe_update *update, struct cpe_edition *new_edition);
00504 
00506 bool cpe_edition_add_language(struct cpe_edition *edition, struct cpe_language *new_language);
00507 
00508 
00509 /************************************************************/
00512 /************************************************************/
00523 struct cpe_item_iterator;
00524 
00530 struct cpe_item *cpe_item_iterator_next(struct cpe_item_iterator *it);
00531 
00537 bool cpe_item_iterator_has_more(struct cpe_item_iterator *it);
00538 
00544 void cpe_item_iterator_free(struct cpe_item_iterator *it);
00545 
00547 void cpe_item_iterator_remove(struct cpe_item_iterator *it);
00549 void cpe_item_iterator_reset(struct cpe_item_iterator *it);
00550 
00556 struct cpe_reference_iterator;
00557 
00563 struct cpe_reference *cpe_reference_iterator_next(struct cpe_reference_iterator *it);
00564 
00570 bool cpe_reference_iterator_has_more(struct cpe_reference_iterator *it);
00571 
00577 void cpe_reference_iterator_free(struct cpe_reference_iterator *it);
00578 
00580 void cpe_reference_iterator_remove(struct cpe_reference_iterator *it);
00582 void cpe_reference_iterator_reset(struct cpe_reference_iterator *it);
00583 
00589 struct cpe_check_iterator;
00590 
00596 struct cpe_check *cpe_check_iterator_next(struct cpe_check_iterator *it);
00597 
00603 bool cpe_check_iterator_has_more(struct cpe_check_iterator *it);
00604 
00610 void cpe_check_iterator_free(struct cpe_check_iterator *it);
00611 
00613 void cpe_check_iterator_remove(struct cpe_check_iterator *it);
00615 void cpe_check_iterator_reset(struct cpe_check_iterator *it);
00616 
00622 struct cpe_vendor_iterator;
00623 
00629 struct cpe_vendor *cpe_vendor_iterator_next(struct cpe_vendor_iterator *it);
00630 
00636 bool cpe_vendor_iterator_has_more(struct cpe_vendor_iterator *it);
00637 
00643 void cpe_vendor_iterator_free(struct cpe_vendor_iterator *it);
00644 
00646 void cpe_vendor_iterator_remove(struct cpe_vendor_iterator *it);
00648 void cpe_vendor_iterator_reset(struct cpe_vendor_iterator *it);
00649 
00655 struct cpe_product_iterator;
00656 
00662 struct cpe_product *cpe_product_iterator_next(struct cpe_product_iterator *it);
00663 
00669 bool cpe_product_iterator_has_more(struct cpe_product_iterator *it);
00670 
00676 void cpe_product_iterator_free(struct cpe_product_iterator *it);
00677 
00679 void cpe_product_iterator_remove(struct cpe_product_iterator *it);
00681 void cpe_product_iterator_reset(struct cpe_product_iterator *it);
00682 
00688 struct cpe_version_iterator;
00689 
00695 struct cpe_version *cpe_version_iterator_next(struct cpe_version_iterator *it);
00696 
00702 bool cpe_version_iterator_has_more(struct cpe_version_iterator *it);
00703 
00709 void cpe_version_iterator_free(struct cpe_version_iterator *it);
00710 
00712 void cpe_version_iterator_remove(struct cpe_version_iterator *it);
00714 void cpe_version_iterator_reset(struct cpe_version_iterator *it);
00715 
00721 struct cpe_update_iterator;
00722 
00728 struct cpe_update *cpe_update_iterator_next(struct cpe_update_iterator *it);
00729 
00735 bool cpe_update_iterator_has_more(struct cpe_update_iterator *it);
00736 
00742 void cpe_update_iterator_free(struct cpe_update_iterator *it);
00743 
00745 void cpe_update_iterator_remove(struct cpe_update_iterator *it);
00747 void cpe_update_iterator_reset(struct cpe_update_iterator *it);
00748 
00754 struct cpe_edition_iterator;
00755 
00761 struct cpe_edition *cpe_edition_iterator_next(struct cpe_edition_iterator *it);
00762 
00768 bool cpe_edition_iterator_has_more(struct cpe_edition_iterator *it);
00769 
00775 void cpe_edition_iterator_free(struct cpe_edition_iterator *it);
00776 
00778 void cpe_edition_iterator_remove(struct cpe_edition_iterator *it);
00780 void cpe_edition_iterator_reset(struct cpe_edition_iterator *it);
00781 
00787 struct cpe_language_iterator;
00788 
00794 struct cpe_language *cpe_language_iterator_next(struct cpe_language_iterator *it);
00795 
00801 bool cpe_language_iterator_has_more(struct cpe_language_iterator *it);
00802 
00808 void cpe_language_iterator_free(struct cpe_language_iterator *it);
00809 
00811 void cpe_language_iterator_remove(struct cpe_language_iterator *it);
00813 void cpe_language_iterator_reset(struct cpe_language_iterator *it);
00814 
00815 /************************************************************/
00818 /************************************************************/
00829 const char * cpe_dict_model_supported(void);
00830 
00839 bool cpe_name_match_dict(struct cpe_name *cpe, struct cpe_dict_model *dict);
00840 
00849 bool cpe_name_match_dict_str(const char *cpe, struct cpe_dict_model *dict);
00850 
00851 /************************************************************/
00859 void cpe_dict_model_export(const struct cpe_dict_model *dict, const char *file);
00860 
00868 struct cpe_dict_model *cpe_dict_model_import(const char *file);
00869 
00874 #endif                          /* _CPEDICT_H_ */