Packages
fast_tls
1.0.15
1.1.26
1.1.25
1.1.24
1.1.22
1.1.21
1.1.20
1.1.19
1.1.18
1.1.16
1.1.15
1.1.14
1.1.13
1.1.12
1.1.11
1.1.10
1.1.8
1.1.7
1.1.6
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.26
1.0.25
1.0.23
1.0.22
1.0.21
1.0.20
1.0.19
1.0.18
1.0.16
1.0.15
1.0.13
1.0.12
1.0.11
1.0.10
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
1.0.0-beta1
TLS / SSL OpenSSL-based native driver for Erlang / Elixir
Current section
Files
Jump to
Current section
Files
c_src/hashmap.h
#ifndef HASHMAP_H
#define HASHMAP_H
#include <erl_nif.h>
#include <sys/types.h>
#include <stdint.h>
typedef uint32_t (*hashmap_hash_fun_t)(const void *el);
typedef int (*hashmap_cmp_fun_t)(const void *el1, const void *el2);
typedef struct hashmap_element {
uint32_t hash;
uint32_t used;
char data[0];
} hashmap_element_t;
typedef struct hashmap {
int capacity;
int size;
int data_size;
hashmap_hash_fun_t hash_fun;
hashmap_cmp_fun_t cmp_fun;
void *data;
ErlNifRWLock *lock;
} hashmap_t;
hashmap_t *hashmap_new(int initial_size, int data_size, hashmap_hash_fun_t hash_fun, hashmap_cmp_fun_t cmp_fun);
void hashmap_free(hashmap_t *map);
int hashmap_insert(hashmap_t *map, const void *data, void *old_data);
int hashmap_remove(hashmap_t *map, const void *data, void *old_data);
void *hashmap_lookup(hashmap_t *map, const void *data);
int hashmap_insert_no_lock(hashmap_t *map, const void *data, void *old_data);
int hashmap_remove_no_lock(hashmap_t *map, const void *data, void *old_data);
void *hashmap_lookup_no_lock(hashmap_t *map, const void *data);
void hashmap_lock(hashmap_t *map, int RWlock);
void hashmap_unlock(hashmap_t *map, int RWlock);
#endif