Maintained by: NLnet Labs
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. More...
 
struct viewsviews_create (void)
 Create views storage. More...
 
void respip_set_delete (struct respip_set *set)
 This prototype is defined in in respip.h, but we want to avoid unnecessary dependencies. More...
 
void view_delete (struct view *v)
 Delete one view. More...
 
static void delviewnode (rbnode_type *n, void *ATTR_UNUSED(arg))
 
void views_delete (struct views *v)
 Delete views storage. More...
 
static struct viewview_create (char *name)
 create a new view
 
static struct viewviews_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. More...
 
struct viewviews_find_view (struct views *vs, const char *name, int write)
 find a view by name
 
void views_print (struct views *v)
 Debug helper. More...
 

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
v1view 1
v2view 2
Returns
: negative, positive or 0 comparison value.

References view::name.

Referenced by views_create().

◆ views_create()

struct views* views_create ( void  )

Create views storage.

Returns
new struct or NULL on error.

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

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

◆ respip_set_delete()

void respip_set_delete ( struct respip_set set)

This prototype is defined in in respip.h, but we want to avoid unnecessary dependencies.

This prototype is defined in in respip.h, but we want to avoid unnecessary dependencies.

Parameters
setto delete.

References regional_destroy().

Referenced by daemon_cleanup(), respip_conf_data_test(), view_delete(), and views_create().

◆ view_delete()

void view_delete ( struct view v)

Delete one view.

Parameters
vview 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
vviews to delete.

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

Referenced by daemon_cleanup(), and respip_view_conf_data_test().

◆ views_apply_cfg()

int views_apply_cfg ( struct views v,
struct config_file cfg 
)

◆ views_print()

void views_print ( struct views v)

Debug helper.

Print all views Takes care of locking.

Parameters
vthe views tree