Open SCAP Library

cpe_name.h

Go to the documentation of this file.
00001 
00015 /*
00016  * Copyright 2009 Red Hat Inc., Durham, North Carolina.
00017  * All Rights Reserved.
00018  *
00019  * This library is free software; you can redistribute it and/or
00020  * modify it under the terms of the GNU Lesser General Public
00021  * License as published by the Free Software Foundation; either
00022  * version 2.1 of the License, or (at your option) any later version.
00023  *
00024  * This library is distributed in the hope that it will be useful, 
00025  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00026  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00027  * Lesser General Public License for more details.
00028  *
00029  * You should have received a copy of the GNU Lesser General Public
00030  * License along with this library; if not, write to the Free Software 
00031  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00032  *
00033  * Authors:
00034  *      Lukas Kuklinek <lkuklinek@redhat.com>
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 typedef enum {
00046         CPE_PART_NONE,          
00047         CPE_PART_HW,            
00048         CPE_PART_OS,            
00049         CPE_PART_APP            
00050 } cpe_part_t;
00051 
00052 typedef enum {
00053         CPE_FORMAT_UNKNOWN, 
00054         CPE_FORMAT_URI, 
00055         CPE_FORMAT_STRING, 
00056         CPE_FORMAT_WFN  
00057 } cpe_format_t;
00058 
00065 struct cpe_name;
00066 
00076 struct cpe_name *cpe_name_new(const char *cpe);
00077 
00083 struct cpe_name * cpe_name_clone(struct cpe_name * old_name);
00084 
00090 void cpe_name_free(struct cpe_name *cpe);
00091 
00092 /************************************************************/
00104 cpe_format_t cpe_name_get_format(const struct cpe_name *cpe);
00105 
00110 cpe_part_t cpe_name_get_part(const struct cpe_name *cpe);
00111 
00116 const char *cpe_name_get_vendor(const struct cpe_name *cpe);
00117 
00122 const char *cpe_name_get_product(const struct cpe_name *cpe);
00123 
00128 const char *cpe_name_get_version(const struct cpe_name *cpe);
00129 
00134 const char *cpe_name_get_update(const struct cpe_name *cpe);
00135 
00140 const char *cpe_name_get_edition(const struct cpe_name *cpe);
00141 
00146 const char *cpe_name_get_language(const struct cpe_name *cpe);
00147 
00152 const char *cpe_name_get_sw_edition(const struct cpe_name *cpe);
00153 
00158 const char *cpe_name_get_target_sw(const struct cpe_name *cpe);
00159 
00164 const char *cpe_name_get_target_hw(const struct cpe_name *cpe);
00165 
00170 const char *cpe_name_get_other(const struct cpe_name *cpe);
00171 
00181 char *cpe_name_get_as_format(const struct cpe_name *cpe, cpe_format_t format);
00182 
00191 char *cpe_name_get_as_str(const struct cpe_name *cpe);
00192 
00193 /************************************************************/
00196 /************************************************************/
00208 bool cpe_name_set_format(struct cpe_name *cpe, cpe_format_t newval);
00209 
00214 bool cpe_name_set_part(struct cpe_name *cpe, cpe_part_t newval);
00215 
00220 bool cpe_name_set_vendor(struct cpe_name *cpe, const char *newval);
00221 
00226 bool cpe_name_set_product(struct cpe_name *cpe, const char *newval);
00227 
00232 bool cpe_name_set_version(struct cpe_name *cpe, const char *newval);
00233 
00238 bool cpe_name_set_update(struct cpe_name *cpe, const char *newval);
00239 
00244 bool cpe_name_set_edition(struct cpe_name *cpe, const char *newval);
00245 
00250 bool cpe_name_set_language(struct cpe_name *cpe, const char *newval);
00251 
00256 bool cpe_name_set_sw_edition(struct cpe_name *cpe, const char *newval);
00257 
00262 bool cpe_name_set_target_sw(struct cpe_name *cpe, const char *newval);
00263 
00268 bool cpe_name_set_target_hw(struct cpe_name *cpe, const char *newval);
00269 
00274 bool cpe_name_set_other(struct cpe_name *cpe, const char *newval);
00275 
00276 /************************************************************/
00279 /************************************************************/
00290 bool cpe_name_match_one(const struct cpe_name *cpe, const struct cpe_name *against);
00291 
00300 bool cpe_name_match_cpes(const struct cpe_name *name, size_t n, struct cpe_name **namelist);
00301 
00310 int cpe_name_write(const struct cpe_name *cpe, FILE * f);
00311 
00317 cpe_format_t cpe_name_get_format_of_str(const char *str);
00318 
00324 bool cpe_name_check(const char *str);
00325 
00336 int cpe_name_match_strs(const char *candidate, size_t n, char **targets);
00337 
00343 const char * cpe_name_supported(void);
00344 
00345 /************************************************************/
00362 typedef bool *(*cpe_check_fn) (const char*, const char*, const char*, void*);
00363 
00371 typedef bool *(*cpe_dict_fn) (const struct cpe_name*, void*);
00372 
00373 #endif                          /* _CPEURI_H_ */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines