dhcpd-pools  3.0
ISC dhcpd lease usage analyser
Macros | Functions
hash.c File Reference

The leases hash functions. More...

#include <config.h>
#include <stdlib.h>
#include "xalloc.h"
#include "dhcpd-pools.h"
Include dependency graph for hash.c:

Macros

#define HASH_FIND_V6(head, findv6, out)   HASH_FIND(hh, head, findv6, 16, out)
 
#define HASH_ADD_V6(head, v6field, add)   HASH_ADD(hh, head, v6field, 16, add)
 

Functions

void add_lease_init (struct conf_t *state __attribute__((unused)), union ipaddr_t *addr __attribute__((unused)), enum ltype type __attribute__((unused)))
 Add a lease to hash array. More...
 
void add_lease_v4 (struct conf_t *state, union ipaddr_t *addr, enum ltype type)
 
void add_lease_v6 (struct conf_t *state, union ipaddr_t *addr, enum ltype type)
 
struct leases_tfind_lease_init (struct conf_t *state __attribute__((unused)), union ipaddr_t *addr __attribute__((unused)))
 Find pointer to lease from hash array. More...
 
struct leases_tfind_lease_v4 (struct conf_t *state, union ipaddr_t *addr)
 
struct leases_tfind_lease_v6 (struct conf_t *state, union ipaddr_t *addr)
 
void delete_lease (struct conf_t *state, struct leases_t *lease)
 Delete a lease from hash array. More...
 
void delete_all_leases (struct conf_t *state)
 Delete all leases from hash array. More...
 

Detailed Description

The leases hash functions.

The hash sorting is key to make analysis happen as quick as possible..

Macro Definition Documentation

◆ HASH_ADD_V6

#define HASH_ADD_V6 (   head,
  v6field,
  add 
)    HASH_ADD(hh, head, v6field, 16, add)

Referenced by add_lease_v6().

◆ HASH_FIND_V6

#define HASH_FIND_V6 (   head,
  findv6,
  out 
)    HASH_FIND(hh, head, findv6, 16, out)

Referenced by find_lease_v6().

Function Documentation

◆ add_lease_init()

void add_lease_init ( struct conf_t *state   __attribute__(unused),
union ipaddr_t *addr   __attribute__(unused),
enum ltype type   __attribute__(unused) 
)

Add a lease to hash array.

Parameters
addrBinary IP to be added in leases hash.
typeLease state of the IP.

◆ add_lease_v4()

void add_lease_v4 ( struct conf_t state,
union ipaddr_t addr,
enum ltype  type 
)

Referenced by set_ipv_functions().

Here is the call graph for this function:

◆ add_lease_v6()

void add_lease_v6 ( struct conf_t state,
union ipaddr_t addr,
enum ltype  type 
)

Referenced by set_ipv_functions().

Here is the call graph for this function:

◆ delete_all_leases()

void delete_all_leases ( struct conf_t state)

Delete all leases from hash array.

Referenced by clean_up(), and delete_lease().

◆ delete_lease()

void delete_lease ( struct conf_t state,
struct leases_t lease 
)

Delete a lease from hash array.

Parameters
leasePointer to lease hash.

Referenced by parse_leases().

Here is the call graph for this function:

◆ find_lease_init()

struct leases_t* find_lease_init ( struct conf_t *state   __attribute__(unused),
union ipaddr_t *addr   __attribute__(unused) 
)

Find pointer to lease from hash array.

Parameters
addrBinary IP searched from leases hash.
Returns
A lease structure about requested IP, or NULL.

◆ find_lease_v4()

struct leases_t* find_lease_v4 ( struct conf_t state,
union ipaddr_t addr 
)

Referenced by set_ipv_functions().

◆ find_lease_v6()

struct leases_t* find_lease_v6 ( struct conf_t state,
union ipaddr_t addr 
)

Referenced by set_ipv_functions().