pool.c File Reference
#include "syshead.h"
#include "pool.h"
#include "buffer.h"
#include "error.h"
#include "socket.h"
#include "otime.h"
#include "memdbg.h"
Include dependency graph for pool.c:

Go to the source code of this file.


static void ifconfig_pool_entry_free (struct ifconfig_pool_entry *ipe, bool hard)
static int ifconfig_pool_find (struct ifconfig_pool *pool, const char *common_name)
bool ifconfig_pool_verify_range (const int msglevel, const in_addr_t start, const in_addr_t end)
struct ifconfig_poolifconfig_pool_init (const bool ipv4_pool, enum pool_type type, in_addr_t start, in_addr_t end, const bool duplicate_cn, const bool ipv6_pool, const struct in6_addr ipv6_base, const int ipv6_netbits)
void ifconfig_pool_free (struct ifconfig_pool *pool)
ifconfig_pool_handle ifconfig_pool_acquire (struct ifconfig_pool *pool, in_addr_t *local, in_addr_t *remote, struct in6_addr *remote_ipv6, const char *common_name)
bool ifconfig_pool_release (struct ifconfig_pool *pool, ifconfig_pool_handle hand, const bool hard)
static ifconfig_pool_handle ifconfig_pool_ip_base_to_handle (const struct ifconfig_pool *pool, const in_addr_t addr)
static ifconfig_pool_handle ifconfig_pool_ipv6_base_to_handle (const struct ifconfig_pool *pool, const struct in6_addr *in_addr)
static in_addr_t ifconfig_pool_handle_to_ip_base (const struct ifconfig_pool *pool, ifconfig_pool_handle hand)
static struct in6_addr ifconfig_pool_handle_to_ipv6_base (const struct ifconfig_pool *pool, ifconfig_pool_handle hand)
static void ifconfig_pool_set (struct ifconfig_pool *pool, const char *cn, ifconfig_pool_handle h, const bool fixed)
static void ifconfig_pool_list (const struct ifconfig_pool *pool, struct status_output *out)
static void ifconfig_pool_msg (const struct ifconfig_pool *pool, int msglevel)
struct ifconfig_pool_persistifconfig_pool_persist_init (const char *filename, int refresh_freq)
void ifconfig_pool_persist_close (struct ifconfig_pool_persist *persist)
bool ifconfig_pool_write_trigger (struct ifconfig_pool_persist *persist)
void ifconfig_pool_read (struct ifconfig_pool_persist *persist, struct ifconfig_pool *pool)
void ifconfig_pool_write (struct ifconfig_pool_persist *persist, const struct ifconfig_pool *pool)

Function Documentation

◆ ifconfig_pool_acquire()

ifconfig_pool_handle ifconfig_pool_acquire ( struct ifconfig_pool pool,
in_addr_t local,
in_addr_t remote,
struct in6_addr *  remote_ipv6,
const char *  common_name 

◆ ifconfig_pool_entry_free()

static void ifconfig_pool_entry_free ( struct ifconfig_pool_entry ipe,
bool  hard 

◆ ifconfig_pool_find()

static int ifconfig_pool_find ( struct ifconfig_pool pool,
const char *  common_name 

◆ ifconfig_pool_free()

void ifconfig_pool_free ( struct ifconfig_pool pool)

Definition at line 292 of file pool.c.

References free, ifconfig_pool_entry_free(), ifconfig_pool::list, and ifconfig_pool::size.

Referenced by ifconfig_pool_write(), and multi_uninit().

◆ ifconfig_pool_handle_to_ip_base()

static in_addr_t ifconfig_pool_handle_to_ip_base ( const struct ifconfig_pool pool,
ifconfig_pool_handle  hand 

◆ ifconfig_pool_handle_to_ipv6_base()

static struct in6_addr ifconfig_pool_handle_to_ipv6_base ( const struct ifconfig_pool pool,
ifconfig_pool_handle  hand 

Definition at line 477 of file pool.c.

References add_in6_addr().

Referenced by ifconfig_pool_list().

◆ ifconfig_pool_init()

struct ifconfig_pool* ifconfig_pool_init ( const bool  ipv4_pool,
enum pool_type  type,
in_addr_t  start,
in_addr_t  end,
const bool  duplicate_cn,
const bool  ipv6_pool,
const struct in6_addr  ipv6_base,
const int  ipv6_netbits 

◆ ifconfig_pool_ip_base_to_handle()

static ifconfig_pool_handle ifconfig_pool_ip_base_to_handle ( const struct ifconfig_pool pool,
const in_addr_t  addr 

◆ ifconfig_pool_ipv6_base_to_handle()

static ifconfig_pool_handle ifconfig_pool_ipv6_base_to_handle ( const struct ifconfig_pool pool,
const struct in6_addr *  in_addr 

Definition at line 408 of file pool.c.

References ifconfig_pool::base, in_addr_t, ifconfig_pool::ipv6, and ifconfig_pool::size.

Referenced by ifconfig_pool_read().

◆ ifconfig_pool_list()

static void ifconfig_pool_list ( const struct ifconfig_pool pool,
struct status_output out 

◆ ifconfig_pool_msg()

static void ifconfig_pool_msg ( const struct ifconfig_pool pool,
int  msglevel 

Definition at line 539 of file pool.c.

References ASSERT, ifconfig_pool_list(), status_close(), status_open(), and status_printf().

Referenced by ifconfig_pool_read().

◆ ifconfig_pool_persist_close()

void ifconfig_pool_persist_close ( struct ifconfig_pool_persist persist)

Definition at line 574 of file pool.c.

References ifconfig_pool_persist::file, free, and status_close().

Referenced by do_close_ifconfig_pool_persist().

◆ ifconfig_pool_persist_init()

struct ifconfig_pool_persist* ifconfig_pool_persist_init ( const char *  filename,
int  refresh_freq 

◆ ifconfig_pool_read()

void ifconfig_pool_read ( struct ifconfig_pool_persist persist,
struct ifconfig_pool pool 

◆ ifconfig_pool_release()

bool ifconfig_pool_release ( struct ifconfig_pool pool,
ifconfig_pool_handle  hand,
const bool  hard 

◆ ifconfig_pool_set()

static void ifconfig_pool_set ( struct ifconfig_pool pool,
const char *  cn,
ifconfig_pool_handle  h,
const bool  fixed 

◆ ifconfig_pool_verify_range()

bool ifconfig_pool_verify_range ( const int  msglevel,
const in_addr_t  start,
const in_addr_t  end 

Definition at line 123 of file pool.c.

References gc_free(), gc_new(), IFCONFIG_POOL_MAX, msg, and print_in_addr_t().

Referenced by add_option(), and helper_client_server().

◆ ifconfig_pool_write()

void ifconfig_pool_write ( struct ifconfig_pool_persist persist,
const struct ifconfig_pool pool 

◆ ifconfig_pool_write_trigger()

bool ifconfig_pool_write_trigger ( struct ifconfig_pool_persist persist)

Definition at line 587 of file pool.c.

References ifconfig_pool_persist::file, and status_trigger().

Referenced by multi_ifconfig_pool_persist().