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_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

◆ min

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

Definition at line 114 of file radix.c.

◆ rm_leaf

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

Definition at line 98 of file radix.c.

◆ rm_mask

#define rm_mask   rm_rmu.rmu_mask

Definition at line 97 of file radix.c.

◆ rn_dupedkey

#define rn_dupedkey   rn_u.rn_leaf.rn_Dupedkey

Definition at line 93 of file radix.c.

◆ rn_l

#define rn_l   rn_u.rn_node.rn_L

Definition at line 95 of file radix.c.

◆ rn_masktop

#define rn_masktop   (squid_mask_rnhead->rnh_treetop)

Definition at line 92 of file radix.c.

◆ rn_off

#define rn_off   rn_u.rn_node.rn_Off

Definition at line 94 of file radix.c.

◆ rn_r

#define rn_r   rn_u.rn_node.rn_R

Definition at line 96 of file radix.c.

◆ squid_Free

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

Definition at line 102 of file radix.c.

◆ squid_MKFree

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

Definition at line 111 of file radix.c.

◆ squid_MKGet

#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:101

Definition at line 103 of file radix.c.

◆ squid_R_Malloc

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

Definition at line 101 of file radix.c.

Function Documentation

◆ rn_lexobetter()

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

Definition at line 484 of file radix.c.

Referenced by squid_rn_addroute().

◆ rn_new_radix_mask()

◆ rn_satsifies_leaf()

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

Definition at line 224 of file radix.c.

References min, and rn_ones.

Referenced by squid_rn_match().

◆ squid_rn_addmask()

◆ squid_rn_addroute()

◆ squid_rn_delete()

◆ squid_rn_init()

void squid_rn_init ( void  )

Definition at line 883 of file radix.c.

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

Referenced by asnInit().

◆ squid_rn_inithead()

◆ squid_rn_insert()

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

◆ squid_rn_lookup()

struct squid_radix_node * squid_rn_lookup ( void *  v_arg,
void *  m_arg,
struct squid_radix_node_head head 
)

Definition at line 206 of file radix.c.

References head, NULL, squid_rn_addmask(), and squid_rn_match().

Referenced by asnAddNet(), and squid_rn_inithead().

◆ squid_rn_match()

◆ squid_rn_newpair()

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

◆ squid_rn_refines()

int squid_rn_refines ( void *  m_arg,
void *  n_arg 
)

Definition at line 180 of file radix.c.

References int.

Referenced by squid_rn_addroute().

◆ squid_rn_search()

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

Definition at line 151 of file radix.c.

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

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

◆ squid_rn_search_m()

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

Definition at line 165 of file radix.c.

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

Referenced by squid_rn_match().

◆ squid_rn_walktree()

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

Variable Documentation

◆ addmask_key

char* addmask_key
static

Definition at line 87 of file radix.c.

Referenced by squid_rn_addmask(), and squid_rn_init().

◆ normal_chars

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().

◆ rn_ones

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().

◆ rn_zeros

char* rn_zeros
static

Definition at line 89 of file radix.c.

Referenced by squid_rn_init(), and squid_rn_inithead().

◆ squid_mask_rnhead

struct squid_radix_node_head* squid_mask_rnhead

Definition at line 86 of file radix.c.

Referenced by squid_rn_addmask(), and squid_rn_init().

◆ squid_max_keylen

int squid_max_keylen

Definition at line 84 of file radix.c.

Referenced by squid_rn_addmask(), and squid_rn_init().

◆ squid_rn_mkfreelist

struct squid_radix_mask* squid_rn_mkfreelist

Definition at line 85 of file radix.c.

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors