52
* Definition of the legal "magic" values used in a packet.
53
* See section 3.1 Magic byte
56
PROTOCOL_BINARY_REQ = 0x80,
57
PROTOCOL_BINARY_RES = 0x81
58
} protocol_binary_magic;
61
* Definition of the valid response status numbers.
62
* See section 3.2 Response Status
65
PROTOCOL_BINARY_RESPONSE_SUCCESS = 0x00,
66
PROTOCOL_BINARY_RESPONSE_KEY_ENOENT = 0x01,
67
PROTOCOL_BINARY_RESPONSE_KEY_EEXISTS = 0x02,
68
PROTOCOL_BINARY_RESPONSE_E2BIG = 0x03,
69
PROTOCOL_BINARY_RESPONSE_EINVAL = 0x04,
70
PROTOCOL_BINARY_RESPONSE_NOT_STORED = 0x05,
71
PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND = 0x81,
72
PROTOCOL_BINARY_RESPONSE_ENOMEM = 0x82
73
} protocol_binary_response_status;
76
* Defintion of the different command opcodes.
77
* See section 3.3 Command Opcodes
80
PROTOCOL_BINARY_CMD_GET = 0x00,
81
PROTOCOL_BINARY_CMD_SET = 0x01,
82
PROTOCOL_BINARY_CMD_ADD = 0x02,
83
PROTOCOL_BINARY_CMD_REPLACE = 0x03,
84
PROTOCOL_BINARY_CMD_DELETE = 0x04,
85
PROTOCOL_BINARY_CMD_INCREMENT = 0x05,
86
PROTOCOL_BINARY_CMD_DECREMENT = 0x06,
87
PROTOCOL_BINARY_CMD_QUIT = 0x07,
88
PROTOCOL_BINARY_CMD_FLUSH = 0x08,
89
PROTOCOL_BINARY_CMD_GETQ = 0x09,
90
PROTOCOL_BINARY_CMD_NOOP = 0x0a,
91
PROTOCOL_BINARY_CMD_VERSION = 0x0b,
92
PROTOCOL_BINARY_CMD_GETK = 0x0c,
93
PROTOCOL_BINARY_CMD_GETKQ = 0x0d,
94
PROTOCOL_BINARY_CMD_APPEND = 0x0e,
95
PROTOCOL_BINARY_CMD_PREPEND = 0x0f,
96
PROTOCOL_BINARY_CMD_STAT = 0x10,
97
PROTOCOL_BINARY_CMD_SETQ = 0x11,
98
PROTOCOL_BINARY_CMD_ADDQ = 0x12,
99
PROTOCOL_BINARY_CMD_REPLACEQ = 0x13,
100
PROTOCOL_BINARY_CMD_DELETEQ = 0x14,
101
PROTOCOL_BINARY_CMD_INCREMENTQ = 0x15,
102
PROTOCOL_BINARY_CMD_DECREMENTQ = 0x16,
103
PROTOCOL_BINARY_CMD_QUITQ = 0x17,
104
PROTOCOL_BINARY_CMD_FLUSHQ = 0x18,
105
PROTOCOL_BINARY_CMD_APPENDQ = 0x19,
106
PROTOCOL_BINARY_CMD_PREPENDQ = 0x1a
107
} protocol_binary_command;
110
* Definition of the data types in the packet
111
* See section 3.4 Data Types
114
PROTOCOL_BINARY_RAW_BYTES = 0x00
115
} protocol_binary_datatypes;
118
* Definition of the header structure for a request packet.
134
} protocol_binary_request_header;
137
* Definition of the header structure for a response packet.
153
} protocol_binary_response_header;
156
* Definition of a request-packet containing no extras
160
protocol_binary_request_header header;
162
uint8_t bytes[sizeof(protocol_binary_request_header)];
163
} protocol_binary_request_no_extras;
166
* Definition of a response-packet containing no extras
170
protocol_binary_response_header header;
172
uint8_t bytes[sizeof(protocol_binary_response_header)];
173
} protocol_binary_response_no_extras;
176
* Definition of the packet used by the get, getq, getk and getkq command.
179
typedef protocol_binary_request_no_extras protocol_binary_request_get;
180
typedef protocol_binary_request_no_extras protocol_binary_request_getq;
181
typedef protocol_binary_request_no_extras protocol_binary_request_getk;
182
typedef protocol_binary_request_no_extras protocol_binary_request_getkq;
185
* Definition of the packet returned from a successful get, getq, getk and
191
protocol_binary_response_header header;
196
uint8_t bytes[sizeof(protocol_binary_response_header) + 4];
197
} protocol_binary_response_get;
199
typedef protocol_binary_response_get protocol_binary_response_getq;
200
typedef protocol_binary_response_get protocol_binary_response_getk;
201
typedef protocol_binary_response_get protocol_binary_response_getkq;
204
* Definition of the packet used by the delete command
207
typedef protocol_binary_request_no_extras protocol_binary_request_delete;
210
* Definition of the packet returned by the delete command
213
typedef protocol_binary_response_no_extras protocol_binary_response_delete;
216
* Definition of the packet used by the flush command
218
* Please note that the expiration field is optional, so remember to see
219
* check the header.bodysize to see if it is present.
223
protocol_binary_request_header header;
228
uint8_t bytes[sizeof(protocol_binary_request_header) + 4];
229
} protocol_binary_request_flush;
232
* Definition of the packet returned by the flush command
235
typedef protocol_binary_response_no_extras protocol_binary_response_flush;
238
* Definition of the packet used by set, add and replace
243
protocol_binary_request_header header;
249
uint8_t bytes[sizeof(protocol_binary_request_header) + 8];
250
} protocol_binary_request_set;
251
typedef protocol_binary_request_set protocol_binary_request_add;
252
typedef protocol_binary_request_set protocol_binary_request_replace;
255
* Definition of the packet returned by set, add and replace
258
typedef protocol_binary_response_no_extras protocol_binary_response_set;
259
typedef protocol_binary_response_no_extras protocol_binary_response_add;
260
typedef protocol_binary_response_no_extras protocol_binary_response_replace;
263
* Definition of the noop packet
266
typedef protocol_binary_request_no_extras protocol_binary_request_noop;
269
* Definition of the packet returned by the noop command
272
typedef protocol_binary_response_no_extras protocol_binary_response_noop;
275
* Definition of the structure used by the increment and decrement
281
protocol_binary_request_header header;
288
uint8_t bytes[sizeof(protocol_binary_request_header) + 20];
289
} protocol_binary_request_incr;
290
typedef protocol_binary_request_incr protocol_binary_request_decr;
293
* Definition of the response from an incr or decr command
299
protocol_binary_response_header header;
304
uint8_t bytes[sizeof(protocol_binary_response_header) + 8];
305
} protocol_binary_response_incr;
306
typedef protocol_binary_response_incr protocol_binary_response_decr;
309
* Definition of the quit
312
typedef protocol_binary_request_no_extras protocol_binary_request_quit;
315
* Definition of the packet returned by the quit command
318
typedef protocol_binary_response_no_extras protocol_binary_response_quit;
321
* Definition of the packet used by append and prepend command
324
typedef protocol_binary_request_no_extras protocol_binary_request_append;
325
typedef protocol_binary_request_no_extras protocol_binary_request_prepend;
328
* Definition of the packet returned from a successful append or prepend
331
typedef protocol_binary_response_no_extras protocol_binary_response_append;
332
typedef protocol_binary_response_no_extras protocol_binary_response_prepend;
335
* Definition of the packet used by the version command
338
typedef protocol_binary_request_no_extras protocol_binary_request_version;
341
* Definition of the packet returned from a successful version command
344
typedef protocol_binary_response_no_extras protocol_binary_response_version;
348
* Definition of the packet used by the stats command.
351
typedef protocol_binary_request_no_extras protocol_binary_request_stats;
354
* Definition of the packet returned from a successful stats command
357
typedef protocol_binary_response_no_extras protocol_binary_response_stats;
53
* Definition of the legal "magic" values used in a packet.
54
* See section 3.1 Magic byte
58
PROTOCOL_BINARY_REQ= 0x80,
59
PROTOCOL_BINARY_RES= 0x81
60
} protocol_binary_magic;
63
* Definition of the valid response status numbers.
64
* See section 3.2 Response Status
68
PROTOCOL_BINARY_RESPONSE_SUCCESS= 0x00,
69
PROTOCOL_BINARY_RESPONSE_KEY_ENOENT= 0x01,
70
PROTOCOL_BINARY_RESPONSE_KEY_EEXISTS= 0x02,
71
PROTOCOL_BINARY_RESPONSE_E2BIG= 0x03,
72
PROTOCOL_BINARY_RESPONSE_EINVAL= 0x04,
73
PROTOCOL_BINARY_RESPONSE_NOT_STORED= 0x05,
74
PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND= 0x81,
75
PROTOCOL_BINARY_RESPONSE_ENOMEM= 0x82
76
} protocol_binary_response_status;
79
* Defintion of the different command opcodes.
80
* See section 3.3 Command Opcodes
84
PROTOCOL_BINARY_CMD_GET= 0x00,
85
PROTOCOL_BINARY_CMD_SET= 0x01,
86
PROTOCOL_BINARY_CMD_ADD= 0x02,
87
PROTOCOL_BINARY_CMD_REPLACE= 0x03,
88
PROTOCOL_BINARY_CMD_DELETE= 0x04,
89
PROTOCOL_BINARY_CMD_INCREMENT= 0x05,
90
PROTOCOL_BINARY_CMD_DECREMENT= 0x06,
91
PROTOCOL_BINARY_CMD_QUIT= 0x07,
92
PROTOCOL_BINARY_CMD_FLUSH= 0x08,
93
PROTOCOL_BINARY_CMD_GETQ= 0x09,
94
PROTOCOL_BINARY_CMD_NOOP= 0x0a,
95
PROTOCOL_BINARY_CMD_VERSION= 0x0b,
96
PROTOCOL_BINARY_CMD_GETK= 0x0c,
97
PROTOCOL_BINARY_CMD_GETKQ= 0x0d,
98
PROTOCOL_BINARY_CMD_APPEND= 0x0e,
99
PROTOCOL_BINARY_CMD_PREPEND= 0x0f,
100
PROTOCOL_BINARY_CMD_STAT= 0x10,
101
PROTOCOL_BINARY_CMD_SETQ= 0x11,
102
PROTOCOL_BINARY_CMD_ADDQ= 0x12,
103
PROTOCOL_BINARY_CMD_REPLACEQ= 0x13,
104
PROTOCOL_BINARY_CMD_DELETEQ= 0x14,
105
PROTOCOL_BINARY_CMD_INCREMENTQ= 0x15,
106
PROTOCOL_BINARY_CMD_DECREMENTQ= 0x16,
107
PROTOCOL_BINARY_CMD_QUITQ= 0x17,
108
PROTOCOL_BINARY_CMD_FLUSHQ= 0x18,
109
PROTOCOL_BINARY_CMD_APPENDQ= 0x19,
110
PROTOCOL_BINARY_CMD_PREPENDQ= 0x1a
111
} protocol_binary_command;
114
* Definition of the data types in the packet
115
* See section 3.4 Data Types
119
PROTOCOL_BINARY_RAW_BYTES= 0x00
120
} protocol_binary_datatypes;
123
* Definition of the header structure for a request packet.
141
} protocol_binary_request_header;
144
* Definition of the header structure for a response packet.
162
} protocol_binary_response_header;
165
* Definition of a request-packet containing no extras
171
protocol_binary_request_header header;
173
uint8_t bytes[sizeof(protocol_binary_request_header)];
174
} protocol_binary_request_no_extras;
177
* Definition of a response-packet containing no extras
183
protocol_binary_response_header header;
185
uint8_t bytes[sizeof(protocol_binary_response_header)];
186
} protocol_binary_response_no_extras;
189
* Definition of the packet used by the get, getq, getk and getkq command.
192
typedef protocol_binary_request_no_extras protocol_binary_request_get;
193
typedef protocol_binary_request_no_extras protocol_binary_request_getq;
194
typedef protocol_binary_request_no_extras protocol_binary_request_getk;
195
typedef protocol_binary_request_no_extras protocol_binary_request_getkq;
198
* Definition of the packet returned from a successful get, getq, getk and
206
protocol_binary_response_header header;
212
uint8_t bytes[sizeof(protocol_binary_response_header) + 4];
213
} protocol_binary_response_get;
215
typedef protocol_binary_response_get protocol_binary_response_getq;
216
typedef protocol_binary_response_get protocol_binary_response_getk;
217
typedef protocol_binary_response_get protocol_binary_response_getkq;
220
* Definition of the packet used by the delete command
223
typedef protocol_binary_request_no_extras protocol_binary_request_delete;
226
* Definition of the packet returned by the delete command
229
typedef protocol_binary_response_no_extras
230
protocol_binary_response_delete;
233
* Definition of the packet used by the flush command
235
* Please note that the expiration field is optional, so remember to see
236
* check the header.bodysize to see if it is present.
242
protocol_binary_request_header header;
248
uint8_t bytes[sizeof(protocol_binary_request_header) + 4];
249
} protocol_binary_request_flush;
252
* Definition of the packet returned by the flush command
255
typedef protocol_binary_response_no_extras protocol_binary_response_flush;
258
* Definition of the packet used by set, add and replace
265
protocol_binary_request_header header;
272
uint8_t bytes[sizeof(protocol_binary_request_header) + 8];
273
} protocol_binary_request_set;
274
typedef protocol_binary_request_set protocol_binary_request_add;
275
typedef protocol_binary_request_set
276
protocol_binary_request_replace;
279
* Definition of the packet returned by set, add and replace
282
typedef protocol_binary_response_no_extras protocol_binary_response_set;
283
typedef protocol_binary_response_no_extras protocol_binary_response_add;
284
typedef protocol_binary_response_no_extras
285
protocol_binary_response_replace;
288
* Definition of the noop packet
291
typedef protocol_binary_request_no_extras protocol_binary_request_noop;
294
* Definition of the packet returned by the noop command
297
typedef protocol_binary_response_no_extras protocol_binary_response_noop;
300
* Definition of the structure used by the increment and decrement
308
protocol_binary_request_header header;
316
uint8_t bytes[sizeof(protocol_binary_request_header) + 20];
317
} protocol_binary_request_incr;
318
typedef protocol_binary_request_incr protocol_binary_request_decr;
321
* Definition of the response from an incr or decr command
329
protocol_binary_response_header header;
335
uint8_t bytes[sizeof(protocol_binary_response_header) + 8];
336
} protocol_binary_response_incr;
337
typedef protocol_binary_response_incr protocol_binary_response_decr;
340
* Definition of the quit
343
typedef protocol_binary_request_no_extras protocol_binary_request_quit;
346
* Definition of the packet returned by the quit command
349
typedef protocol_binary_response_no_extras protocol_binary_response_quit;
352
* Definition of the packet used by append and prepend command
355
typedef protocol_binary_request_no_extras protocol_binary_request_append;
356
typedef protocol_binary_request_no_extras
357
protocol_binary_request_prepend;
360
* Definition of the packet returned from a successful append or prepend
363
typedef protocol_binary_response_no_extras
364
protocol_binary_response_append;
365
typedef protocol_binary_response_no_extras
366
protocol_binary_response_prepend;
369
* Definition of the packet used by the version command
372
typedef protocol_binary_request_no_extras
373
protocol_binary_request_version;
376
* Definition of the packet returned from a successful version command
379
typedef protocol_binary_response_no_extras
380
protocol_binary_response_version;
384
* Definition of the packet used by the stats command.
387
typedef protocol_binary_request_no_extras protocol_binary_request_stats;
390
* Definition of the packet returned from a successful stats command
393
typedef protocol_binary_response_no_extras protocol_binary_response_stats;
358
394
#ifdef __cplusplus