hashtb.c File Reference

Hash table. More...

Go to the source code of this file.

Defines

#define DATA(ht, p)   ((void *)((p) + 1))
#define KEY(ht, p)   ((unsigned char *)((p) + 1) + ht->item_size)
#define CHECKHTE(ht, hte)   ((uintptr_t)((hte)->priv[1]) == ~(uintptr_t)(ht))
#define MARKHTE(ht, hte)   ((hte)->priv[1] = (void*)~(uintptr_t)(ht))
#define MAX_ENUMERATORS   30

Functions

size_t hashtb_hash (const unsigned char *key, size_t key_size)
struct hashtb * hashtb_create (size_t item_size, const struct hashtb_param *param)
void * hashtb_get_param (struct hashtb *ht, struct hashtb_param *param)
void hashtb_destroy (struct hashtb **htp)
int hashtb_n (struct hashtb *ht)
void * hashtb_lookup (struct hashtb *ht, const void *key, size_t keysize)
static void setpos (struct hashtb_enumerator *hte, struct node **pp)
static struct node ** scan_buckets (struct hashtb *ht, unsigned b)
struct hashtb_enumeratorhashtb_start (struct hashtb *ht, struct hashtb_enumerator *hte)
void hashtb_end (struct hashtb_enumerator *hte)
void hashtb_next (struct hashtb_enumerator *hte)
int hashtb_seek (struct hashtb_enumerator *hte, const void *key, size_t keysize, size_t extsize)
void hashtb_delete (struct hashtb_enumerator *hte)
void hashtb_rehash (struct hashtb *ht, unsigned n_buckets)


Detailed Description

Hash table.

Part of the CCNx C Library.

Copyright (C) 2009 Palo Alto Research Center, Inc.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Definition in file hashtb.c.


Define Documentation

#define CHECKHTE ( ht,
hte   )     ((uintptr_t)((hte)->priv[1]) == ~(uintptr_t)(ht))

Definition at line 38 of file hashtb.c.

Referenced by hashtb_delete(), and hashtb_end().

#define DATA ( ht,
 )     ((void *)((p) + 1))

Definition at line 35 of file hashtb.c.

Referenced by hashtb_lookup(), and setpos().

#define KEY ( ht,
 )     ((unsigned char *)((p) + 1) + ht->item_size)

Definition at line 36 of file hashtb.c.

Referenced by hashtb_delete(), hashtb_lookup(), hashtb_seek(), and setpos().

#define MARKHTE ( ht,
hte   )     ((hte)->priv[1] = (void*)~(uintptr_t)(ht))

Definition at line 39 of file hashtb.c.

Referenced by hashtb_start().

#define MAX_ENUMERATORS   30

Definition at line 164 of file hashtb.c.

Referenced by hashtb_start().


Function Documentation

struct hashtb* hashtb_create ( size_t  item_size,
const struct hashtb_param param 
) [read]

void hashtb_delete ( struct hashtb_enumerator hte  ) 

void hashtb_destroy ( struct hashtb **  htp  ) 

Definition at line 90 of file hashtb.c.

Referenced by ccn_btree_destroy(), ccn_destroy(), ccnd_destroy(), main(), and r_init_destroy().

void hashtb_end ( struct hashtb_enumerator hte  ) 

void* hashtb_get_param ( struct hashtb *  ht,
struct hashtb_param param 
)

size_t hashtb_hash ( const unsigned char *  key,
size_t  key_size 
)

Definition at line 52 of file hashtb.c.

Referenced by hashtb_lookup(), and hashtb_seek().

void* hashtb_lookup ( struct hashtb *  ht,
const void *  key,
size_t  keysize 
)

int hashtb_n ( struct hashtb *  ht  ) 

void hashtb_next ( struct hashtb_enumerator hte  ) 

void hashtb_rehash ( struct hashtb *  ht,
unsigned  n_buckets 
)

Definition at line 286 of file hashtb.c.

Referenced by hashtb_seek().

int hashtb_seek ( struct hashtb_enumerator hte,
const void *  key,
size_t  keysize,
size_t  extsize 
)

struct hashtb_enumerator* hashtb_start ( struct hashtb *  ht,
struct hashtb_enumerator hte 
) [read]

static struct node** scan_buckets ( struct hashtb *  ht,
unsigned  b 
) [static, read]

Definition at line 156 of file hashtb.c.

Referenced by hashtb_delete(), hashtb_next(), and hashtb_start().

static void setpos ( struct hashtb_enumerator hte,
struct node **  pp 
) [static]

Definition at line 134 of file hashtb.c.

Referenced by hashtb_delete(), hashtb_end(), hashtb_next(), hashtb_seek(), and hashtb_start().


Generated on Thu Feb 16 00:44:24 2012 for Content-Centric Networking in C by  doxygen 1.5.6