vtparser.c File Reference

Simple JSON reader. More...

`#include "../base/cvss.h"`
`#include "../util/jsonpull.h"`
`#include "openvasd.h"`
`#include <cjson/cJSON.h>`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <unistd.h>`

Go to the source code of this file.

## Macros

#define | _GNU_SOURCE /* See feature_test_macros(7) */
#define | _FILE_OFFSET_BITS 64

## Enumerations

enum | nvt_category { ACT_INIT = 0 , ACT_SCANNER , ACT_SETTINGS , ACT_GATHER_INFO , ACT_ATTACK , ACT_MIXED_ATTACK , ACT_DESTRUCTIVE_ATTACK , ACT_DENIAL , ACT_KILL_HOST , ACT_FLOOD , ACT_END }
| VT categories. More...

## 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)
nvti_t * | openvasd_parse_vt (gvm_json_pull_parser_t *parser, gvm_json_pull_event_t *event)
| Parse a VT element given in json format.

## Detailed Description

Simple JSON reader.

## Macro Definition Documentation

## _FILE_OFFSET_BITS

#define _FILE_OFFSET_BITS 64

## _GNU_SOURCE

#define _GNU_SOURCE /* See feature_test_macros(7) */

## Enumeration Type Documentation

## nvt_category

enum nvt_category

VT categories.

Enumerator
ACT_INIT |
ACT_SCANNER |
ACT_SETTINGS |
ACT_GATHER_INFO |
ACT_ATTACK |
ACT_MIXED_ATTACK |
ACT_DESTRUCTIVE_ATTACK |
ACT_DENIAL |
ACT_KILL_HOST |
ACT_FLOOD |
ACT_END |

## 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

  cat | The category as string.

Returns
  Integer representing the category type.

## openvasd_parse_vt()

nvti_t * openvasd_parse_vt | ( | gvm_json_pull_parser_t * | parser,
|  | gvm_json_pull_event_t * | event
| ) |  |

Parse a VT element given in json format.

Parameters

  parser | Json pull parser.
  event | Json pull event.

Returns
  nvti structure containing the VT metadata, NULL otherwise. The nvti struct must be freed with nvti_free() by the caller.

## parse_references()

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

static