00001
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef CPEDICT_H_
00038 #define CPEDICT_H_
00039
00040 #include "oscap.h"
00041 #include "cpe_name.h"
00042 #include "oscap_text.h"
00043 #include "oscap_source.h"
00044
00049 struct cpe_dict_model;
00050
00055 struct cpe_item;
00056
00061 struct cpe_vendor;
00062
00067 struct cpe_generator;
00068
00073 struct cpe_check;
00074
00079 struct cpe_reference;
00080
00085 struct cpe_item_metadata;
00086
00091 struct cpe_product;
00096 struct cpe_version;
00101 struct cpe_update;
00106 struct cpe_edition;
00111 struct cpe_language;
00112
00113
00125 const char *cpe_item_metadata_get_modification_date(const struct cpe_item_metadata *item);
00126
00131 const char *cpe_item_metadata_get_status(const struct cpe_item_metadata *item);
00132
00137 const char *cpe_item_metadata_get_nvd_id(const struct cpe_item_metadata *item);
00138
00143 const char *cpe_item_metadata_get_deprecated_by_nvd_id(const struct cpe_item_metadata *item);
00144
00149 const char *cpe_check_get_system(const struct cpe_check *item);
00150
00155 const char *cpe_check_get_href(const struct cpe_check *item);
00156
00161 const char *cpe_check_get_identifier(const struct cpe_check *item);
00162
00167 const char *cpe_reference_get_href(const struct cpe_reference *item);
00168
00173 const char *cpe_reference_get_content(const struct cpe_reference *item);
00174
00179 struct cpe_name *cpe_item_get_name(const struct cpe_item *item);
00180
00185 struct cpe_name *cpe_item_get_deprecated_by(const struct cpe_item *item);
00186
00194 OSCAP_DEPRECATED(struct cpe_name *cpe_item_get_deprecated(const struct cpe_item *item));
00195
00200 const char *cpe_item_get_deprecation_date(const struct cpe_item *item);
00201
00206 struct cpe_item_metadata *cpe_item_get_metadata(const struct cpe_item *item);
00207
00212 struct cpe_reference_iterator *cpe_item_get_references(const struct cpe_item *item);
00213
00218 struct cpe_check_iterator *cpe_item_get_checks(const struct cpe_item *item);
00219
00224 struct oscap_text_iterator *cpe_item_get_titles(const struct cpe_item *item);
00225
00232 OSCAP_DEPRECATED(struct oscap_text_iterator *cpe_item_get_notes(const struct cpe_item *item));
00233
00238 const char *cpe_generator_get_product_name(const struct cpe_generator *item);
00239
00244 const char *cpe_generator_get_product_version(const struct cpe_generator *item);
00245
00250 const char *cpe_generator_get_schema_version(const struct cpe_generator *item);
00251
00256 const char *cpe_generator_get_timestamp(const struct cpe_generator *item);
00257
00269 int cpe_dict_model_get_base_version(const struct cpe_dict_model *item);
00270
00275 bool cpe_dict_model_set_base_version(struct cpe_dict_model *item, int base_version);
00276
00282 struct cpe_generator *cpe_dict_model_get_generator(const struct cpe_dict_model *item);
00283
00288 struct cpe_item_iterator *cpe_dict_model_get_items(const struct cpe_dict_model *item);
00289
00294 struct cpe_vendor_iterator *cpe_dict_model_get_vendors(const struct cpe_dict_model *item);
00295
00300 const char *cpe_vendor_get_value(const struct cpe_vendor *item);
00301
00306 struct oscap_text_iterator *cpe_vendor_get_titles(const struct cpe_vendor *item);
00307
00312 struct cpe_product_iterator *cpe_vendor_get_products(const struct cpe_vendor *item);
00313
00318 const char *cpe_product_get_value(const struct cpe_product *item);
00319
00324 cpe_part_t cpe_product_get_part(const struct cpe_product *item);
00325
00331 struct cpe_version_iterator *cpe_product_get_versions(const struct cpe_product *item);
00332
00337 const char *cpe_version_get_value(const struct cpe_version *item);
00338
00344 struct cpe_update_iterator *cpe_version_get_updates(const struct cpe_version *item);
00345
00350 const char *cpe_update_get_value(const struct cpe_update *item);
00351
00357 struct cpe_edition_iterator *cpe_update_get_editions(const struct cpe_update *item);
00358
00363 const char *cpe_edition_get_value(const struct cpe_edition *item);
00364
00370 struct cpe_language_iterator *cpe_edition_get_languages(const struct cpe_edition *item);
00371
00376 const char *cpe_language_get_value(const struct cpe_language *item);
00377
00378
00381
00382 void cpe_check_free(struct cpe_check *check);
00384 void cpe_reference_free(struct cpe_reference *ref);
00386 void cpe_vendor_free(struct cpe_vendor *vendor);
00388 void cpe_product_free(struct cpe_product *product);
00390 void cpe_version_free(struct cpe_version *version);
00392 void cpe_update_free(struct cpe_update *update);
00394 void cpe_edition_free(struct cpe_edition *edition);
00396 void cpe_language_free(struct cpe_language *language);
00398 void cpe_itemmetadata_free(struct cpe_item_metadata *meta);
00400 void cpe_dict_model_free(struct cpe_dict_model *dict);
00402 void cpe_generator_free(struct cpe_generator *generator);
00404 void cpe_item_free(struct cpe_item *item);
00405
00407 struct cpe_dict_model *cpe_dict_model_new(void);
00409 struct cpe_generator *cpe_generator_new(void);
00411 struct cpe_check *cpe_check_new(void);
00413 struct cpe_reference *cpe_reference_new(void);
00415 struct cpe_item *cpe_item_new(void);
00417 struct cpe_vendor *cpe_vendor_new(void);
00419 struct cpe_product *cpe_product_new(void);
00421 struct cpe_version *cpe_version_new(void);
00423 struct cpe_update *cpe_update_new(void);
00425 struct cpe_edition *cpe_edition_new(void);
00427 struct cpe_language *cpe_language_new(void);
00429 struct cpe_item_metadata *cpe_item_metadata_new(void);
00430
00431
00439
00440 bool cpe_item_set_deprecation_date(struct cpe_item *item, const char *new_deprecation_date);
00441
00443 bool cpe_item_metadata_set_modification_date(struct cpe_item_metadata *item_metadata,
00444 const char *new_modification_date);
00445
00447 bool cpe_item_metadata_set_status(struct cpe_item_metadata *item_metadata, const char *new_status);
00448
00450 bool cpe_item_metadata_set_nvd_id(struct cpe_item_metadata *item_metadata, const char *new_nvd_id);
00451
00453 bool cpe_item_metadata_set_deprecated_by_nvd_id(struct cpe_item_metadata *item_metadata,
00454 const char *new_deprecated_by_nvd_id);
00455
00457 bool cpe_check_set_system(struct cpe_check *check, const char *new_system);
00458
00460 bool cpe_check_set_href(struct cpe_check *check, const char *new_href);
00461
00463 bool cpe_check_set_identifier(struct cpe_check *check, const char *new_identifier);
00464
00466 bool cpe_reference_set_href(struct cpe_reference *reference, const char *new_href);
00467
00469 bool cpe_reference_set_content(struct cpe_reference *reference, const char *new_content);
00470
00472 bool cpe_generator_set_product_name(struct cpe_generator *generator, const char *new_product_name);
00473
00475 bool cpe_generator_set_product_version(struct cpe_generator *generator, const char *new_product_version);
00476
00478 bool cpe_generator_set_schema_version(struct cpe_generator *generator, const char *new_schema_version);
00479
00481 bool cpe_generator_set_timestamp(struct cpe_generator *generator, const char *new_timestamp);
00482
00484 bool cpe_vendor_set_value(struct cpe_vendor *vendor, const char *new_value);
00485
00487 bool cpe_product_set_value(struct cpe_product *product, const char *new_value);
00488
00490 bool cpe_product_set_part(struct cpe_product *product, cpe_part_t new_part);
00491
00493 bool cpe_version_set_value(struct cpe_version *version, const char *new_value);
00494
00496 bool cpe_update_set_value(struct cpe_update *update, const char *new_value);
00497
00499 bool cpe_edition_set_value(struct cpe_edition *edition, const char *new_value);
00500
00502 bool cpe_language_set_value(struct cpe_language *language, const char *new_value);
00503
00504
00505
00506
00507
00509 bool cpe_item_add_reference(struct cpe_item *item, struct cpe_reference *new_reference);
00510
00512 bool cpe_item_add_check(struct cpe_item *item, struct cpe_check *new_check);
00513
00515 bool cpe_item_add_title(struct cpe_item *item, struct oscap_text *new_title);
00516
00522 OSCAP_DEPRECATED(bool cpe_item_add_note(struct cpe_item *item, struct oscap_text *new_title));
00523
00525 bool cpe_dict_model_add_vendor(struct cpe_dict_model *dict, struct cpe_vendor *new_vendor);
00526
00528 bool cpe_vendor_add_title(struct cpe_vendor *vendor, struct oscap_text *new_title);
00529
00531 bool cpe_vendor_add_product(struct cpe_vendor *vendor, struct cpe_product *new_product);
00532
00534 bool cpe_product_add_version(struct cpe_product *product, struct cpe_version *new_version);
00535
00537 bool cpe_version_add_update(struct cpe_version *version, struct cpe_update *new_update);
00538
00540 bool cpe_update_add_edition(struct cpe_update *update, struct cpe_edition *new_edition);
00541
00543 bool cpe_edition_add_language(struct cpe_edition *edition, struct cpe_language *new_language);
00544
00545
00546
00549
00560 struct cpe_item_iterator;
00561
00567 struct cpe_item *cpe_item_iterator_next(struct cpe_item_iterator *it);
00568
00574 bool cpe_item_iterator_has_more(struct cpe_item_iterator *it);
00575
00581 void cpe_item_iterator_free(struct cpe_item_iterator *it);
00582
00584 void cpe_item_iterator_remove(struct cpe_item_iterator *it);
00586 void cpe_item_iterator_reset(struct cpe_item_iterator *it);
00587
00593 struct cpe_reference_iterator;
00594
00600 struct cpe_reference *cpe_reference_iterator_next(struct cpe_reference_iterator *it);
00601
00607 bool cpe_reference_iterator_has_more(struct cpe_reference_iterator *it);
00608
00614 void cpe_reference_iterator_free(struct cpe_reference_iterator *it);
00615
00617 void cpe_reference_iterator_remove(struct cpe_reference_iterator *it);
00619 void cpe_reference_iterator_reset(struct cpe_reference_iterator *it);
00620
00626 struct cpe_check_iterator;
00627
00633 struct cpe_check *cpe_check_iterator_next(struct cpe_check_iterator *it);
00634
00640 bool cpe_check_iterator_has_more(struct cpe_check_iterator *it);
00641
00647 void cpe_check_iterator_free(struct cpe_check_iterator *it);
00648
00650 void cpe_check_iterator_remove(struct cpe_check_iterator *it);
00652 void cpe_check_iterator_reset(struct cpe_check_iterator *it);
00653
00659 struct cpe_vendor_iterator;
00660
00666 struct cpe_vendor *cpe_vendor_iterator_next(struct cpe_vendor_iterator *it);
00667
00673 bool cpe_vendor_iterator_has_more(struct cpe_vendor_iterator *it);
00674
00680 void cpe_vendor_iterator_free(struct cpe_vendor_iterator *it);
00681
00683 void cpe_vendor_iterator_remove(struct cpe_vendor_iterator *it);
00685 void cpe_vendor_iterator_reset(struct cpe_vendor_iterator *it);
00686
00692 struct cpe_product_iterator;
00693
00699 struct cpe_product *cpe_product_iterator_next(struct cpe_product_iterator *it);
00700
00706 bool cpe_product_iterator_has_more(struct cpe_product_iterator *it);
00707
00713 void cpe_product_iterator_free(struct cpe_product_iterator *it);
00714
00716 void cpe_product_iterator_remove(struct cpe_product_iterator *it);
00718 void cpe_product_iterator_reset(struct cpe_product_iterator *it);
00719
00725 struct cpe_version_iterator;
00726
00732 struct cpe_version *cpe_version_iterator_next(struct cpe_version_iterator *it);
00733
00739 bool cpe_version_iterator_has_more(struct cpe_version_iterator *it);
00740
00746 void cpe_version_iterator_free(struct cpe_version_iterator *it);
00747
00749 void cpe_version_iterator_remove(struct cpe_version_iterator *it);
00751 void cpe_version_iterator_reset(struct cpe_version_iterator *it);
00752
00758 struct cpe_update_iterator;
00759
00765 struct cpe_update *cpe_update_iterator_next(struct cpe_update_iterator *it);
00766
00772 bool cpe_update_iterator_has_more(struct cpe_update_iterator *it);
00773
00779 void cpe_update_iterator_free(struct cpe_update_iterator *it);
00780
00782 void cpe_update_iterator_remove(struct cpe_update_iterator *it);
00784 void cpe_update_iterator_reset(struct cpe_update_iterator *it);
00785
00791 struct cpe_edition_iterator;
00792
00798 struct cpe_edition *cpe_edition_iterator_next(struct cpe_edition_iterator *it);
00799
00805 bool cpe_edition_iterator_has_more(struct cpe_edition_iterator *it);
00806
00812 void cpe_edition_iterator_free(struct cpe_edition_iterator *it);
00813
00815 void cpe_edition_iterator_remove(struct cpe_edition_iterator *it);
00817 void cpe_edition_iterator_reset(struct cpe_edition_iterator *it);
00818
00824 struct cpe_language_iterator;
00825
00831 struct cpe_language *cpe_language_iterator_next(struct cpe_language_iterator *it);
00832
00838 bool cpe_language_iterator_has_more(struct cpe_language_iterator *it);
00839
00845 void cpe_language_iterator_free(struct cpe_language_iterator *it);
00846
00848 void cpe_language_iterator_remove(struct cpe_language_iterator *it);
00850 void cpe_language_iterator_reset(struct cpe_language_iterator *it);
00851
00852
00855
00866 const char * cpe_dict_model_supported(void);
00867
00875 OSCAP_DEPRECATED(char *cpe_dict_detect_version(const char* file));
00876
00885 bool cpe_name_match_dict(struct cpe_name *cpe, struct cpe_dict_model *dict);
00886
00895 bool cpe_name_match_dict_str(const char *cpe, struct cpe_dict_model *dict);
00896
00906 bool cpe_name_applicable_dict(struct cpe_name *cpe, struct cpe_dict_model *dict, cpe_check_fn cb, void* usr);
00907
00909 bool cpe_item_is_applicable(struct cpe_item* item, cpe_check_fn cb, void* usr);
00910
00911
00919 void cpe_dict_model_export(const struct cpe_dict_model *dict, const char *file);
00920
00930 OSCAP_DEPRECATED(struct cpe_dict_model *cpe_dict_model_import(const char *file));
00931
00938 struct cpe_dict_model *cpe_dict_model_import_source(struct oscap_source *source);
00939
00940
00946 bool cpe_dict_model_set_origin_file(struct cpe_dict_model* dict, const char* origin_file);
00947
00955 const char* cpe_dict_model_get_origin_file(const struct cpe_dict_model* dict);
00956
00961 #endif