Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
radsecproxy/hash.h
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
44 lines (33 sloc)
1.13 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Copyright (c) 2008, UNINETT AS */ | |
/* See LICENSE for licensing information. */ | |
#ifndef SYS_SOLARIS9 | |
#include <stdint.h> | |
#endif | |
#include <pthread.h> | |
struct hash { | |
struct list *hashlist; | |
pthread_mutex_t mutex; | |
}; | |
struct hash_entry { | |
void *key; | |
uint32_t keylen; | |
void *data; | |
struct list_node *next; /* used when walking through hash */ | |
}; | |
/* allocates and initialises hash structure; returns NULL if malloc fails */ | |
struct hash *hash_create(); | |
/* frees all memory associated with the hash */ | |
void hash_destroy(struct hash *hash); | |
/* insert entry in hash; returns 1 if ok, 0 if malloc fails */ | |
int hash_insert(struct hash *hash, void *key, uint32_t keylen, void *data); | |
/* reads entry from hash */ | |
void *hash_read(struct hash *hash, void *key, uint32_t keylen); | |
/* extracts (read and remove) entry from hash */ | |
void *hash_extract(struct hash *hash, void *key, uint32_t keylen); | |
/* returns first entry */ | |
struct hash_entry *hash_first(struct hash *hash); | |
/* returns the next entry after the argument */ | |
struct hash_entry *hash_next(struct hash_entry *entry); | |
/* Local Variables: */ | |
/* c-file-style: "stroustrup" */ | |
/* End: */ |