cpe_name.h
Go to the documentation of this file.
/*
* Copyright 2009 Red Hat Inc., Durham, North Carolina.
* All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors:
* Lukas Kuklinek <lkuklinek@redhat.com>
*/
#ifndef _CPEURI_H_
#define _CPEURI_H_
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
typedef enum {
CPE_PART_NONE,
CPE_PART_HW,
CPE_PART_OS,
CPE_PART_APP
} cpe_part_t;
typedef enum {
CPE_FORMAT_UNKNOWN,
CPE_FORMAT_URI,
CPE_FORMAT_STRING,
CPE_FORMAT_WFN
} cpe_format_t;
struct cpe_name;
struct cpe_name *cpe_name_new(const char *cpe);
struct cpe_name * cpe_name_clone(struct cpe_name * old_name);
void cpe_name_free(struct cpe_name *cpe);
/************************************************************/
cpe_format_t cpe_name_get_format(const struct cpe_name *cpe);
cpe_part_t cpe_name_get_part(const struct cpe_name *cpe);
const char *cpe_name_get_vendor(const struct cpe_name *cpe);
const char *cpe_name_get_product(const struct cpe_name *cpe);
const char *cpe_name_get_version(const struct cpe_name *cpe);
const char *cpe_name_get_update(const struct cpe_name *cpe);
const char *cpe_name_get_edition(const struct cpe_name *cpe);
const char *cpe_name_get_language(const struct cpe_name *cpe);
const char *cpe_name_get_sw_edition(const struct cpe_name *cpe);
const char *cpe_name_get_target_sw(const struct cpe_name *cpe);
const char *cpe_name_get_target_hw(const struct cpe_name *cpe);
const char *cpe_name_get_other(const struct cpe_name *cpe);
char *cpe_name_get_as_format(const struct cpe_name *cpe, cpe_format_t format);
char *cpe_name_get_as_str(const struct cpe_name *cpe);
/************************************************************/
/************************************************************/
bool cpe_name_set_format(struct cpe_name *cpe, cpe_format_t newval);
bool cpe_name_set_part(struct cpe_name *cpe, cpe_part_t newval);
bool cpe_name_set_vendor(struct cpe_name *cpe, const char *newval);
bool cpe_name_set_product(struct cpe_name *cpe, const char *newval);
bool cpe_name_set_version(struct cpe_name *cpe, const char *newval);
bool cpe_name_set_update(struct cpe_name *cpe, const char *newval);
bool cpe_name_set_edition(struct cpe_name *cpe, const char *newval);
bool cpe_name_set_language(struct cpe_name *cpe, const char *newval);
bool cpe_name_set_sw_edition(struct cpe_name *cpe, const char *newval);
bool cpe_name_set_target_sw(struct cpe_name *cpe, const char *newval);
bool cpe_name_set_target_hw(struct cpe_name *cpe, const char *newval);
bool cpe_name_set_other(struct cpe_name *cpe, const char *newval);
/************************************************************/
/************************************************************/
bool cpe_name_match_one(const struct cpe_name *cpe, const struct cpe_name *against);
bool cpe_name_match_cpes(const struct cpe_name *name, size_t n, struct cpe_name **namelist);
int cpe_name_write(const struct cpe_name *cpe, FILE * f);
cpe_format_t cpe_name_get_format_of_str(const char *str);
bool cpe_name_check(const char *str);
int cpe_name_match_strs(const char *candidate, size_t n, char **targets);
const char * cpe_name_supported(void);
/************************************************************/
typedef bool *(*cpe_check_fn) (const char*, const char*, const char*, void*);
typedef bool *(*cpe_dict_fn) (const struct cpe_name*, void*);
#endif /* _CPEURI_H_ */