2 * Copyright (C) 2006-2009 Brian Aker
5 * Use and distribution licensed under the BSD license. See
6 * the COPYING file in the parent directory for full text.
8 * Summary: String structure used for libmemcached.
12 #ifndef __LIBMEMCACHED_SERVER_H__
13 #define __LIBMEMCACHED_SERVER_H__
16 struct memcached_server_st
{
19 bool is_initialized
:1;
20 bool sockaddr_inited
:1;
21 bool is_shutting_down
:1;
23 uint32_t number_of_hosts
;
24 uint32_t cursor_active
;
27 memcached_socket_t fd
;
28 uint32_t io_bytes_sent
; /* # bytes sent since last read */
29 uint32_t server_failure_counter
;
31 struct { // Place any "state" sort variables in here.
39 uint8_t major_version
;
40 uint8_t micro_version
;
41 uint8_t minor_version
;
42 memcached_connection_t type
;
44 char *cached_server_error
;
45 size_t read_buffer_length
;
46 size_t read_data_length
;
47 size_t write_buffer_offset
;
48 struct addrinfo
*address_info
;
50 const memcached_st
*root
;
51 uint64_t limit_maxbytes
;
52 char read_buffer
[MEMCACHED_MAX_BUFFER
];
53 char write_buffer
[MEMCACHED_MAX_BUFFER
];
54 char hostname
[NI_MAXHOST
];
63 memcached_return_t
memcached_server_cursor(const memcached_st
*ptr
,
64 const memcached_server_fn
*callback
,
66 uint32_t number_of_callbacks
);
69 memcached_server_instance_st
memcached_server_by_key(const memcached_st
*ptr
,
72 memcached_return_t
*error
);
75 void memcached_server_error_reset(memcached_server_st
*ptr
);
78 void memcached_server_free(memcached_server_st
*ptr
);
81 memcached_server_st
*memcached_server_clone(memcached_server_st
*destination
,
82 const memcached_server_st
*source
);
85 memcached_server_instance_st
memcached_server_get_last_disconnect(const memcached_st
*ptr
);
89 memcached_return_t
memcached_server_add_udp(memcached_st
*ptr
,
93 memcached_return_t
memcached_server_add_unix_socket(memcached_st
*ptr
,
94 const char *filename
);
96 memcached_return_t
memcached_server_add(memcached_st
*ptr
,
97 const char *hostname
, in_port_t port
);
100 memcached_return_t
memcached_server_add_udp_with_weight(memcached_st
*ptr
,
101 const char *hostname
,
105 memcached_return_t
memcached_server_add_unix_socket_with_weight(memcached_st
*ptr
,
106 const char *filename
,
109 memcached_return_t
memcached_server_add_with_weight(memcached_st
*ptr
, const char *hostname
,
114 Operations on Single Servers.
117 uint32_t memcached_server_response_count(memcached_server_instance_st self
);
120 const char *memcached_server_name(memcached_server_instance_st self
);
123 in_port_t
memcached_server_port(memcached_server_instance_st self
);
126 const char *memcached_server_error(memcached_server_instance_st ptr
);
134 #endif /* __LIBMEMCACHED_SERVER_H__ */