Fixed header file layout
[m6w6/libmemcached] / libmemcached / memcached_types.h
1 /*
2 * Summary: Typpes for libmemcached
3 *
4 * Copy: See Copyright for the status of this software.
5 *
6 * Author: Brian Aker
7 */
8
9 #ifndef LIBMEMCACHED_MEMCACHED_TYPES_H
10 #define LIBMEMCACHED_MEMCACHED_TYPES_H
11
12 #ifndef LIBMEMCACHED_MEMCACHED_H
13 #error "Please include <libmemcached/memcached.h> instead"
14 #endif
15
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19
20 typedef struct memcached_st memcached_st;
21 typedef struct memcached_stat_st memcached_stat_st;
22 typedef struct memcached_analysis_st memcached_analysis_st;
23 typedef struct memcached_result_st memcached_result_st;
24 typedef struct memcached_string_st memcached_string_st;
25 typedef struct memcached_server_st memcached_server_st;
26 typedef struct memcached_continuum_item_st memcached_continuum_item_st;
27 typedef memcached_return (*memcached_clone_func)(memcached_st *parent, memcached_st *clone);
28 typedef memcached_return (*memcached_cleanup_func)(memcached_st *ptr);
29 typedef void (*memcached_free_function)(memcached_st *ptr, void *mem);
30 typedef void *(*memcached_malloc_function)(memcached_st *ptr, const size_t size);
31 typedef void *(*memcached_realloc_function)(memcached_st *ptr, void *mem, const size_t size);
32 typedef void *(*memcached_calloc_function)(memcached_st *ptr, size_t nelem, const size_t elsize);
33 typedef memcached_return (*memcached_execute_function)(memcached_st *ptr, memcached_result_st *result, void *context);
34 typedef memcached_return (*memcached_server_function)(memcached_st *ptr, memcached_server_st *server, void *context);
35 typedef memcached_return (*memcached_trigger_key)(memcached_st *ptr,
36 const char *key, size_t key_length,
37 memcached_result_st *result);
38 typedef memcached_return (*memcached_trigger_delete_key)(memcached_st *ptr,
39 const char *key, size_t key_length);
40
41 typedef memcached_return (*memcached_dump_func)(memcached_st *ptr,
42 const char *key, size_t key_length, void *context);
43
44 struct memcached_string_st {
45 memcached_st *root;
46 char *end;
47 char *string;
48 size_t current_size;
49 size_t block_size;
50 bool is_allocated;
51 };
52
53 struct memcached_result_st {
54 uint32_t flags;
55 bool is_allocated;
56 time_t expiration;
57 memcached_st *root;
58 size_t key_length;
59 uint64_t cas;
60 memcached_string_st value;
61 char key[MEMCACHED_MAX_KEY];
62 /* Add result callback function */
63 };
64
65 struct memcached_st {
66 uint8_t purging;
67 bool is_allocated;
68 uint8_t distribution;
69 uint8_t hash;
70 uint32_t continuum_points_counter;
71 memcached_server_st *hosts;
72 int32_t snd_timeout;
73 int32_t rcv_timeout;
74 uint32_t server_failure_limit;
75 uint32_t io_msg_watermark;
76 uint32_t io_bytes_watermark;
77 uint32_t io_key_prefetch;
78 uint32_t number_of_hosts;
79 uint32_t cursor_server;
80 int cached_errno;
81 uint32_t flags;
82 int32_t poll_timeout;
83 int32_t connect_timeout;
84 int32_t retry_timeout;
85 uint32_t continuum_count;
86 int send_size;
87 int recv_size;
88 void *user_data;
89 time_t next_distribution_rebuild;
90 size_t prefix_key_length;
91 memcached_hash hash_continuum;
92 memcached_result_st result;
93 memcached_continuum_item_st *continuum;
94 memcached_clone_func on_clone;
95 memcached_cleanup_func on_cleanup;
96 memcached_free_function call_free;
97 memcached_malloc_function call_malloc;
98 memcached_realloc_function call_realloc;
99 memcached_calloc_function call_calloc;
100 memcached_trigger_key get_key_failure;
101 memcached_trigger_delete_key delete_trigger;
102 char prefix_key[MEMCACHED_PREFIX_KEY_MAX_SIZE];
103 uint32_t number_of_replicas;
104 };
105
106 #ifdef __cplusplus
107 }
108 #endif
109
110 #endif /* LIBMEMCACHED_MEMCACHED_TYPES_H */