radix.c File Reference
#include "squid.h"
#include "radix.h"
#include "util.h"
Include dependency graph for radix.c:

Go to the source code of this file.

Macros

#define rn_masktop   (squid_mask_rnhead->rnh_treetop)
 
#define rn_dupedkey   rn_u.rn_leaf.rn_Dupedkey
 
#define rn_off   rn_u.rn_node.rn_Off
 
#define rn_l   rn_u.rn_node.rn_L
 
#define rn_r   rn_u.rn_node.rn_R
 
#define rm_mask   rm_rmu.rmu_mask
 
#define rm_leaf   rm_rmu.rmu_leaf /* extra field would make 32 bytes */
 
#define squid_Bcmp(a, b, l)   (l == 0 ? 0 : memcmp((caddr_t)(a), (caddr_t)(b), (u_long)l))
 
#define squid_R_Malloc(p, t, n)   (p = (t) xmalloc((unsigned int)(n)))
 
#define squid_Free(p)   xfree((char *)p)
 
#define squid_MKGet(m)
 
#define squid_MKFree(m)   { (m)->rm_mklist = squid_rn_mkfreelist; squid_rn_mkfreelist = (m);}
 
#define min(x, y)   ((x)<(y)? (x) : (y))
 

Functions

struct squid_radix_nodesquid_rn_search (void *v_arg, struct squid_radix_node *head)
 
struct squid_radix_nodesquid_rn_search_m (void *v_arg, struct squid_radix_node *head, void *m_arg)
 
int squid_rn_refines (void *m_arg, void *n_arg)
 
struct squid_radix_nodesquid_rn_lookup (void *v_arg, void *m_arg, struct squid_radix_node_head *head)
 
static int rn_satsifies_leaf (char *trial, register struct squid_radix_node *leaf, int skip)
 
struct squid_radix_nodesquid_rn_match (void *v_arg, struct squid_radix_node_head *head)
 
struct squid_radix_nodesquid_rn_newpair (void *v, int b, struct squid_radix_node nodes[2])
 
struct squid_radix_nodesquid_rn_insert (void *v_arg, struct squid_radix_node_head *head, int *dupentry, struct squid_radix_node nodes[2])
 
struct squid_radix_nodesquid_rn_addmask (void *n_arg, int search, int skip)
 
static int rn_lexobetter (void *m_arg, void *n_arg)
 
static struct squid_radix_maskrn_new_radix_mask (struct squid_radix_node *tt, struct squid_radix_mask *next)
 
struct squid_radix_nodesquid_rn_addroute (void *v_arg, void *n_arg, struct squid_radix_node_head *head, struct squid_radix_node treenodes[2])
 
struct squid_radix_nodesquid_rn_delete (void *v_arg, void *netmask_arg, struct squid_radix_node_head *head)
 
int squid_rn_walktree (struct squid_radix_node_head *h, int(*f)(struct squid_radix_node *, void *), void *w)
 
int squid_rn_inithead (struct squid_radix_node_head **head, int off)
 
void squid_rn_init (void)
 

Variables

int squid_max_keylen
 
struct squid_radix_masksquid_rn_mkfreelist
 
struct squid_radix_node_headsquid_mask_rnhead
 
static char * addmask_key
 
static unsigned char normal_chars [] = {0, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xFF}
 
static char * rn_zeros
 
static char * rn_ones
 

Macro Definition Documentation

#define min (   x,
 
)    ((x)<(y)? (x) : (y))

Definition at line 115 of file radix.c.

Referenced by rn_satsifies_leaf(), and squid_rn_match().

#define rm_leaf   rm_rmu.rmu_leaf /* extra field would make 32 bytes */

Definition at line 98 of file radix.c.

#define rm_mask   rm_rmu.rmu_mask

Definition at line 97 of file radix.c.

#define rn_dupedkey   rn_u.rn_leaf.rn_Dupedkey

Definition at line 93 of file radix.c.

#define rn_l   rn_u.rn_node.rn_L

Definition at line 95 of file radix.c.

#define rn_masktop   (squid_mask_rnhead->rnh_treetop)

Definition at line 92 of file radix.c.

Referenced by squid_rn_addmask().

#define rn_off   rn_u.rn_node.rn_Off

Definition at line 94 of file radix.c.

#define rn_r   rn_u.rn_node.rn_R

Definition at line 96 of file radix.c.

