cpelang_priv.c File Reference

Interface to Common Platform Enumeration (CPE) Language. More...

`#include <libxml/xmlreader.h>`
`#include <libxml/xmlwriter.h>`
`#include <libxml/tree.h>`
`#include <string.h>`
`#include "public/cpe_lang.h"`
`#include "cpelang_priv.h"`
`#include "common/util.h"`
`#include "common/list.h"`
`#include "common/text_priv.h"`
`#include "common/elements.h"`
`#include "common/_error.h"`
`#include "common/xmlns_priv.h"`
`#include "common/xmltext_priv.h"`

## Data Structures

struct | cpe_lang_model
| CPE platform specification. More...
struct | cpe_platform
| Single platform representation in CPE language. More...

## Macros

#define | TAG_PLATFORM_SPEC_STR BAD_CAST "platform-specification"
#define | TAG_PLATFORM_STR BAD_CAST "platform"
#define | TAG_LOGICAL_TEST_STR BAD_CAST "logical-test"
#define | TAG_FACT_REF_STR BAD_CAST "fact-ref"
#define | TAG_CHECK_FACT_REF_STR BAD_CAST "check-fact-ref"
#define | TAG_REMARK_STR BAD_CAST "remark"
#define | ATTR_TITLE_STR BAD_CAST "title"
#define | ATTR_NAME_STR BAD_CAST "name"
#define | ATTR_OPERATOR_STR BAD_CAST "operator"
#define | ATTR_NEGATE_STR BAD_CAST "negate"
#define | ATTR_ID_STR BAD_CAST "id"
#define | ATTR_HREF_STR BAD_CAST "href"
#define | ATTR_SYSTEM_STR BAD_CAST "system"
#define | ATTR_ID_REF_STR BAD_CAST "id-ref"
#define | VAL_AND_STR BAD_CAST "AND"
#define | VAL_OR_STR BAD_CAST "OR"
#define | VAL_FALSE_STR BAD_CAST "false"
#define | VAL_TRUE_STR BAD_CAST "true"

## Functions

struct cpe_testexpr * | cpe_testexpr_get_next (const struct cpe_testexpr *expr)
struct cpe_testexpr * | cpe_testexpr_new ()
struct cpe_testexpr * | cpe_testexpr_clone (struct cpe_testexpr *old_expr)
struct cpe_lang_model * | cpe_lang_model_new ()
struct cpe_platform * | cpe_platform_new ()
struct cpe_lang_model * | cpe_lang_model_parse_xml (const char *file)
| Function for parsing XML CPE language file. More...
struct cpe_lang_model * | cpe_lang_model_parse (xmlTextReaderPtr reader)
| Parse function for CPE Lang model. More...
struct cpe_platform * | cpe_platform_parse (xmlTextReaderPtr reader)
| Parse CPE platform structure. More...
struct cpe_testexpr * | cpe_testexpr_parse (xmlTextReaderPtr reader)
| Parse CPE test expression structure. More...
void | cpe_lang_model_export_xml (const struct cpe_lang_model *spec, const char *file)
| Function for export CPE language model to XML. More...
void | cpe_lang_export (const struct cpe_lang_model *spec, xmlTextWriterPtr writer)
| Function for export CPE language top element. More...
void | cpe_platform_export (const struct cpe_platform *platform, xmlTextWriterPtr writer)
| Function for export CPE platform element. More...
void | cpe_testexpr_export (const struct cpe_testexpr *expr, xmlTextWriterPtr writer)
| Function for export CPE test expression element. More...
void | cpe_lang_model_free (struct cpe_lang_model *platformspec)
void | cpe_platform_free (struct cpe_platform *platform)
void | cpe_testexpr_free (struct cpe_testexpr *expr)
struct cpe_testexpr_iterator * | cpe_testexpr_get_meta_expr (const struct cpe_testexpr *expr)
struct cpe_name * | cpe_testexpr_get_meta_cpe (const struct cpe_testexpr *expr)
const char * | cpe_testexpr_get_meta_check_system (const struct cpe_testexpr *expr)
const char * | cpe_testexpr_get_meta_check_href (const struct cpe_testexpr *expr)
const char * | cpe_testexpr_get_meta_check_id (const struct cpe_testexpr *expr)
bool | cpe_testexpr_set_oper (struct cpe_testexpr *expr, cpe_lang_oper_t oper)
bool | cpe_testexpr_set_name (struct cpe_testexpr *expr, struct cpe_name *name)
bool | cpe_testexpr_add_subexpression (struct cpe_testexpr *expr, struct cpe_testexpr *sub)
bool | cpe_lang_model_add_platform (struct cpe_lang_model *lang, struct cpe_platform *platform)
void | cpe_platform_iterator_remove (struct cpe_platform_iterator *it, struct cpe_lang_model *parent)
bool | cpe_platform_set_expr (struct cpe_platform *platform, struct cpe_testexpr *expr)
bool | cpe_lang_model_set_origin_file (struct cpe_lang_model *lang_model, const char *origin_file)
| Sets the origin file hint. More...
const char * | cpe_lang_model_get_origin_file (const struct cpe_lang_model *lang_model)
| Gets the file the CPE dict model was loaded from.

## Detailed Description

Interface to Common Platform Enumeration (CPE) Language.

See more details at http://nvd.nist.gov/cpe.cfm

## Function Documentation

void cpe_lang_export | ( | const struct cpe_lang_model * | spec,
|  | xmlTextWriterPtr | writer
| ) |  |

Function for export CPE language top element.

Parameters

  writer | xmlTextWriterPtr structure representing XML model
  spec | CPE language model structure

void cpe_lang_model_export_xml | ( | const struct cpe_lang_model * | spec,
|  | const char * | file
| ) |  |

Function for export CPE language model to XML.

Parameters

  spec | CPE language model structure
  file | filename

struct cpe_lang_model* cpe_lang_model_parse | ( | xmlTextReaderPtr | reader | ) |

read

Parse function for CPE Lang model.

Parameters

  reader | xmlTextReaderPtr structure representing XML model

struct cpe_lang_model* cpe_lang_model_parse_xml | ( | const char * | file | ) |

read

Function for parsing XML CPE language file.

Parameters

  file | filename

void cpe_platform_export | ( | const struct cpe_platform * | platform,
|  | xmlTextWriterPtr | writer
| ) |  |

Function for export CPE platform element.

Parameters

  writer | xmlTextWriterPtr structure representing XML model
  platform | CPE platform structure

struct cpe_platform* cpe_platform_parse | ( | xmlTextReaderPtr | reader | ) |

read

Parse CPE platform structure.

Parameters

  reader | xmlTextReaderPtr structure representing XML model

Returns
  cpe_platform structure with CPE platform item

void cpe_testexpr_export | ( | const struct cpe_testexpr * | expr,
|  | xmlTextWriterPtr | writer
| ) |  |

Function for export CPE test expression element.

Parameters

  writer | xmlTextWriterPtr structure representing XML model
  expr | CPE test expression structure

struct cpe_testexpr* cpe_testexpr_parse | ( | xmlTextReaderPtr | reader | ) |

read

Parse CPE test expression structure.

Parameters

  reader | xmlTextReaderPtr structure representing XML model

Returns
  cpe_testexpr structure with CPE test expression item