Greenbone Vulnerability Management Libraries 22.22.0
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 void add_tags_to_nvt (nvti_t *nvt, cJSON *tag_obj)
 
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()

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

◆ add_tags_to_nvt()

static void add_tags_to_nvt ( nvti_t * nvt,
cJSON * tag_obj )
static

◆ get_category_from_name()

static int get_category_from_name ( const gchar * cat)
static

Get the VT category type given the category as string.

Parameters
catThe category as string.
Returns
Integer representing the category type.

◆ parse_references()

static 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]parserJson pull parser.
[in]eventJson pull event.
[out]nvtThe 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.