#define squid_Bcmp (   a,
  b,
 
)    (l == 0 ? 0 : memcmp((caddr_t)(a), (caddr_t)(b), (u_long)l))

Definition at line 101 of file radix.c.

#define squid_Free (   p)    xfree((char *)p)

Definition at line 103 of file radix.c.

Referenced by squid_rn_addmask().

#define squid_MKFree (   m)    { (m)->rm_mklist = squid_rn_mkfreelist; squid_rn_mkfreelist = (m);}

Definition at line 112 of file radix.c.

Referenced by squid_rn_delete().

#define squid_MKGet (   m)
Value:
{\
squid_rn_mkfreelist = (m)->rm_mklist; \
squid_R_Malloc(m, struct squid_radix_mask *, sizeof (*(m)));\
}
struct squid_radix_mask * squid_rn_mkfreelist
Definition: radix.c:85
#define squid_R_Malloc(p, t, n)
Definition: radix.c:102

Definition at line 104 of file radix.c.

Referenced by rn_new_radix_mask().

#define squid_R_Malloc (   p,
  t,
 
)    (p = (t) xmalloc((unsigned int)(n)))

Definition at line 102 of file radix.c.

Referenced by squid_rn_addmask(), squid_rn_init(), and squid_rn_inithead().

Function Documentation

static int rn_lexobetter ( void *  m_arg,
void *  n_arg 
)
static

Definition at line 508 of file radix.c.

Referenced by squid_rn_addroute().

static int rn_satsifies_leaf ( char *  trial,
register struct squid_radix_node leaf,
int  skip 
)
static

Definition at line 225 of file radix.c.

References min, and rn_ones.

Referenced by squid_rn_match().

void squid_rn_init ( void  )

Definition at line 941 of file radix.c.

References addmask_key, NULL, rn_ones, rn_zeros, squid_max_keylen, squid_R_Malloc, and squid_rn_inithead().

Referenced by asnInit().

struct squid_radix_node* squid_rn_insert ( void *  v_arg,
struct squid_radix_node_head head,
int dupentry,
struct squid_radix_node  nodes[2] 
)
struct squid_radix_node* squid_rn_lookup ( void *  v_arg,
void *  m_arg,
struct squid_radix_node_head head 
)

Definition at line 207 of file radix.c.

References squid_radix_node_head::rnh_treetop, squid_rn_addmask(), and squid_rn_match().

Referenced by asnAddNet(), and squid_rn_inithead().

struct squid_radix_node* squid_rn_newpair ( void *  v,
int  b,
struct squid_radix_node  nodes[2] 
)
int squid_rn_refines ( void *  m_arg,
void *  n_arg 
)

Definition at line 181 of file radix.c.

References int.

Referenced by squid_rn_addroute().

struct squid_radix_node* squid_rn_search ( void *  v_arg,
struct squid_radix_node head 
)

Definition at line 152 of file radix.c.

References squid_radix_node::rn_b, and squid_radix_node::rn_bmask.

Referenced by squid_rn_addmask(), squid_rn_delete(), and squid_rn_insert().

struct squid_radix_node* squid_rn_search_m ( void *  v_arg,
struct squid_radix_node head,
void *  m_arg 
)

Definition at line 166 of file radix.c.

References squid_radix_node::rn_b, and squid_radix_node::rn_bmask.

Referenced by squid_rn_match().

int squid_rn_walktree ( struct squid_radix_node_head h,
int(*)(struct squid_radix_node *, void *)  f,
void *  w 
)

Variable Documentation

char* addmask_key
static

Definition at line 87 of file radix.c.

Referenced by squid_rn_addmask(), and squid_rn_init().

unsigned char normal_chars[] = {0, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xFF}
static

Definition at line 88 of file radix.c.

Referenced by squid_rn_addmask().

char * rn_ones
static

Definition at line 89 of file radix.c.

Referenced by rn_satsifies_leaf(), squid_rn_addmask(), squid_rn_init(), and squid_rn_inithead().

char* rn_zeros
static

Definition at line 89 of file radix.c.

Referenced by squid_rn_init(), and squid_rn_inithead().

struct squid_radix_node_head* squid_mask_rnhead

Definition at line 86 of file radix.c.

int squid_max_keylen

Definition at line 84 of file radix.c.

Referenced by squid_rn_addmask(), and squid_rn_init().

struct squid_radix_mask* squid_rn_mkfreelist

Definition at line 85 of file radix.c.

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors