2
* Summary: Chained hash tables and domain/connections handling
3
* Description: This module implements the hash table and allocation and
4
* deallocation of domains and connections
6
* Copy: Copyright (C) 2005 Red Hat, Inc.
8
* Author: Bjorn Reese <bjorn.reese@systematic.dk>
9
* Daniel Veillard <veillard@redhat.com>
12
#ifndef __VIR_HASH_H__
13
#define __VIR_HASH_H__
18
typedef struct _virHashTable virHashTable;
19
typedef virHashTable *virHashTablePtr;
27
* @payload: the data in the hash
28
* @name: the name associated
30
* Callback to free data from a hash.
32
typedef void (*virHashDeallocator) (void *payload, const char *name);
35
* @payload: the data in the hash
36
* @name: the name associated
37
* @data: user supplied data blob
39
* Callback to process a hash entry during iteration
41
typedef void (*virHashIterator) (const void *payload, const char *name, const void *data);
44
* @payload: the data in the hash
45
* @name: the name associated
46
* @data: user supplied data blob
48
* Callback to identify hash entry desired
49
* Returns 1 if the hash entry is desired, 0 to move
52
typedef int (*virHashSearcher) (const void *payload, const char *name, const void *data);
55
* Constructor and destructor.
57
virHashTablePtr virHashCreate(int size);
58
void virHashFree(virHashTablePtr table, virHashDeallocator f);
59
int virHashSize(virHashTablePtr table);
62
* Add a new entry to the hash table.
64
int virHashAddEntry(virHashTablePtr table,
65
const char *name, void *userdata);
66
int virHashUpdateEntry(virHashTablePtr table,
68
void *userdata, virHashDeallocator f);
71
* Remove an entry from the hash table.
73
int virHashRemoveEntry(virHashTablePtr table,
74
const char *name, virHashDeallocator f);
77
* Retrieve the userdata.
79
void *virHashLookup(virHashTablePtr table, const char *name);
85
int virHashForEach(virHashTablePtr table, virHashIterator iter, const void *data);
86
int virHashRemoveSet(virHashTablePtr table, virHashSearcher iter, virHashDeallocator f, const void *data);
87
void *virHashSearch(virHashTablePtr table, virHashSearcher iter, const void *data);
89
#endif /* ! __VIR_HASH_H__ */