ip_tree.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <assert.h>
#include "../../dprint.h"
#include "../../mem/shm_mem.h"
#include "ip_tree.h"

Include dependency graph for ip_tree.c:

Go to the source code of this file.

Defines

#define is_hot_leaf(_node)
#define is_hot_non_leaf(_node)
#define is_warm_leaf(_node)   ( (_node)->hits[CURR_POS]>=root->max_hits>>2 )
#define MAX_TYPE_VAL(_x)   (( (1<<(8*sizeof(_x)-1))-1 )|( (1<<(8*sizeof(_x)-1)) ))

Functions

static void destroy_ip_node (struct ip_node *node)
void destroy_ip_tree (void)
struct ip_nodeget_tree_branch (unsigned char b)
int init_ip_tree (int maximum_hits)
static gen_lock_set_t * init_lock_set (int *size)
int is_node_hot_leaf (struct ip_node *node)
void lock_tree_branch (unsigned char b)
struct ip_nodemark_node (unsigned char *ip, int ip_len, struct ip_node **father, unsigned char *flag)
static struct ip_nodenew_ip_node (unsigned char byte)
static struct ip_nodeprv_get_tree_branch (unsigned char b)
static void prv_lock_tree_branch (unsigned char b)
static void prv_unlock_tree_branch (unsigned char b)
void remove_node (struct ip_node *node)
struct ip_nodesplit_node (struct ip_node *dad, unsigned char byte)
void unlock_tree_branch (unsigned char b)

Variables

static struct ip_treeroot = 0


Define Documentation

#define is_hot_leaf ( _node   ) 

Value:

( (_node)->leaf_hits[PREV_POS]>=root->max_hits ||\
     (_node)->leaf_hits[CURR_POS]>=root->max_hits ||\
     (((_node)->leaf_hits[PREV_POS]+(_node)->leaf_hits[CURR_POS])>>1)>=\
       root->max_hits )

Definition at line 248 of file ip_tree.c.

Referenced by is_node_hot_leaf(), and mark_node().

#define is_hot_non_leaf ( _node   ) 

Value:

( (_node)->hits[PREV_POS]>=root->max_hits>>2 ||\
     (_node)->hits[CURR_POS]>=root->max_hits>>2 ||\
     (((_node)->hits[PREV_POS]+(_node)->hits[CURR_POS])>>1)>=\
       root->max_hits>>2 )

Definition at line 242 of file ip_tree.c.

Referenced by mark_node().

#define is_warm_leaf ( _node   )     ( (_node)->hits[CURR_POS]>=root->max_hits>>2 )

Definition at line 254 of file ip_tree.c.

Referenced by mark_node().

#define MAX_TYPE_VAL ( _x   )     (( (1<<(8*sizeof(_x)-1))-1 )|( (1<<(8*sizeof(_x)-1)) ))

Definition at line 257 of file ip_tree.c.

Referenced by mark_node().


Function Documentation

static void destroy_ip_node ( struct ip_node node  )  [inline, static]

Definition at line 155 of file ip_tree.c.

References ip_node::kids, ip_node::next, and shm_free.

Referenced by destroy_ip_tree(), and remove_node().

void destroy_ip_tree ( void   ) 

struct ip_node* get_tree_branch ( unsigned char  b  )  [read]

Definition at line 67 of file ip_tree.c.

References prv_get_tree_branch().

Referenced by mi_pike_list(), and swap_routine().

int init_ip_tree ( int  maximum_hits  ) 

static gen_lock_set_t* init_lock_set ( int *  size  )  [static]

Definition at line 82 of file ip_tree.c.

References LM_ERR, and LM_INFO.

Referenced by init_ip_tree().

int is_node_hot_leaf ( struct ip_node node  ) 

Definition at line 261 of file ip_tree.c.

References is_hot_leaf.

Referenced by refresh_node().

void lock_tree_branch ( unsigned char  b  ) 

Definition at line 71 of file ip_tree.c.

References prv_lock_tree_branch().

Referenced by clean_routine(), mi_pike_list(), pike_check_req(), and swap_routine().

struct ip_node* mark_node ( unsigned char *  ip,
int  ip_len,
struct ip_node **  father,
unsigned char *  flag 
) [read]

static struct ip_node* new_ip_node ( unsigned char  byte  )  [static, read]

Definition at line 199 of file ip_tree.c.

References ip_node::byte, LM_ERR, and shm_malloc().

Referenced by mark_node(), and split_node().

static struct ip_node* prv_get_tree_branch ( unsigned char  b  )  [static, read]

Definition at line 45 of file ip_tree.c.

References ip_tree::entries, and ip_tree::entry::node.

Referenced by get_tree_branch().

static void prv_lock_tree_branch ( unsigned char  b  )  [inline, static]

Definition at line 52 of file ip_tree.c.

References ip_tree::entries, ip_tree::entry_lock_set, and ip_tree::entry::lock_idx.

Referenced by lock_tree_branch().

static void prv_unlock_tree_branch ( unsigned char  b  )  [inline, static]

Definition at line 60 of file ip_tree.c.

References ip_tree::entries, ip_tree::entry_lock_set, and ip_tree::entry::lock_idx.

Referenced by unlock_tree_branch().

void remove_node ( struct ip_node node  ) 

struct ip_node* split_node ( struct ip_node dad,
unsigned char  byte 
) [read]

void unlock_tree_branch ( unsigned char  b  ) 

Definition at line 75 of file ip_tree.c.

References prv_unlock_tree_branch().

Referenced by clean_routine(), mi_pike_list(), pike_check_req(), and swap_routine().


Variable Documentation

struct ip_tree* root = 0 [static]


Generated on Wed May 23 08:01:16 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6