/* * hashmap.h * * Created on: 2019�~4��27�� * Author: foluswen */ #ifndef HASHMAP_H_ #define HASHMAP_H_ #define KEY_COUNT (1024*1024) #define KEY_MAX_LENGTH (37) #define VALUE_MAX_LENGTH (65) #define MAP_MISSING -3 /* No such element */ #define MAP_FULL -2 /* Hashmap is full */ #define MAP_OMEM -1 /* Out of Memory */ #define MAP_OK 0 /* OK */ typedef struct data_struct_s { char key_string[KEY_MAX_LENGTH]; char key_value[VALUE_MAX_LENGTH]; } data_struct_t; /* * any_t is a pointer. This allows you to put arbitrary structures in * the hashmap. */ typedef void *any_t; //typedef void any_t; /* * PFany is a pointer to a function that can take two any_t arguments * and return an integer. Returns status code.. */ typedef int (*PFany)(any_t, any_t); /* * map_t is a pointer to an internally maintained data structure. * Clients of this package do not need to know how hashmaps are * represented. They see and manipulate only map_t's. */ typedef any_t map_t; extern int MessageSent_add(char *uuid, char *data); extern int MessageSent_get(char *uuid, char *data); extern int MessageSent_remove(char *uuid, char *data); extern int hashmap_operation(int type, char *uuid, char *data); #endif /* HASHMAP_H_ */