hashmap.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * hashmap.h
  3. *
  4. * Created on: 2019�~4��27��
  5. * Author: foluswen
  6. */
  7. #ifndef HASHMAP_H_
  8. #define HASHMAP_H_
  9. #define KEY_COUNT (1024*1024)
  10. #define KEY_MAX_LENGTH (37)
  11. #define VALUE_MAX_LENGTH (65)
  12. #define MAP_MISSING -3 /* No such element */
  13. #define MAP_FULL -2 /* Hashmap is full */
  14. #define MAP_OMEM -1 /* Out of Memory */
  15. #define MAP_OK 0 /* OK */
  16. typedef struct data_struct_s
  17. {
  18. char key_string[KEY_MAX_LENGTH];
  19. char key_value[VALUE_MAX_LENGTH];
  20. } data_struct_t;
  21. /*
  22. * any_t is a pointer. This allows you to put arbitrary structures in
  23. * the hashmap.
  24. */
  25. typedef void *any_t;
  26. //typedef void any_t;
  27. /*
  28. * PFany is a pointer to a function that can take two any_t arguments
  29. * and return an integer. Returns status code..
  30. */
  31. typedef int (*PFany)(any_t, any_t);
  32. /*
  33. * map_t is a pointer to an internally maintained data structure.
  34. * Clients of this package do not need to know how hashmaps are
  35. * represented. They see and manipulate only map_t's.
  36. */
  37. typedef any_t map_t;
  38. extern int MessageSent_add(char *uuid, char *data);
  39. extern int MessageSent_get(char *uuid, char *data);
  40. extern int MessageSent_remove(char *uuid, char *data);
  41. extern int hashmap_operation(int type, char *uuid, char *data);
  42. #endif /* HASHMAP_H_ */