65192bfbbc67f1471751e434dd82c51702059a18
[awesomized/libmemcached] / libmemcached / memcached_constants.h
1 /*
2 * Summary: Constants for libmemcached
3 *
4 * Copy: See Copyright for the status of this software.
5 *
6 * Author: Brian Aker
7 */
8
9 #ifndef __MEMCACHED_CONSTANTS_H__
10 #define __MEMCACHED_CONSTANTS_H__
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16 /* Public defines */
17 #define MEMCACHED_DEFAULT_PORT 11211
18 #define MEMCACHED_MAX_KEY 251 /* We add one to have it null terminated */
19 #define MEMCACHED_MAX_BUFFER 8196
20 #define MEMCACHED_MAX_HOST_LENGTH 64
21 #define MEMCACHED_WHEEL_SIZE 1024
22 #define MEMCACHED_STRIDE 4
23 #define MEMCACHED_DEFAULT_TIMEOUT INT32_MAX
24
25 typedef enum {
26 MEMCACHED_SUCCESS,
27 MEMCACHED_FAILURE,
28 MEMCACHED_HOST_LOOKUP_FAILURE,
29 MEMCACHED_CONNECTION_FAILURE,
30 MEMCACHED_CONNECTION_BIND_FAILURE,
31 MEMCACHED_WRITE_FAILURE,
32 MEMCACHED_READ_FAILURE,
33 MEMCACHED_UNKNOWN_READ_FAILURE,
34 MEMCACHED_PROTOCOL_ERROR,
35 MEMCACHED_CLIENT_ERROR,
36 MEMCACHED_SERVER_ERROR,
37 MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE,
38 MEMCACHED_DATA_EXISTS,
39 MEMCACHED_DATA_DOES_NOT_EXIST,
40 MEMCACHED_NOTSTORED,
41 MEMCACHED_STORED,
42 MEMCACHED_NOTFOUND,
43 MEMCACHED_MEMORY_ALLOCATION_FAILURE,
44 MEMCACHED_PARTIAL_READ,
45 MEMCACHED_SOME_ERRORS,
46 MEMCACHED_NO_SERVERS,
47 MEMCACHED_END,
48 MEMCACHED_DELETED,
49 MEMCACHED_VALUE,
50 MEMCACHED_STAT,
51 MEMCACHED_ERRNO,
52 MEMCACHED_FAIL_UNIX_SOCKET,
53 MEMCACHED_NOT_SUPPORTED,
54 MEMCACHED_NO_KEY_PROVIDED,
55 MEMCACHED_FETCH_NOTFINISHED,
56 MEMCACHED_TIMEOUT,
57 MEMCACHED_BUFFERED,
58 MEMCACHED_BAD_KEY_PROVIDED,
59 MEMCACHED_MAXIMUM_RETURN, /* Always add new error code before */
60 } memcached_return;
61
62 typedef enum {
63 MEMCACHED_DISTRIBUTION_MODULA,
64 MEMCACHED_DISTRIBUTION_CONSISTENT,
65 } memcached_server_distribution;
66
67 typedef enum {
68 MEMCACHED_BEHAVIOR_NO_BLOCK,
69 MEMCACHED_BEHAVIOR_TCP_NODELAY,
70 MEMCACHED_BEHAVIOR_HASH,
71 MEMCACHED_BEHAVIOR_KETAMA,
72 MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE,
73 MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE,
74 MEMCACHED_BEHAVIOR_CACHE_LOOKUPS,
75 MEMCACHED_BEHAVIOR_SUPPORT_CAS,
76 MEMCACHED_BEHAVIOR_POLL_TIMEOUT,
77 MEMCACHED_BEHAVIOR_DISTRIBUTION,
78 MEMCACHED_BEHAVIOR_BUFFER_REQUESTS,
79 MEMCACHED_BEHAVIOR_USER_DATA,
80 MEMCACHED_BEHAVIOR_SORT_HOSTS,
81 MEMCACHED_BEHAVIOR_VERIFY_KEY,
82 MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT,
83 MEMCACHED_BEHAVIOR_RETRY_TIMEOUT,
84 } memcached_behavior;
85
86 typedef enum {
87 MEMCACHED_CALLBACK_USER_DATA,
88 MEMCACHED_CALLBACK_CLEANUP_FUNCTION,
89 MEMCACHED_CALLBACK_CLONE_FUNCTION,
90 MEMCACHED_CALLBACK_MALLOC_FUNCTION,
91 MEMCACHED_CALLBACK_REALLOC_FUNCTION,
92 MEMCACHED_CALLBACK_FREE_FUNCTION,
93 } memcached_callback;
94
95 typedef enum {
96 MEMCACHED_HASH_DEFAULT= 0,
97 MEMCACHED_HASH_MD5,
98 MEMCACHED_HASH_CRC,
99 MEMCACHED_HASH_FNV1_64,
100 MEMCACHED_HASH_FNV1A_64,
101 MEMCACHED_HASH_FNV1_32,
102 MEMCACHED_HASH_FNV1A_32,
103 MEMCACHED_HASH_KETAMA,
104 MEMCACHED_HASH_HSIEH,
105 MEMCACHED_HASH_MURMUR,
106 } memcached_hash;
107
108 typedef enum {
109 MEMCACHED_CONNECTION_UNKNOWN,
110 MEMCACHED_CONNECTION_TCP,
111 MEMCACHED_CONNECTION_UDP,
112 MEMCACHED_CONNECTION_UNIX_SOCKET,
113 } memcached_connection;
114
115 typedef enum {
116 MEMCACHED_NOT_ALLOCATED,
117 MEMCACHED_ALLOCATED,
118 MEMCACHED_USED,
119 } memcached_allocated;
120
121
122 #ifdef __cplusplus
123 }
124 #endif
125
126 #endif /* __MEMCACHED_CONSTANTS_H__ */