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 #ifndef CPEDICT_H_
00037 #define CPEDICT_H_
00038
00039 #include "cpe_name.h"
00040 #include "oscap_text.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
00255 int cpe_dict_model_get_base_version(const struct cpe_dict_model *item);
00256
00261 bool cpe_dict_model_set_base_version(struct cpe_dict_model *item, int base_version);
00262
00268 struct cpe_generator *cpe_dict_model_get_generator(const struct cpe_dict_model *item);
00269
00274 struct cpe_item_iterator *cpe_dict_model_get_items(const struct cpe_dict_model *item);
00275
00280 struct cpe_vendor_iterator *cpe_dict_model_get_vendors(const struct cpe_dict_model *item);
00281
00286 const char *cpe_vendor_get_value(const struct cpe_vendor *item);
00287
00292 struct oscap_text_iterator *cpe_vendor_get_titles(const struct cpe_vendor *item);
00293
00298 struct cpe_product_iterator *cpe_vendor_get_products(const struct cpe_vendor *item);
00299
00304 const char *cpe_product_get_value(const struct cpe_product *item);
00305
00310 cpe_part_t cpe_product_get_part(const struct cpe_product *item);
00311
00317 struct cpe_version_iterator *cpe_product_get_versions(const struct cpe_product *item);
00318
00323 const char *cpe_version_get_value(const struct cpe_version *item);
00324
00330 struct cpe_update_iterator *cpe_version_get_updates(const struct cpe_version *item);
00331
00336 const char *cpe_update_get_value(const struct cpe_update *item);
00337
00343 struct cpe_edition_iterator *cpe_update_get_editions(const struct cpe_update *item);
00344
00349 const char *cpe_edition_get_value(const struct cpe_edition *item);
00350
00356 struct cpe_language_iterator *cpe_edition_get_languages(const struct cpe_edition *item);
00357
00362 const char *cpe_language_get_value(const struct cpe_language *item);
00363
00364
00367
00368 void cpe_check_free(struct cpe_check *check);
00370 void cpe_reference_free(struct cpe_reference *ref);
00372 void cpe_vendor_free(struct cpe_vendor *vendor);
00374 void cpe_product_free(struct cpe_product *product);
00376 void cpe_version_free(struct cpe_version *version);
00378 void cpe_update_free(struct cpe_update *update);
00380 void cpe_edition_free(struct cpe_edition *edition);
00382 void cpe_language_free(struct cpe_language *language);
00384 void cpe_itemmetadata_free(struct cpe_item_metadata *meta);
00386 void cpe_dict_model_free(struct cpe_dict_model *dict);
00388 void cpe_generator_free(struct cpe_generator *generator);
00390 void cpe_item_free(struct cpe_item *item);
00391
00393 struct cpe_dict_model *cpe_dict_model_new(void);
00395 struct cpe_generator *cpe_generator_new(void);
00397 struct cpe_check *cpe_check_new(void);
00399 struct cpe_reference *cpe_reference_new(void);
00401 struct cpe_item *cpe_item_new(void);
00403 struct cpe_vendor *cpe_vendor_new(void);
00405 struct cpe_product *cpe_product_new(void);
00407 struct cpe_version *cpe_version_new(void);
00409 struct cpe_update *cpe_update_new(void);
00411 struct cpe_edition *cpe_edition_new(void);
00413 struct cpe_language *cpe_language_new(void);
00415 struct cpe_item_metadata *cpe_item_metadata_new(void);
00416
00417
00425
00426 bool cpe_item_set_deprecation_date(struct cpe_item *item, const char *new_deprecation_date);
00427
00429 bool cpe_item_metadata_set_modification_date(struct cpe_item_metadata *item_metadata,
00430 const char *new_modification_date);
00431
00433 bool cpe_item_metadata_set_status(struct cpe_item_metadata *item_metadata, const char *new_status);
00434
00436 bool cpe_item_metadata_set_nvd_id(struct cpe_item_metadata *item_metadata, const char *new_nvd_id);
00437
00439 bool cpe_item_metadata_set_deprecated_by_nvd_id(struct cpe_item_metadata *item_metadata,
00440 const char *new_deprecated_by_nvd_id);
00441
00443 bool cpe_check_set_system(struct cpe_check *check, const char *new_system);
00444
00446 bool cpe_check_set_href(struct cpe_check *check, const char *new_href);
00447
00449 bool cpe_check_set_identifier(struct cpe_check *check, const char *new_identifier);
00450
00452 bool cpe_reference_set_href(struct cpe_reference *reference, const char *new_href);
00453
00455 bool cpe_reference_set_content(struct cpe_reference *reference, const char *new_content);
00456
00458 bool cpe_generator_set_product_name(struct cpe_generator *generator, const char *new_product_name);
00459
00461 bool cpe_generator_set_product_version(struct cpe_generator *generator, const char *new_product_version);
00462
00464 bool cpe_generator_set_schema_version(struct cpe_generator *generator, const char *new_schema_version);
00465
00467 bool cpe_generator_set_timestamp(struct cpe_generator *generator, const char *new_timestamp);
00468
00470 bool cpe_vendor_set_value(struct cpe_vendor *vendor, const char *new_value);
00471
00473 bool cpe_product_set_value(struct cpe_product *product, const char *new_value);
00474
00476 bool cpe_product_set_part(struct cpe_product *product, cpe_part_t new_part);
00477
00479 bool cpe_version_set_value(struct cpe_version *version, const char *new_value);
00480
00482 bool cpe_update_set_value(struct cpe_update *update, const char *new_value);
00483
00485 bool cpe_edition_set_value(struct cpe_edition *edition, const char *new_value);
00486
00488 bool cpe_language_set_value(struct cpe_language *language, const char *new_value);
00489
00490
00491
00492
00493
00495 bool cpe_item_add_reference(struct cpe_item *item, struct cpe_reference *new_reference);
00496
00498 bool cpe_item_add_check(struct cpe_item *item, struct cpe_check *new_check);
00499
00501 bool cpe_item_add_title(struct cpe_item *item, struct oscap_text *new_title);
00502
00504 bool cpe_item_add_note(struct cpe_item *item, struct oscap_text *new_title);
00505
00507 bool cpe_dict_model_add_vendor(struct cpe_dict_model *dict, struct cpe_vendor *new_vendor);
00508
00510 bool cpe_vendor_add_title(struct cpe_vendor *vendor, struct oscap_text *new_title);
00511
00513 bool cpe_vendor_add_product(struct cpe_vendor *vendor, struct cpe_product *new_product);
00514
00516 bool cpe_product_add_version(struct cpe_product *product, struct cpe_version *new_version);
00517
00519 bool cpe_version_add_update(struct cpe_version *version, struct cpe_update *new_update);
00520
00522 bool cpe_update_add_edition(struct cpe_update *update, struct cpe_edition *new_edition);
00523
00525 bool cpe_edition_add_language(struct cpe_edition *edition, struct cpe_language *new_language);
00526
00527
00528
00531
00542 struct cpe_item_iterator;
00543
00549 struct cpe_item *cpe_item_iterator_next(struct cpe_item_iterator *it);
00550
00556 bool cpe_item_iterator_has_more(struct cpe_item_iterator *it);
00557
00563 void cpe_item_iterator_free(struct cpe_item_iterator *it);
00564
00566 void cpe_item_iterator_remove(struct cpe_item_iterator *it);
00568 void cpe_item_iterator_reset(struct cpe_item_iterator *it);
00569
00575 struct cpe_reference_iterator;
00576
00582 struct cpe_reference *cpe_reference_iterator_next(struct cpe_reference_iterator *it);
00583
00589 bool cpe_reference_iterator_has_more(struct cpe_reference_iterator *it);
00590
00596 void cpe_reference_iterator_free(struct cpe_reference_iterator *it);
00597
00599 void cpe_reference_iterator_remove(struct cpe_reference_iterator *it);
00601 void cpe_reference_iterator_reset(struct cpe_reference_iterator *it);
00602
00608 struct cpe_check_iterator;
00609
00615 struct cpe_check *cpe_check_iterator_next(struct cpe_check_iterator *it);
00616
00622 bool cpe_check_iterator_has_more(struct cpe_check_iterator *it);
00623
00629 void cpe_check_iterator_free(struct cpe_check_iterator *it);
00630
00632 void cpe_check_iterator_remove(struct cpe_check_iterator *it);
00634 void cpe_check_iterator_reset(struct cpe_check_iterator *it);
00635
00641 struct cpe_vendor_iterator;
00642
00648 struct cpe_vendor *cpe_vendor_iterator_next(struct cpe_vendor_iterator *it);
00649
00655 bool cpe_vendor_iterator_has_more(struct cpe_vendor_iterator *it);
00656
00662 void cpe_vendor_iterator_free(struct cpe_vendor_iterator *it);
00663
00665 void cpe_vendor_iterator_remove(struct cpe_vendor_iterator *it);
00667 void cpe_vendor_iterator_reset(struct cpe_vendor_iterator *it);
00668
00674 struct cpe_product_iterator;
00675
00681 struct cpe_product *cpe_product_iterator_next(struct cpe_product_iterator *it);
00682
00688 bool cpe_product_iterator_has_more(struct cpe_product_iterator *it);
00689
00695 void cpe_product_iterator_free(struct cpe_product_iterator *it);
00696
00698 void cpe_product_iterator_remove(struct cpe_product_iterator *it);
00700 void cpe_product_iterator_reset(struct cpe_product_iterator *it);
00701
00707 struct cpe_version_iterator;
00708
00714 struct cpe_version *cpe_version_iterator_next(struct cpe_version_iterator *it);
00715
00721 bool cpe_version_iterator_has_more(struct cpe_version_iterator *it);
00722
00728 void cpe_version_iterator_free(struct cpe_version_iterator *it);
00729
00731 void cpe_version_iterator_remove(struct cpe_version_iterator *it);
00733 void cpe_version_iterator_reset(struct cpe_version_iterator *it);
00734
00740 struct cpe_update_iterator;
00741
00747 struct cpe_update *cpe_update_iterator_next(struct cpe_update_iterator *it);
00748
00754 bool cpe_update_iterator_has_more(struct cpe_update_iterator *it);
00755
00761 void cpe_update_iterator_free(struct cpe_update_iterator *it);
00762
00764 void cpe_update_iterator_remove(struct cpe_update_iterator *it);
00766 void cpe_update_iterator_reset(struct cpe_update_iterator *it);
00767
00773 struct cpe_edition_iterator;
00774
00780 struct cpe_edition *cpe_edition_iterator_next(struct cpe_edition_iterator *it);
00781
00787 bool cpe_edition_iterator_has_more(struct cpe_edition_iterator *it);
00788
00794 void cpe_edition_iterator_free(struct cpe_edition_iterator *it);
00795
00797 void cpe_edition_iterator_remove(struct cpe_edition_iterator *it);
00799 void cpe_edition_iterator_reset(struct cpe_edition_iterator *it);
00800
00806 struct cpe_language_iterator;
00807
00813 struct cpe_language *cpe_language_iterator_next(struct cpe_language_iterator *it);
00814
00820 bool cpe_language_iterator_has_more(struct cpe_language_iterator *it);
00821
00827 void cpe_language_iterator_free(struct cpe_language_iterator *it);
00828
00830 void cpe_language_iterator_remove(struct cpe_language_iterator *it);
00832 void cpe_language_iterator_reset(struct cpe_language_iterator *it);
00833
00834
00837
00848 const char * cpe_dict_model_supported(void);
00849
00855 char * cpe_dict_detect_version(const char* file);
00856
00865 bool cpe_name_match_dict(struct cpe_name *cpe, struct cpe_dict_model *dict);
00866
00875 bool cpe_name_match_dict_str(const char *cpe, struct cpe_dict_model *dict);
00876
00886 bool cpe_name_applicable_dict(struct cpe_name *cpe, struct cpe_dict_model *dict, cpe_check_fn cb, void* usr);
00887
00889 bool cpe_item_is_applicable(struct cpe_item* item, cpe_check_fn cb, void* usr);
00890
00891
00899 void cpe_dict_model_export(const struct cpe_dict_model *dict, const char *file);
00900
00908 struct cpe_dict_model *cpe_dict_model_import(const char *file);
00909
00915 bool cpe_dict_model_set_origin_file(struct cpe_dict_model* dict, const char* origin_file);
00916
00924 const char* cpe_dict_model_get_origin_file(const struct cpe_dict_model* dict);
00925
00930 #endif