forked from dterei/mutilate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbinary_protocol.h
More file actions
43 lines (32 loc) · 752 Bytes
/
binary_protocol.h
File metadata and controls
43 lines (32 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef BINARY_PROTOCOL_H
#define BINARY_PROTOCOL_H
#define CMD_GET 0x00
#define CMD_SET 0x01
#define CMD_SASL 0x21
#define RESP_OK 0x00
#define RESP_SASL_ERR 0x20
typedef struct __attribute__ ((__packed__)) {
uint8_t magic;
uint8_t opcode;
uint16_t key_len;
uint8_t extra_len;
uint8_t data_type;
union {
uint16_t vbucket; // request use
uint16_t status; // response use
};
uint32_t body_len;
uint32_t opaque;
uint64_t version;
// Used for set only.
uint64_t extras;
} binary_header_t;
// REFLEX PROTCOL
typedef struct __attribute__ ((__packed__)) {
uint16_t magic;
uint16_t opcode;
void *req_handle;
unsigned long lba;
unsigned int lba_count;
} binary_header_blk_t;
#endif /* BINARY_PROTOCOL_H */