vtparser.c File Reference

Simple JSON reader. More...

`#include "vtparser.h"`

Go to the source code of this file.

## Macros

#define | G_LOG_DOMAIN "libgvm util"
| GLib logging domain.

## Functions

static int | get_category_from_name (const gchar *cat)
| Get the VT category type given the category as string.
static int | add_tags_to_nvt (nvti_t *nvt, cJSON *tag_obj)
| Add to the NVT Info structure.
static void | parse_references (nvti_t *nvt, cJSON *vt_obj)
static void | add_preferences_to_nvt (nvti_t *nvt, cJSON *vt_obj)
int | parse_vt_json (gvm_json_pull_parser_t *parser, gvm_json_pull_event_t *event, nvti_t **nvt)
| Parse a VT element given in json format.

## Detailed Description

Simple JSON reader.

## Macro Definition Documentation

## G_LOG_DOMAIN

#define G_LOG_DOMAIN "libgvm util"

GLib logging domain.

## Function Documentation

## add_preferences_to_nvt()

void add_preferences_to_nvt | ( | nvti_t * | nvt,
|  | cJSON * | vt_obj )

static

## add_tags_to_nvt()

int add_tags_to_nvt | ( | nvti_t * | nvt,
|  | cJSON * | tag_obj )

static

Add to the NVT Info structure.

Parameters

  nvt | The NVT Info structure.
  tag_obj | The JSON object containing the tags.

Returns
  0 on success, -1 on error.

## get_category_from_name()

int get_category_from_name | ( | const gchar * | cat | ) |

static

Get the VT category type given the category as string.

Parameters

  cat | The category as string.

Returns
  Integer representing the category type.

## parse_references()

void parse_references | ( | nvti_t * | nvt,
|  | cJSON * | vt_obj )

static

## parse_vt_json()

int parse_vt_json | ( | gvm_json_pull_parser_t * | parser,
|  | gvm_json_pull_event_t * | event,
|  | nvti_t ** | nvt )

Parse a VT element given in json format.

Parameters

  [in] | parser | Json pull parser.
  [in] | event | Json pull event.
  [out] | nvt | The NVT Info structure to fill with the parsed data.

Returns
  0 on success, 1 on end of feed, -1 on error. In case of success the nvti struct must be freed with nvti_free() by the caller.