X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Finstance.h;h=e564afaaa3871cf0d9b44c676380c1ef6c354bee;hb=99332db60646cb1b06a61d1636eddbbf0b5d0b40;hp=16d509f02a6f6bd798872edb1d444018f307c3e0;hpb=9ad3090b40fabae0ccc1b3e156bfc84c4c62d47d;p=awesomized%2Flibmemcached diff --git a/libmemcached/instance.h b/libmemcached/instance.h index 16d509f0..e564afaa 100644 --- a/libmemcached/instance.h +++ b/libmemcached/instance.h @@ -39,31 +39,67 @@ #pragma once #ifndef WIN32 -#include +# ifdef HAVE_NETDB_H +# include +# endif #endif #ifdef NI_MAXHOST -#define MEMCACHED_NI_MAXHOST NI_MAXHOST +# define MEMCACHED_NI_MAXHOST NI_MAXHOST #else -#define MEMCACHED_NI_MAXHOST 1025 +# define MEMCACHED_NI_MAXHOST 1025 #endif #ifdef NI_MAXSERV -#define MEMCACHED_NI_MAXSERV NI_MAXSERV +# define MEMCACHED_NI_MAXSERV NI_MAXSERV #else -#define MEMCACHED_NI_MAXSERV 32 +# define MEMCACHED_NI_MAXSERV 32 #endif -struct memcached_instance_st { +#ifdef __cplusplus + +namespace org { +namespace libmemcached { + +// @todo Complete class transformation +struct Instance { + in_port_t port() const + { + return port_; + } + + void port(in_port_t arg) + { + port_= arg; + } + + void mark_server_as_clean() + { + server_failure_counter= 0; + next_retry= 0; + } + + void disable() + { + } + + void enable() + { + } + + uint32_t response_count() const + { + return cursor_active_; + } + struct { bool is_allocated:1; bool is_initialized:1; bool is_shutting_down:1; bool is_dead:1; } options; - uint32_t number_of_hosts; - uint32_t cursor_active; - in_port_t port; + uint32_t cursor_active_; + in_port_t port_; memcached_socket_t fd; uint32_t io_bytes_sent; /* # bytes sent since last read */ uint32_t request_id; @@ -96,3 +132,8 @@ struct memcached_instance_st { char write_buffer[MEMCACHED_MAX_BUFFER]; char hostname[MEMCACHED_NI_MAXHOST]; }; + +} // namespace libmemcached +} // namespace org + +#endif