Open SCAP Library: cpe_name.h Source File

Open SCAP Library

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

cpe_name.h
Go to the documentation of this file.
1
15 /*
16 * Copyright 2009 Red Hat Inc., Durham, North Carolina.
17 * All Rights Reserved.
18 *
19 * This library is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU Lesser General Public
21 * License as published by the Free Software Foundation; either
22 * version 2.1 of the License, or (at your option) any later version.
23 *
24 * This library is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * Lesser General Public License for more details.
28 *
29 * You should have received a copy of the GNU Lesser General Public
30 * License along with this library; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 *
33 * Authors:
34 * Lukas Kuklinek <lkuklinek@redhat.com>
35 */
36
37 #ifndef _CPEURI_H_
38 #define _CPEURI_H_
39
40 #include <stdbool.h>
41 #include <stdlib.h>
42 #include <stdio.h>
43
45 typedef enum {
46 CPE_PART_NONE,
47 CPE_PART_HW,
48 CPE_PART_OS,
49 CPE_PART_APP
50 } cpe_part_t;
51
52 typedef enum {
53 CPE_FORMAT_UNKNOWN,
54 CPE_FORMAT_URI,
55 CPE_FORMAT_STRING,
56 CPE_FORMAT_WFN
57 } cpe_format_t;
58
65 struct cpe_name;
66
76 struct cpe_name *cpe_name_new(const char *cpe);
77
83 struct cpe_name * cpe_name_clone(struct cpe_name * old_name);
84
90 void cpe_name_free(struct cpe_name *cpe);
91
92 /************************************************************/
104 cpe_format_t cpe_name_get_format(const struct cpe_name *cpe);
105
110 cpe_part_t cpe_name_get_part(const struct cpe_name *cpe);
111
116 const char *cpe_name_get_vendor(const struct cpe_name *cpe);
117
122 const char *cpe_name_get_product(const struct cpe_name *cpe);
123
128 const char *cpe_name_get_version(const struct cpe_name *cpe);
129
134 const char *cpe_name_get_update(const struct cpe_name *cpe);
135
140 const char *cpe_name_get_edition(const struct cpe_name *cpe);
141
146 const char *cpe_name_get_language(const struct cpe_name *cpe);
147
152 const char *cpe_name_get_sw_edition(const struct cpe_name *cpe);
153
158 const char *cpe_name_get_target_sw(const struct cpe_name *cpe);
159
164 const char *cpe_name_get_target_hw(const struct cpe_name *cpe);
165
170 const char *cpe_name_get_other(const struct cpe_name *cpe);
171
181 char *cpe_name_get_as_format(const struct cpe_name *cpe, cpe_format_t format);
182
191 char *cpe_name_get_as_str(const struct cpe_name *cpe);
192
193 /************************************************************/
196 /************************************************************/
208 bool cpe_name_set_format(struct cpe_name *cpe, cpe_format_t newval);
209
214 bool cpe_name_set_part(struct cpe_name *cpe, cpe_part_t newval);
215
220 bool cpe_name_set_vendor(struct cpe_name *cpe, const char *newval);
221
226 bool cpe_name_set_product(struct cpe_name *cpe, const char *newval);
227
232 bool cpe_name_set_version(struct cpe_name *cpe, const char *newval);
233
238 bool cpe_name_set_update(struct cpe_name *cpe, const char *newval);
239
244 bool cpe_name_set_edition(struct cpe_name *cpe, const char *newval);
245
250 bool cpe_name_set_language(struct cpe_name *cpe, const char *newval);
251
256 bool cpe_name_set_sw_edition(struct cpe_name *cpe, const char *newval);
257
262 bool cpe_name_set_target_sw(struct cpe_name *cpe, const char *newval);
263
268 bool cpe_name_set_target_hw(struct cpe_name *cpe, const char *newval);
269
274 bool cpe_name_set_other(struct cpe_name *cpe, const char *newval);
275
276 /************************************************************/
279 /************************************************************/
290 bool cpe_name_match_one(const struct cpe_name *cpe, const struct cpe_name *against);
291
300 bool cpe_name_match_cpes(const struct cpe_name *name, size_t n, struct cpe_name **namelist);
301
310 int cpe_name_write(const struct cpe_name *cpe, FILE * f);
311
317 cpe_format_t cpe_name_get_format_of_str(const char *str);
318
324 bool cpe_name_check(const char *str);
325
336 int cpe_name_match_strs(const char *candidate, size_t n, char **targets);
337
343 const char * cpe_name_supported(void);
344
345 /************************************************************/
362 typedef bool *(*cpe_check_fn) (const char*, const char*, const char*, void*);
363
371 typedef bool *(*cpe_dict_fn) (const struct cpe_name*, void*);
372
373 #endif /* _CPEURI_H_ */
cpe_name::cpe_name_set_part
bool cpe_name_set_part(struct cpe_name *cpe, cpe_part_t newval)
Set CPE name part type field.
cpe_name::cpe_name_get_target_sw
const char * cpe_name_get_target_sw(const struct cpe_name *cpe)
Get CPE name target_sw field.
cpe_name::cpe_name_get_other
const char * cpe_name_get_other(const struct cpe_name *cpe)
Get CPE name other field.
cpe_name::cpe_name_new
struct cpe_name * cpe_name_new(const char *cpe)
Create a new CPE structure from string cpe.
Definition: cpename.c:224
cpe_name::cpe_name_get_update
const char * cpe_name_get_update(const struct cpe_name *cpe)
Get CPE name update field.
cpe_name::cpe_name_get_version
const char * cpe_name_get_version(const struct cpe_name *cpe)
Get CPE name version field.
cpe_name::cpe_name_match_one
bool cpe_name_match_one(const struct cpe_name *cpe, const struct cpe_name *against)
Check if candidate CPE cpe matches CPE against according to CPE specification v 2.1.
Definition: cpename.c:527
CPE_FORMAT_URI
available in all CPE versions, default in CPE 2.2 and previous
Definition: cpe_name.h:54
cpe_name::cpe_name_set_sw_edition
bool cpe_name_set_sw_edition(struct cpe_name *cpe, const char *newval)
Set CPE name sw_edition field.
CPE_PART_NONE
no part specified
Definition: cpe_name.h:46
cpe_name::cpe_name_get_target_hw
const char * cpe_name_get_target_hw(const struct cpe_name *cpe)
Get CPE name target_hw field.
cpe_name::cpe_name_get_sw_edition
const char * cpe_name_get_sw_edition(const struct cpe_name *cpe)
Get CPE name sw_edition field.
cpe_name::cpe_name_set_format
bool cpe_name_set_format(struct cpe_name *cpe, cpe_format_t newval)
Set how the CPE name was loaded and how it should be saved.
cpe_name::cpe_name_set_language
bool cpe_name_set_language(struct cpe_name *cpe, const char *newval)
Set CPE name language field.
cpe_name::cpe_name_set_version
bool cpe_name_set_version(struct cpe_name *cpe, const char *newval)
Set CPE name version field.
cpe_name::cpe_name_get_vendor
const char * cpe_name_get_vendor(const struct cpe_name *cpe)
Get CPE name vendor field.
cpe_name::cpe_name_get_format
cpe_format_t cpe_name_get_format(const struct cpe_name *cpe)
Get how the CPE name was loaded and how it should be saved.
cpe_name::cpe_name_get_language
const char * cpe_name_get_language(const struct cpe_name *cpe)
Get CPE name language field.
cpe_format_t
cpe_format_t
Definition: cpe_name.h:52
cpe_name::cpe_name_set_other
bool cpe_name_set_other(struct cpe_name *cpe, const char *newval)
Set CPE name other field.
cpe_name::cpe_name_set_target_hw
bool cpe_name_set_target_hw(struct cpe_name *cpe, const char *newval)
Set CPE name target_hw field.
CPE_FORMAT_WFN
available in CPE 2.3 and newer versions, default in CPE 2.3 and newer
Definition: cpe_name.h:56
cpe_name::cpe_name_check
bool cpe_name_check(const char *str)
Checks whether str is valid CPE string (in any supported format).
Definition: cpename.c:633
cpe_name::cpe_name_set_vendor
bool cpe_name_set_vendor(struct cpe_name *cpe, const char *newval)
Set CPE name vendor field.
CPE_FORMAT_UNKNOWN
can&#39;t be serialized, is usually used to signal errors
Definition: cpe_name.h:53
CPE_PART_APP
application
Definition: cpe_name.h:49
cpe_name::cpe_name_set_update
bool cpe_name_set_update(struct cpe_name *cpe, const char *newval)
Set CPE name update field.
cpe_name::cpe_name_match_cpes
bool cpe_name_match_cpes(const struct cpe_name *name, size_t n, struct cpe_name **namelist)
Check if CPE name matches any CPE in namelist.
Definition: cpename.c:547
cpe_name::cpe_name_get_edition
const char * cpe_name_get_edition(const struct cpe_name *cpe)
Get CPE name edition field.
cpe_name::cpe_name_free
void cpe_name_free(struct cpe_name *cpe)
Destructor.
Definition: cpename.c:752
cpe_name_get_format_of_str
cpe_format_t cpe_name_get_format_of_str(const char *str)
Looks at given string and returns format it is in.
Definition: cpename.c:591
cpe_name
Structure holding Common Platform Enumeration URI data.
Definition: cpename.c:69
cpe_name::cpe_name_write
int cpe_name_write(const struct cpe_name *cpe, FILE *f)
Write CPE URI cpe to file a descriptor f.
Definition: cpename.c:734
cpe_name::cpe_name_get_product
const char * cpe_name_get_product(const struct cpe_name *cpe)
Get CPE name product field.
cpe_name::cpe_name_set_edition
bool cpe_name_set_edition(struct cpe_name *cpe, const char *newval)
Set CPE name edition field.
CPE_PART_HW
hardware
Definition: cpe_name.h:47
cpe_name::cpe_name_clone
struct cpe_name * cpe_name_clone(struct cpe_name *old_name)
Clone CPE Name.
Definition: cpename.c:313
cpe_name::cpe_name_get_as_str
char * cpe_name_get_as_str(const struct cpe_name *cpe)
Return CPE URI as a new string in the format in which it was loaded.
Definition: cpename.c:727
cpe_name::cpe_name_get_part
cpe_part_t cpe_name_get_part(const struct cpe_name *cpe)
Get CPE name part type field.
CPE_FORMAT_STRING
available in CPE 2.3 and newer
Definition: cpe_name.h:55
CPE_PART_OS
operating system
Definition: cpe_name.h:48
cpe_name::cpe_name_supported
const char * cpe_name_supported(void)
Get supported version of CPE uri XML.
Definition: cpename.c:763
cpe_name::cpe_name_get_as_format
char * cpe_name_get_as_format(const struct cpe_name *cpe, cpe_format_t format)
Return CPE URI as a new string in specified format.
Definition: cpename.c:645
cpe_name::cpe_name_match_strs
int cpe_name_match_strs(const char *candidate, size_t n, char **targets)
Match CPE URI candidate against list of n CPE URIs given by targets.
Definition: cpename.c:562
cpe_name::cpe_name_set_product
bool cpe_name_set_product(struct cpe_name *cpe, const char *newval)
Set CPE name product field.
cpe_name::cpe_name_set_target_sw
bool cpe_name_set_target_sw(struct cpe_name *cpe, const char *newval)
Set CPE name target_sw field.
cpe_part_t
cpe_part_t
enumeration of possible CPE parts
Definition: cpe_name.h:45