#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"

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_node * | get_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_node * | mark_node (unsigned char *ip, int ip_len, struct ip_node **father, unsigned char *flag) |
| static struct ip_node * | new_ip_node (unsigned char byte) |
| static struct ip_node * | prv_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_node * | split_node (struct ip_node *dad, unsigned char byte) |
| void | unlock_tree_branch (unsigned char b) |
Variables | |
| static struct ip_tree * | root = 0 |
| #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)) )) |
| 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 | ) |
Definition at line 172 of file ip_tree.c.
References destroy_ip_node(), ip_tree::entries, ip_tree::entry_lock_set, MAX_IP_BRANCHES, ip_tree::entry::node, and shm_free.
Referenced by pike_exit(), and pike_init().
| 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 | ) |
Definition at line 116 of file ip_tree.c.
References ip_tree::entries, ip_tree::entry_lock_set, init_lock_set(), LM_ERR, ip_tree::entry::lock_idx, ip_tree::max_hits, MAX_IP_BRANCHES, ip_tree::entry::node, shm_free, and shm_malloc().
Referenced by pike_init().
| 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 | ) |
| 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] |
Definition at line 268 of file ip_tree.c.
References ip_node::branch, ip_node::byte, CURR_POS, ip_tree::entries, ip_node::flags, ip_node::hits, is_hot_leaf, is_hot_non_leaf, is_warm_leaf, ip_node::kids, ip_node::leaf_hits, LM_DBG, MAX_TYPE_VAL, new_ip_node(), NEW_NODE, NEWRED_NODE, ip_node::next, NO_UPDATE, ip_tree::entry::node, NODE_IPLEAF_FLAG, NODE_ISRED_FLAG, RED_NODE, and split_node().
Referenced by pike_check_req().
| 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 | ) |
Definition at line 348 of file ip_tree.c.
References ip_node::byte, destroy_ip_node(), ip_tree::entries, ip_node::kids, LM_DBG, ip_node::next, ip_tree::entry::node, and ip_node::prev.
Referenced by clean_routine().
Definition at line 216 of file ip_tree.c.
References ip_node::branch, CURR_POS, ip_node::hits, ip_node::kids, ip_node::leaf_hits, new_ip_node(), ip_node::next, ip_node::prev, and PREV_POS.
Referenced by mark_node().
| 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().
Definition at line 42 of file ip_tree.c.
Referenced by add_rr_param(), child_init(), clone_mi_tree(), init_mi_tree(), mi_datagram_parse_tree(), mi_find_domain(), mi_parse_tree(), mi_show_rtpproxies(), mi_translate(), and mi_usrloc_dump().
1.5.6