00001
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _CPEURI_H_
00031 #define _CPEURI_H_
00032
00033 #include <stdbool.h>
00034 #include <stdlib.h>
00035 #include <stdio.h>
00036
00038 enum cpe_part_t {
00039 CPE_PART_NONE,
00040 CPE_PART_HW,
00041 CPE_PART_OS,
00042 CPE_PART_APP
00043 };
00044
00046 const char *CPE_PART_CHAR[4];
00048 const char *CPE_SCHEMA;
00050 const char CPE_SEP_CHAR;
00052 const char *CPE_SEP_STR;
00053
00055 enum cpe_field_t {
00056 CPE_FIELD_TYPE,
00057 CPE_FIELD_VENDOR,
00058 CPE_FIELD_PRODUCT,
00059 CPE_FIELD_VERSION,
00060 CPE_FIELD_UPDATE,
00061 CPE_FIELD_EDITION,
00062 CPE_FIELD_LANGUAGE,
00063 CPE_FIELDNUM,
00064 };
00065
00071 typedef struct {
00072 char *data_;
00073 char **fields_;
00074 enum cpe_part_t part;
00075 const char *vendor;
00076 const char *product;
00077 const char *version;
00078 const char *update;
00079 const char *edition;
00080 const char *language;
00081 } cpe_t;
00082
00091 cpe_t *cpe_new(const char *cpe);
00092
00104 char **cpe_split(char *str, const char *delim);
00105
00111 bool cpe_urldecode(char *str);
00112
00117 bool cpe_name_match_one(const cpe_t * cpe, const cpe_t * against);
00118
00126 bool cpe_name_match_cpes(const cpe_t * name, size_t n, cpe_t ** namelist);
00127
00138 int cpe_name_match_strs(const char *candidate, size_t n, char **targets);
00139
00144 bool cpe_check(const char *str);
00145
00153 char *cpe_get_uri(const cpe_t * cpe);
00154
00162 int cpe_write(const cpe_t * cpe, FILE * f);
00163
00176 bool cpe_assign_values(cpe_t * cpe, char **fields);
00177
00182 void cpe_delete(cpe_t * cpe);
00183
00189 size_t ptrarray_length(void **arr);
00190
00191 #endif