Merge lp:~tangent-org/libmemcached/1.0-build/ Build: jenkins-Libmemcached-170
[awesomized/libmemcached] / libmemcached / common.h
index f45eaffd4474894390f8d1142eb2796cdcefb61d..cc38b56d49f42e9d9409750ec8830bcfdbb7036d 100644 (file)
 
 #pragma once
 
-#include <config.h>
+#include <mem_config.h>
 
 #ifdef __cplusplus
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <ctime>
-#include <ctype.h>
+# include <cstddef>
+# include <cstdio>
+# include <cstdlib>
+# include <cstring>
+# include <ctime>
+# include <cctype>
+# include <cerrno>
+# include <climits>
 #else
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
+# ifdef HAVE_STDDEF_H
+#  include <stddef.h>
+# endif
+# ifdef HAVE_STDLIB_H
+#  include <stdio.h>
+# endif
+# ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+# include <string.h>
+# ifdef HAVE_TIME_H
+#  include <time.h>
+# endif
+# ifdef HAVE_ERRNO_H
+#  include <errno.h>
+# endif
+# ifdef HAVE_LIMITS_H
+#  include <limits.h>
+# endif
 #endif
 
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <sys/types.h>
-#include <unistd.h>
+#ifdef HAVE_SYS_UN_H
+# include <sys/un.h>
+#endif
+
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
 
 #ifdef HAVE_STRINGS_H
-#include <strings.h>
+# include <strings.h>
+#endif
+
+#ifdef HAVE_DLFCN_H
+# include <dlfcn.h>
 #endif
 
-#include <libmemcached/memcached.h>
+#include <libmemcached-1.0/memcached.h>
 #include <libmemcached/watchpoint.h>
 #include <libmemcached/is.h>
-#include <libmemcached/namespace.h>
 
+#ifdef __cplusplus
+# include "libmemcached/instance.hpp"
+#endif
 #include <libmemcached/server_instance.h>
 
 #ifdef HAVE_POLL_H
-#include <poll.h>
+# include <poll.h>
 #else
-#include "poll/poll.h"
+# include "poll/poll.h"
+#endif
+
+#ifndef POLLHUP
+# define POLLHUP               0x0010
 #endif
 
+#ifndef POLLNVAL
+# define POLLNVAL      0x0020
+#endif
 
 #ifdef __cplusplus
 extern "C" {
@@ -87,40 +136,59 @@ extern "C" {
 
 typedef memcached_return_t (*memcached_server_execute_fn)(memcached_st *ptr, memcached_server_write_instance_st server, void *context);
 
-LIBMEMCACHED_LOCAL
-memcached_server_write_instance_st memcached_server_instance_fetch(memcached_st *ptr, uint32_t server_key);
-
-LIBMEMCACHED_LOCAL
-memcached_return_t memcached_server_execute(memcached_st *ptr,
-                                            memcached_server_execute_fn callback,
-                                            void *context);
 #ifdef __cplusplus
 } // extern "C"
 #endif
 
 
+#ifdef __cplusplus
+org::libmemcached::Instance* memcached_instance_fetch(memcached_st *ptr, uint32_t server_key);
+#endif
+
+memcached_return_t memcached_server_execute(memcached_st *ptr,
+                                            memcached_server_execute_fn callback,
+                                            void *context);
 /* These are private not to be installed headers */
 #include <libmemcached/error.hpp>
 #include <libmemcached/memory.h>
 #include <libmemcached/io.h>
 #ifdef __cplusplus
 #include <libmemcached/string.hpp>
+#include <libmemcached/memcached/protocol_binary.h>
 #include <libmemcached/io.hpp>
+#include <libmemcached/udp.hpp>
 #include <libmemcached/do.hpp>
+#include <libmemcached/socket.hpp>
+#include <libmemcached/connect.hpp>
+#include <libmemcached/allocators.hpp>
+#include <libmemcached/hash.hpp>
+#include <libmemcached/quit.hpp>
+#include <libmemcached/instance.hpp>
+#include <libmemcached/server.hpp>
+#include <libmemcached/flag.hpp>
+#include <libmemcached/behavior.hpp>
+#include <libmemcached/sasl.hpp>
+#include <libmemcached/server_list.hpp>
 #endif
 #include <libmemcached/internal.h>
 #include <libmemcached/array.h>
 #include <libmemcached/libmemcached_probes.h>
-#include <libmemcached/memcached/protocol_binary.h>
 #include <libmemcached/byteorder.h>
 #include <libmemcached/initialize_query.h>
+#ifdef __cplusplus
 #include <libmemcached/response.h>
+#endif
 #include <libmemcached/namespace.h>
+#include <libmemcached/virtual_bucket.h>
 
 #ifdef __cplusplus
 #include <libmemcached/backtrace.hpp>
 #include <libmemcached/assert.hpp>
 #include <libmemcached/server.hpp>
+#include <libmemcached/key.hpp>
+#include <libmemcached/encoding_key.h>
+#include <libmemcached/result.h>
+#include <libmemcached/version.hpp>
 #endif
 
 #include <libmemcached/continuum.hpp>
@@ -145,56 +213,21 @@ memcached_return_t memcached_server_execute(memcached_st *ptr,
 extern "C" {
 #endif
 
-LIBMEMCACHED_LOCAL
-memcached_return_t memcached_connect(memcached_server_write_instance_st ptr);
-
-LIBMEMCACHED_LOCAL
 memcached_return_t run_distribution(memcached_st *ptr);
 
-#define memcached_server_response_increment(A) (A)->cursor_active++
-#define memcached_server_response_decrement(A) (A)->cursor_active--
-#define memcached_server_response_reset(A) (A)->cursor_active=0
+#define memcached_server_response_increment(A) (A)->cursor_active_++
+#define memcached_server_response_decrement(A) (A)->cursor_active_--
+#define memcached_server_response_reset(A) (A)->cursor_active_=0
 
-LIBMEMCACHED_LOCAL
-void set_last_disconnected_host(memcached_server_write_instance_st ptr);
+#define memcached_instance_response_increment(A) (A)->cursor_active_++
+#define memcached_instance_response_decrement(A) (A)->cursor_active_--
+#define memcached_instance_response_reset(A) (A)->cursor_active_=0
 
 #ifdef __cplusplus
-LIBMEMCACHED_LOCAL
-memcached_return_t memcached_key_test(const memcached_st& memc,
-                                      const char * const *keys,
-                                      const size_t *key_length,
-                                      size_t number_of_keys);
-#endif
-
-LIBMEMCACHED_LOCAL
-memcached_return_t memcached_purge(memcached_server_write_instance_st ptr);
-
-
-static inline memcached_return_t memcached_validate_key_length(size_t key_length, bool binary)
-{
-  if (key_length == 0)
-  {
-    return MEMCACHED_BAD_KEY_PROVIDED;
-  }
-
-  if (binary)
-  {
-    if (key_length > 0xffff)
-    {
-      return MEMCACHED_BAD_KEY_PROVIDED;
-    }
-  }
-  else
-  {
-    if (key_length >= MEMCACHED_MAX_KEY)
-    {
-      return MEMCACHED_BAD_KEY_PROVIDED;
-    }
-  }
-
-  return MEMCACHED_SUCCESS;
 }
+#endif
 
 #ifdef __cplusplus
-}
+bool memcached_purge(org::libmemcached::Instance*);
+org::libmemcached::Instance* memcached_instance_by_position(const memcached_st *ptr, uint32_t server_key);
 #endif