unbound: services/view.c File Reference

unbound 0.1

Functions
view.c File Reference

This file contains functions to enable named views that can hold local zone authority service. More...

`#include "config.h"`
`#include "services/view.h"`
`#include "services/localzone.h"`
`#include "util/config_file.h"`

## Functions
int | view_cmp (const void *v1, const void *v2)
| Compare two view entries in rbtree.
struct views * | views_create (void)
| Create views storage.
void | respip_set_delete (struct respip_set *set)
| Delete response IP set.
void | view_delete (struct view *v)
| Delete one view.
static void | delviewnode (rbnode_type *n, void *ATTR_UNUSED(arg))
void | views_delete (struct views *v)
| Delete views storage.
static struct view * | view_create (char *name)
| create a new view
static struct view * | views_enter_view_name (struct views *vs, char *name)
| enter a new view returns with WRlock
int | views_apply_cfg (struct views *vs, struct config_file *cfg)
| Apply config settings; Takes care of locking.
struct view * | views_find_view (struct views *vs, const char *name, int write)
| find a view by name
void | views_print (struct views *v)
| Debug helper.

## Detailed Description

This file contains functions to enable named views that can hold local zone authority service.

## Function Documentation

## ◆ view_cmp()

int view_cmp | ( | const void * | v1,
|  | const void * | v2 )

Compare two view entries in rbtree.

Sort canonical.

Parameters

  v1 | view 1
  v2 | view 2

Returns
  : negative, positive or 0 comparison value.

References view::name.

Referenced by fptr_whitelist_rbtree_cmp(), and views_create().

## ◆ views_create()

struct views * views_create | ( | void |  | ) |

Create views storage.

Returns
  new struct or NULL on error.

References views::lock, rbtree_init(), view_cmp(), and views::vtree.

Referenced by daemon_fork(), respip_view_conf_actions_test(), respip_view_conf_data_test(), and view_and_respipchecks().

## ◆ respip_set_delete()

void respip_set_delete | ( | struct respip_set * | set | ) |

Delete response IP set.

Parameters

  set | to delete.

References regional_destroy(), resp_addr_del(), and traverse_postorder().

Referenced by daemon_cleanup(), respip_conf_actions_test(), respip_conf_data_test(), rpz_clear(), rpz_create(), rpz_delete(), view_and_respipchecks(), and view_delete().

## ◆ view_delete()

void view_delete | ( | struct view * | v | ) |

Delete one view.

Parameters

  v | view to delete.

References view::local_zones, local_zones_delete(), view::lock, view::name, view::respip_set, and respip_set_delete().

Referenced by views_enter_view_name().

## ◆ views_delete()

void views_delete | ( | struct views * | v | ) |

Delete views storage.

Parameters

  v | views to delete.

References views::lock, traverse_postorder(), and views::vtree.

Referenced by daemon_cleanup(), respip_view_conf_actions_test(), respip_view_conf_data_test(), and view_and_respipchecks().

## ◆ views_apply_cfg()

int views_apply_cfg | ( | struct views * | v,
|  | struct config_file * | cfg )

Apply config settings; Takes care of locking.

Parameters

  v | view is set up.
  cfg | config data.

Returns
  false on error.

References cfg_str2list_insert(), config_view::isfirst, view::isfirst, config_file::local_data, config_view::local_data, config_file::local_zones, config_view::local_zones, view::local_zones, local_zones_apply_cfg(), local_zones_create(), config_file::local_zones_disable_default, config_file::local_zones_nodefault, config_view::local_zones_nodefault, view::lock, log_err(), config_view::name, config_strlist::next, config_view::next, config_strlist::str, config_file::views, and views_enter_view_name().

Referenced by daemon_fork(), respip_view_conf_actions_test(), respip_view_conf_data_test(), and view_and_respipchecks().

## ◆ views_find_view()

struct view * views_find_view | ( | struct views * | vs,
|  | const char * | name,
|  | int | write )

find a view by name

Find a view by name.

References rbnode_type::key, view::lock, views::lock, view::name, view::node, rbtree_search(), and views::vtree.

Referenced by acl_list_view_cfg(), acl_view_tag_checks(), do_view_data_add(), do_view_data_remove(), do_view_datas_add(), do_view_datas_remove(), do_view_list_local_data(), do_view_list_local_zones(), do_view_zone_add(), do_view_zone_remove(), respip_view_conf_actions_test(), respip_view_conf_data_test(), and respip_views_apply_cfg().

## ◆ views_print()

void views_print | ( | struct views * | v | ) |

Debug helper.

Print all views Takes care of locking.

Parameters

  v | the views tree