WIP
[m6w6/libmemcached] / include / libmemcached-1.0 / struct / server.h
1 /*
2 +--------------------------------------------------------------------+
3 | libmemcached - C/C++ Client Library for memcached |
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted under the terms of the BSD license. |
7 | You should have received a copy of the license in a bundled file |
8 | named LICENSE; in case you did not receive a copy you can review |
9 | the terms online at: https://opensource.org/licenses/BSD-3-Clause |
10 +--------------------------------------------------------------------+
11 | Copyright (c) 2006-2014 Brian Aker https://datadifferential.com/ |
12 | Copyright (c) 2020 Michael Wallner <mike@php.net> |
13 +--------------------------------------------------------------------+
14 */
15
16 #pragma once
17
18 #include "libmemcached-1.0/configure.h"
19
20 #ifdef HAVE_NETDB_H
21 # include <netdb.h>
22 #endif
23
24 #ifdef NI_MAXHOST
25 # define MEMCACHED_NI_MAXHOST NI_MAXHOST
26 #else
27 # define MEMCACHED_NI_MAXHOST 1025
28 #endif
29
30 #ifdef NI_MAXSERV
31 # define MEMCACHED_NI_MAXSERV NI_MAXSERV
32 #else
33 # define MEMCACHED_NI_MAXSERV 32
34 #endif
35
36 enum memcached_server_state_t {
37 MEMCACHED_SERVER_STATE_NEW, // fd == -1, no address lookup has been done
38 MEMCACHED_SERVER_STATE_ADDRINFO, // ADDRRESS information has been gathered
39 MEMCACHED_SERVER_STATE_IN_PROGRESS,
40 MEMCACHED_SERVER_STATE_CONNECTED,
41 MEMCACHED_SERVER_STATE_IN_TIMEOUT,
42 MEMCACHED_SERVER_STATE_DISABLED
43 };
44
45 struct memcached_server_st {
46 struct {
47 bool is_allocated : 1;
48 bool is_initialized : 1;
49 bool is_shutting_down : 1;
50 bool is_dead : 1;
51 } options;
52 uint32_t number_of_hosts;
53 uint32_t cursor_active;
54 in_port_t port;
55 uint32_t io_bytes_sent; /* # bytes sent since last read */
56 uint32_t request_id;
57 uint32_t server_failure_counter;
58 uint64_t server_failure_counter_query_id;
59 uint32_t server_timeout_counter;
60 uint64_t server_timeout_counter_query_id;
61 uint32_t weight;
62 uint32_t version;
63 enum memcached_server_state_t state;
64 struct {
65 uint32_t read;
66 uint32_t write;
67 uint32_t timeouts;
68 size_t _bytes_read;
69 } io_wait_count;
70 uint8_t major_version; // Default definition of UINT8_MAX means that it has not been set.
71 uint8_t micro_version; // ditto, and note that this is the third, not second version bit
72 uint8_t minor_version; // ditto
73 memcached_connection_t type;
74 time_t next_retry;
75 struct memcached_st *root;
76 uint64_t limit_maxbytes;
77 struct memcached_error_t *error_messages;
78 char hostname[MEMCACHED_NI_MAXHOST];
79 };