1 /* -*- Mode: C; tab-width: 2; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 #ifndef MEMCACHED_PROTOCOL_INTERNAL_H
3 #define MEMCACHED_PROTOCOL_INTERNAL_H
8 #include <netinet/in.h>
10 /* Define this here, which will turn on the visibilty controls while we're
11 * building libmemcached.
13 #define BUILDING_LIBMEMCACHED 1
15 #include <libmemcached/byteorder.h>
16 #include <libmemcached/protocol_handler.h>
17 #include <libmemcached/protocol/cache.h>
19 struct memcached_binary_protocol_st
{
20 struct memcached_binary_protocol_callback_st
*callback
;
21 memcached_binary_protocol_recv_func recv
;
22 memcached_binary_protocol_send_func send
;
24 size_t input_buffer_size
;
26 /* @todo use multiple sized buffers */
27 cache_t
*buffer_cache
;
32 /* Pointer to the data */
34 /* The offset to the first byte into the buffer that is used */
36 /* The offset into the buffer for the first free byte */
38 /* The number of bytes in the buffer */
40 /* Pointer to the next buffer in the chain */
41 struct chunk_st
*next
;
44 #define CHUNK_BUFFERSIZE 2048
46 struct memcached_binary_protocol_client_st
{
47 struct memcached_binary_protocol_st
*root
;
51 /* Linked list of data to send */
52 struct chunk_st
*output
;
53 struct chunk_st
*output_tail
;
58 size_t input_buffer_size
;
59 size_t input_buffer_offset
;
63 struct chunk_st
*input
;
64 /* Pointer to the last chunk to avoid the need to traverse the complete list */
65 struct chunk_st
*input_tail
;
66 size_t bytes_available
;
68 protocol_binary_request_header
*current_command
;
73 bool memcached_binary_protocol_pedantic_check_request(protocol_binary_request_header
*request
);
76 bool memcached_binary_protocol_pedantic_check_response(protocol_binary_request_header
*request
,
77 protocol_binary_response_header
*response
);