netatalk: hash.h Source File

netatalk 4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
include/atalk/hash.h
Go to the documentation of this file.
1/*
2 * Hash Table Data Type
3 * Copyright (C) 1997 Kaz Kylheku <kaz@ashi.footprints.net>
4 *
5 * Free Software License:
6 *
7 * All rights are reserved by the author, with the following exceptions:
8 * Permission is granted to freely reproduce and distribute this software,
9 * possibly in exchange for a fee, provided that this copyright notice appears
10 * intact. Permission is also granted to adapt this software to produce
11 * derivative works, as long as the modified versions carry this copyright
12 * notice and additional notices stating that the work has been modified.
13 * This source code may be translated into executable form and incorporated
14 * into proprietary software; there is no requirement for such software to
15 * contain a copyright notice related to this source.
16 *
17 * $Name: $
18 */
19
20#ifndef ATALK_HASH_H
21#define ATALK_HASH_H
22
23#include <limits.h>
24#include <stdint.h>
25
26 typedef unsigned long hashcount_t;
27#define HASHCOUNT_T_MAX ULONG_MAX
28
29 typedef uint32_t hash_val_t;
30#define HASH_VAL_T_MAX UINT32_MAX
31
32extern int hash_val_t_bit;
33
34#ifndef HASH_VAL_T_BIT
35#define HASH_VAL_T_BIT ((int) hash_val_t_bit)
36#endif
37
62
63 typedef struct hnode_t {
64#if defined(HASH_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG) /* 1 */
65 struct hnode_t *hash_next; /* 2 */
66 const void *hash_key; /* 3 */
67 void *hash_data; /* 4 */
68 hash_val_t hash_hkey; /* 5 */
69#else
70 int hash_dummy;
71#endif
72} hnode_t;
73
80
81 typedef int (*hash_comp_t)(const void *, const void *);
82
94
95 typedef hash_val_t (*hash_fun_t)(const void *);
96
97/*
98 * allocator functions
99 */
100
101 typedef hnode_t *(*hnode_alloc_t)(void *);
102 typedef void (*hnode_free_t)(hnode_t *, void *);
103
138
139 typedef struct hash_t {
140#if defined(HASH_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG)
141 struct hnode_t **hash_table;
142 hashcount_t hash_nchains;
143 hashcount_t hash_nodecount;
144 hashcount_t hash_maxcount;
145 hashcount_t hash_highmark;
146 hashcount_t hash_lowmark;
147 hash_comp_t hash_compare;
148 hash_fun_t hash_function;
149 hnode_alloc_t hash_allocnode;
150 hnode_free_t hash_freenode;
151 void *hash_context;
152 hash_val_t hash_mask;
153 int hash_dynamic;
154#else
155 int hash_dummy;
156#endif
157} hash_t;
158
168
169 typedef struct hscan_t {
170#if defined(HASH_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG)
171 hash_t *hash_table; /* 1 */
172 hash_val_t hash_chain; /* 2 */
173 hnode_t *hash_next; /* 3 */
174#else
175 int hash_dummy;
176#endif
177} hscan_t;
178
179
180#endif /* ATALK_HASH_H */
hash_val_t_bit
int hash_val_t_bit
Definition hash.c:63
hash_fun_t
hash_val_t(* hash_fun_t)(const void *)
Definition include/atalk/hash.h:95
hash_comp_t
int(* hash_comp_t)(const void *, const void *)
Definition include/atalk/hash.h:81
hnode_free_t
void(* hnode_free_t)(hnode_t *, void *)
Definition include/atalk/hash.h:102
hnode_alloc_t
hnode_t *(* hnode_alloc_t)(void *)
Definition include/atalk/hash.h:101
hash_val_t
uint32_t hash_val_t
Definition include/atalk/hash.h:29
hashcount_t
unsigned long hashcount_t
Definition include/atalk/hash.h:26
hash_t
Definition include/atalk/hash.h:139
hash_t::hash_nodecount
hashcount_t hash_nodecount
Definition include/atalk/hash.h:143
hash_t::hash_mask
hash_val_t hash_mask
Definition include/atalk/hash.h:152
hash_t::hash_maxcount
hashcount_t hash_maxcount
Definition include/atalk/hash.h:144
hash_t::hash_allocnode
hnode_alloc_t hash_allocnode
Definition include/atalk/hash.h:149
hash_t::hash_context
void * hash_context
Definition include/atalk/hash.h:151
hash_t::hash_highmark
hashcount_t hash_highmark
Definition include/atalk/hash.h:145
hash_t::hash_dynamic
int hash_dynamic
Definition include/atalk/hash.h:153
hash_t::hash_nchains
hashcount_t hash_nchains
Definition include/atalk/hash.h:142
hash_t::hash_table
struct hnode_t ** hash_table
Definition include/atalk/hash.h:141
hash_t::hash_lowmark
hashcount_t hash_lowmark
Definition include/atalk/hash.h:146
hash_t::hash_function
hash_fun_t hash_function
Definition include/atalk/hash.h:148
hash_t::hash_compare
hash_comp_t hash_compare
Definition include/atalk/hash.h:147
hash_t::hash_freenode
hnode_free_t hash_freenode
Definition include/atalk/hash.h:150
hnode_t
Hash chain node structure.
Definition include/atalk/hash.h:63
hnode_t::hash_next
struct hnode_t * hash_next
Definition include/atalk/hash.h:65
hnode_t::hash_hkey
hash_val_t hash_hkey
Definition include/atalk/hash.h:68
hnode_t::hash_key
const void * hash_key
Definition include/atalk/hash.h:66
hnode_t::hash_data
void * hash_data
Definition include/atalk/hash.h:67
hscan_t
Definition include/atalk/hash.h:169
hscan_t::hash_table
hash_t * hash_table
Definition include/atalk/hash.h:171
hscan_t::hash_next
hnode_t * hash_next
Definition include/atalk/hash.h:173
hscan_t::hash_chain
hash_val_t hash_chain
Definition include/atalk/hash.h:172