00001
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef _CPEURI_H_
00038 #define _CPEURI_H_
00039
00040 #include <stdbool.h>
00041 #include <stdlib.h>
00042 #include <stdio.h>
00043
00045 enum cpe_part_t {
00046 CPE_PART_NONE,
00047 CPE_PART_HW,
00048 CPE_PART_OS,
00049 CPE_PART_APP
00050 };
00051
00053 const char *CPE_PART_CHAR[4];
00055 const char *CPE_SCHEMA;
00057 const char CPE_SEP_CHAR;
00059 const char *CPE_SEP_STR;
00060
00062 enum cpe_field_t {
00063 CPE_FIELD_TYPE,
00064 CPE_FIELD_VENDOR,
00065 CPE_FIELD_PRODUCT,
00066 CPE_FIELD_VERSION,
00067 CPE_FIELD_UPDATE,
00068 CPE_FIELD_EDITION,
00069 CPE_FIELD_LANGUAGE,
00070 CPE_FIELDNUM,
00071 };
00072
00078 typedef struct {
00079 char *data_;
00080 char **fields_;
00081 enum cpe_part_t part;
00082 const char *vendor;
00083 const char *product;
00084 const char *version;
00085 const char *update;
00086 const char *edition;
00087 const char *language;
00088 } cpe_t;
00089
00098 cpe_t *cpe_new(const char *cpe);
00099
00111 char **cpe_split(char *str, const char *delim);
00112
00118 bool cpe_urldecode(char *str);
00119
00124 bool cpe_name_match_one(const cpe_t * cpe, const cpe_t * against);
00125
00133 bool cpe_name_match_cpes(const cpe_t * name, size_t n, cpe_t ** namelist);
00134
00144 int cpe_name_match_strs(const char *candidate, size_t n, char **targets);
00145
00150 bool cpe_check(const char *str);
00151
00159 char *cpe_get_uri(const cpe_t * cpe);
00160
00168 int cpe_write(const cpe_t * cpe, FILE * f);
00169
00182 bool cpe_assign_values(cpe_t * cpe, char **fields);
00183
00188 void cpe_delete(cpe_t * cpe);
00189
00195 size_t ptrarray_length(void **arr);
00196
00197 #endif