netatalk 4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
etc/afpd/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 HASH_H
21#define HASH_H
22
23#include <limits.h>
24
25#include <atalk/hash.h>
26
27 extern hash_t *hash_create(hashcount_t, hash_comp_t, hash_fun_t);
28 extern void hash_set_allocator(hash_t *, hnode_alloc_t, hnode_free_t, void *);
29 extern void hash_destroy(hash_t *);
30 extern void hash_free_nodes(hash_t *);
31 extern void hash_free(hash_t *);
32 extern hash_t *hash_init(hash_t *, hashcount_t, hash_comp_t,
33 hash_fun_t, hnode_t **, hashcount_t);
34 extern void hash_insert(hash_t *, hnode_t *, const void *);
35 extern hnode_t *hash_lookup(hash_t *, const void *);
36 extern hnode_t *hash_delete(hash_t *, hnode_t *);
37 extern int hash_alloc_insert(hash_t *, const void *, void *);
38 extern void hash_delete_free(hash_t *, hnode_t *);
39
40 extern void hnode_put(hnode_t *, void *);
41 extern void *hnode_get(hnode_t *);
42 extern const void *hnode_getkey(hnode_t *);
43 extern hashcount_t hash_count(hash_t *);
44 extern hashcount_t hash_size(hash_t *);
45
46 extern int hash_isfull(hash_t *);
47 extern int hash_isempty(hash_t *);
48
49 extern void hash_scan_begin(hscan_t *, hash_t *);
50 extern hnode_t *hash_scan_next(hscan_t *);
51 extern hnode_t *hash_scan_delete(hash_t *, hnode_t *);
52 extern void hash_scan_delfree(hash_t *, hnode_t *);
53
54 extern int hash_verify(hash_t *);
55
56 extern hnode_t *hnode_create(void *);
57 extern hnode_t *hnode_init(hnode_t *, void *);
58 extern void hnode_destroy(hnode_t *);
59
60#if defined(HASH_IMPLEMENTATION) || !defined(KAZLIB_OPAQUE_DEBUG)
61#ifdef KAZLIB_SIDEEFFECT_DEBUG
62#define hash_isfull(H) (SFX_CHECK(H)->hash_nodecount == (H)->hash_maxcount)
63#else
64#define hash_isfull(H) ((H)->hash_nodecount == (H)->hash_maxcount)
65#endif
66#define hash_isempty(H) ((H)->hash_nodecount == 0)
67#define hash_count(H) ((H)->hash_nodecount)
68#define hash_size(H) ((H)->hash_nchains)
69#define hnode_get(N) ((N)->hash_data)
70#define hnode_getkey(N) ((N)->hash_key)
71#define hnode_put(N, V) ((N)->hash_data = (V))
72#endif
73
74#endif
hash_insert
void hash_insert(hash_t *, hnode_t *, const void *)
Insert a node into the hash table.
Definition hash.c:513
hash_set_allocator
void hash_set_allocator(hash_t *, hnode_alloc_t, hnode_free_t, void *)
Definition hash.c:359
hnode_getkey
#define hnode_getkey(N)
Definition etc/afpd/hash.h:70
hash_scan_delfree
void hash_scan_delfree(hash_t *, hnode_t *)
Definition hash.c:681
hash_delete_free
void hash_delete_free(hash_t *, hnode_t *)
Definition hash.c:643
hash_verify
int hash_verify(hash_t *)
Verify whether the given object is a valid hash table.
Definition hash.c:696
hnode_get
#define hnode_get(N)
Definition etc/afpd/hash.h:69
hash_alloc_insert
int hash_alloc_insert(hash_t *, const void *, void *)
Definition hash.c:630
hash_init
hash_t * hash_init(hash_t *, hashcount_t, hash_comp_t, hash_fun_t, hnode_t **, hashcount_t)
hash_free_nodes
void hash_free_nodes(hash_t *)
Definition hash.c:373
hnode_put
#define hnode_put(N, V)
Definition etc/afpd/hash.h:71
hash_scan_delete
hnode_t * hash_scan_delete(hash_t *, hnode_t *)
Definition hash.c:653
hash_create
hash_t * hash_create(hashcount_t, hash_comp_t, hash_fun_t)
Create a dynamic hash table.
Definition hash.c:310
hash_lookup
hnode_t * hash_lookup(hash_t *, const void *)
Find a node in the hash table and return a pointer to it.
Definition hash.c:554
hnode_create
hnode_t * hnode_create(void *)
hnode_init
hnode_t * hnode_init(hnode_t *, void *)
Definition hash.c:747
hnode_destroy
void hnode_destroy(hnode_t *)
hash_delete
hnode_t * hash_delete(hash_t *, hnode_t *)
Delete the given node from the hash table. Since the chains are singly linked, we must locate the sta...
Definition hash.c:591
hash_isfull
#define hash_isfull(H)
Definition etc/afpd/hash.h:64
hash_isempty
#define hash_isempty(H)
Definition etc/afpd/hash.h:66
hash_destroy
void hash_destroy(hash_t *)
Definition hash.c:391
hash_scan_next
hnode_t * hash_scan_next(hscan_t *)
Retrieve the next node from the hash table, and update the pointer for the next invocation of hash_sc...
Definition hash.c:457
hash_scan_begin
void hash_scan_begin(hscan_t *, hash_t *)
Initialize a hash scanner.
Definition hash.c:412
hash_size
#define hash_size(H)
Definition etc/afpd/hash.h:68
hash_count
#define hash_count(H)
Definition etc/afpd/hash.h:67
hash_free
void hash_free(hash_t *)
hash.h
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
hashcount_t
unsigned long hashcount_t
Definition include/atalk/hash.h:26
hash_t
Definition include/atalk/hash.h:139
hnode_t
Hash chain node structure.
Definition include/atalk/hash.h:63
hscan_t
Definition include/atalk/hash.h:169