00001 #ifndef _LIBDICTIONRY_H_ 00002 #define _LIBDICTIONRY_H_ 00003 00004 #include <pthread.h> 00005 00006 #define KEY_EXISTS 1 00007 #define NO_KEY_EXISTS 2 00008 00009 00010 typedef struct _dictionary_entry_t 00011 { 00012 const char *key, *value; 00013 } dictionary_entry_t; 00014 00015 typedef struct _dictioanry_t 00016 { 00017 void *root; 00018 pthread_mutex_t mutex; 00019 } dictionary_t; 00020 00021 00022 void dictionary_init(dictionary_t *d); 00023 00024 int dictionary_add(dictionary_t *d, const char *key, const char *value); 00025 00026 const char *dictionary_get(dictionary_t *d, const char *key); 00027 00028 int dictionary_remove(dictionary_t *d, const char *key); 00029 int dictionary_remove_free(dictionary_t *d, const char *key); 00030 00031 void dictionary_destroy(dictionary_t *d); 00032 void dictionary_destroy_free(dictionary_t *d); 00033 00034 00035 #endif