memc= memcached_create(NULL);
memcached_return_t rc= memcached_parse_options(memc, argv[1], strlen(argv[1]));
+ memcached_free(memc);
if (rc != MEMCACHED_SUCCESS)
{
*
*/
+#pragma once
#ifndef __LIBMEMCACHED_CONSTANTS_H__
#define __LIBMEMCACHED_CONSTANTS_H__
in_port_t port,
uint32_t weight,
memcached_connection_t type);
+
static memcached_return_t update_continuum(memcached_st *ptr);
static int compare_servers(const void *p1, const void *p2)
%start statement
%verbose
-%token EQ
%token SERVER
%token SERVERS
%token TCPNODELAY
%token UNKNOWN
%token VERIFY_KEY
-%token COMMA
+%nonassoc ','
+%nonassoc '='
%token <number> NUMBER
%token <number> FLOAT
%token <string> IDENTIFIER
%token <string> SERVER_WITH_PORT
+%token <string> IPADDRESS
+%token <string> IPADDRESS_WITH_PORT
%type <server> server
expression:
- SERVER EQ server
+ SERVER '=' server
{
(void) memcached_server_add(parser->memc, $3.c_str, $3.port);
}
- | SERVERS EQ server_list
+ | SERVERS '=' server_list
{ }
| TCPNODELAY
{
{
(void) memcached_server_add(parser->memc, $1.c_str, $1.port);
}
- | server_list COMMA server
+ | server_list ',' server
{
(void) memcached_server_add(parser->memc, $3.c_str, $3.port);
}
SERVER_WITH_PORT NUMBER
{
$$.c_str= $1.c_str;
- $$.length= $1.length;
+ $$.length= $1.length -1;
$$.port= $2;
}
| IDENTIFIER
{
$$.c_str= $1.c_str;
$$.length= $1.length;
- $$.port= 80;
+ $$.port= MEMCACHED_DEFAULT_PORT;
+ }
+ | IPADDRESS_WITH_PORT NUMBER
+ {
+ $$.c_str= $1.c_str;
+ $$.length= $1.length -1;
+ $$.port= $2;
+ }
+ | IPADDRESS
+ {
+ $$.c_str= $1.c_str;
+ $$.length= $1.length;
+ $$.port= MEMCACHED_DEFAULT_PORT;
}
;
%%
-[=] { return EQ; }
-[,] { return COMMA; }
-[0-9]+ { yylval->number = atoi(yytext); return (NUMBER); }
+=|, { return yytext[0];}
-([0-9]*.[0-9]+) { yylval->double_number = atof(yytext); return (FLOAT); }
+
+[[:digit:]]+ { yylval->number = atoi(yytext); return (NUMBER); }
+
+([[:digit:]]*.[:digit:]+) { yylval->double_number = atof(yytext); return (FLOAT); }
[ \t\r\n] ; /* skip whitespace */
"--VERIFY_KEY" { return VERIFY_KEY; }
"--VERIFY-KEY" { return VERIFY_KEY; }
-[A-Za-z][A-Za-z0-9_]*[:] {
- yylval->string.c_str = yytext;
- yylval->string.length = yyleng;
- return SERVER_WITH_PORT;
- }
-
-[A-Za-z][A-Za-z0-9_]* {
- yylval->string.c_str = yytext;
- yylval->string.length = yyleng;
- return IDENTIFIER;
- }
-[-] ;
-
-. {
- std::cerr << "Near " << yytext << std::endl;
- return UNKNOWN;
- }
+[[:alnum:]][[:alnum:].]*[[:alpha:]]: {
+ yylval->string.c_str = yytext;
+ yylval->string.length = yyleng;
+ return SERVER_WITH_PORT;
+ }
+
+[[:alnum:]][[:alnum:].]*[[:alpha:]] {
+ yylval->string.c_str = yytext;
+ yylval->string.length = yyleng;
+ return IDENTIFIER;
+ }
+[[:digit:]]{1,3}"."[[:digit:]]{1,3}"."[[:digit:]]{1,3}"."[[:digit:]]{1,3}: {
+ yylval->string.c_str = yytext;
+ yylval->string.length = yyleng;
+ return IPADDRESS_WITH_PORT;
+ }
+
+[[:digit:]]{1,3}"."[[:digit:]]{1,3}"."[[:digit:]]{1,3}"."[[:digit:]]{1,3} {
+ yylval->string.c_str = yytext;
+ yylval->string.length = yyleng;
+ return IPADDRESS;
+ }
+
+. {
+ std::cerr << "Near " << yytext << std::endl;
+ return UNKNOWN;
+ }
%%
*
*/
+#pragma once
#ifndef __LIBMEMCACHED_STRING_H__
#define __LIBMEMCACHED_STRING_H__
noinst_HEADERS+= \
libtest/server.h \
- libtest/test.h
+ libtest/test.h \
+ libtest/visibility.h
noinst_LTLIBRARIES+= libtest/libserver.la
libtest_libserver_la_SOURCES= libtest/server.c
-/* uTest
- * Copyright (C) 2006-2009 Brian Aker
- * All rights reserved.
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Gearmand client and server library.
+ *
+ * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2006-2010 Brian Aker
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * Use and distribution licensed under the BSD license. See
- * the COPYING file in the parent directory for full text.
*/
+#pragma once
+
+#include <libtest/visibility.h>
+
/*
Structures for generic tests.
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
typedef test_return_t (*test_callback_runner_fn)(test_callback_fn, void *);
typedef test_return_t (*test_callback_error_fn)(test_return_t, void *);
-/* Help function for use with gettimeofday() */
-long int timedif(struct timeval a, struct timeval b);
-
/**
A structure describing the test case.
*/
uint32_t total;
} world_stats_st;
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Help function for use with gettimeofday() */
+LIBTEST_API
+long int timedif(struct timeval a, struct timeval b);
+
/* How we make all of this work :) */
+LIBTEST_API
void get_world(world_st *world);
+LIBTEST_INTERNAL_API
void create_core(void);
/**
@note Friendly print function for errors.
*/
+LIBTEST_API
const char *test_strerror(test_return_t code);
#define test_fail(A) \
} \
} while (0)
+
+#define STRINGIFY(x) #x
+#define TOSTRING(x) STRINGIFY(x)
+#define AT __FILE__ ":" TOSTRING(__LINE__)
+
+#ifdef __cplusplus
+#define STRING_WITH_LEN(X) (X), (static_cast<size_t>((sizeof(X) - 1)))
+#else
+#define STRING_WITH_LEN(X) (X), ((size_t)((sizeof(X) - 1)))
+#endif
+
+#ifdef __cplusplus
+#define STRING_PARAM_WITH_LEN(X) X, static_cast<size_t>(sizeof(X) - 1)
+#else
+#define STRING_PARAM_WITH_LEN(X) X, (size_t)((sizeof(X) - 1))
+#endif
+
#ifdef __cplusplus
}
#endif
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Gearmand client and server library.
+ *
+ * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#pragma once
+
+#if defined(BUILDING_LIBTEST)
+# if defined(HAVE_VISIBILITY)
+# define LIBTEST_API __attribute__ ((visibility("default")))
+# define LIBTEST_INTERNAL_API __attribute__ ((visibility("hidden")))
+# define LIBTEST_API_DEPRECATED __attribute__ ((deprecated,visibility("default")))
+# define LIBTEST_LOCAL __attribute__ ((visibility("hidden")))
+# elif defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550)
+# define LIBTEST_API __global
+# define LIBTEST_INTERNAL_API __hidden
+# define LIBTEST_API_DEPRECATED __global
+# define LIBTEST_LOCAL __hidden
+# elif defined(_MSC_VER)
+# define LIBTEST_API extern __declspec(dllexport)
+# define LIBTEST_INTERNAL_API extern __declspec(dllexport)
+# define LIBTEST_DEPRECATED_API extern __declspec(dllexport)
+# define LIBTEST_LOCAL
+# endif /* defined(HAVE_VISIBILITY) */
+#else /* defined(BUILDING_LIBTEST) */
+# if defined(_MSC_VER)
+# define LIBTEST_API extern __declspec(dllimport)
+# define LIBTEST_INTERNAL_API extern __declspec(dllimport)
+# define LIBTEST_API_DEPRECATED extern __declspec(dllimport)
+# define LIBTEST_LOCAL
+# else
+# define LIBTEST_API
+# define LIBTEST_INTERNAL_API
+# define LIBTEST_API_DEPRECATED
+# define LIBTEST_LOCAL
+# endif /* defined(_MSC_VER) */
+#endif /* defined(BUILDING_LIBTEST) */
tests/hash_results.h \
tests/ketama_test_cases.h \
tests/ketama_test_cases_spy.h \
- tests/libmemcached_world.h
+ tests/libmemcached_world.h \
+ tests/parser.h \
+ tests/print.h
noinst_PROGRAMS+= \
tests/atomsmasher \
tests/testudp
tests_testapp_CFLAGS= $(AM_CFLAGS) $(NO_CONVERSION) $(NO_STRICT_ALIASING)
-tests_testapp_SOURCES= tests/mem_functions.c
+tests_testapp_SOURCES= \
+ tests/mem_functions.c \
+ tests/parser.cc \
+ tests/print.cc
+
tests_testapp_DEPENDENCIES= \
$(BUILT_SOURCES) \
clients/libgenexec.la \
#define SMALL_STRING_LEN 1024
#include <libtest/test.h>
+#include "tests/parser.h"
+#include "tests/print.h"
#ifdef HAVE_LIBMEMCACHEDUTIL
return TEST_SUCCESS;
}
-static memcached_return_t server_print_callback(const memcached_st *ptr,
- const memcached_server_st *server,
- void *context)
-{
- (void)server; // Just in case we aren't printing.
- (void)ptr;
- (void)context;
-
-#if 0
- fprintf(stderr, "%s(%d)", memcached_server_name(server), memcached_server_port(server));
-#endif
-
- return MEMCACHED_SUCCESS;
-}
-
static test_return_t memcached_server_remove_test(memcached_st *ptr)
{
memcached_return_t rc;
{0, 0, (test_callback_fn)0}
};
+
+test_st parser_tests[] ={
+ {"server", 0, (test_callback_fn)server_test },
+ {"servers", 0, (test_callback_fn)servers_test },
+ {0, 0, (test_callback_fn)0}
+};
+
collection_st collection[] ={
#if 0
{"hash_sanity", 0, 0, hash_sanity},
{"behaviors", 0, 0, behavior_tests},
{"regression_binary_vs_block", (test_callback_fn)key_setup, (test_callback_fn)key_teardown, regression_binary_vs_block},
{"error_conditions", 0, 0, error_conditions},
+ {"parser", 0, 0, parser_tests},
{0, 0, 0, 0}
};
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Gearmand client and server library.
+ *
+ * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <config.h>
+
+#include <libmemcached/memcached.h>
+
+#include "tests/parser.h"
+#include "tests/print.h"
+
+struct scanner_string_st {
+ const char *c_ptr;
+ size_t size;
+};
+
+test_return_t server_test(memcached_st *junk)
+{
+ (void)junk;
+ memcached_return_t rc;
+ memcached_st *memc;
+ memc= memcached_create(NULL);
+
+ scanner_string_st test_strings[]= {
+ { STRING_WITH_LEN("--server=localhost") },
+ { STRING_WITH_LEN("--server=10.0.2.1") },
+ { STRING_WITH_LEN("--server=example.com") },
+ { STRING_WITH_LEN("--server=localhost:30") },
+ { STRING_WITH_LEN("--server=10.0.2.1:20") },
+ { STRING_WITH_LEN("--server=example.com:1024") },
+ { NULL, 0}
+ };
+
+ for (scanner_string_st *ptr= test_strings; ptr->size; ptr++)
+ {
+ rc= memcached_parse_options(memc, ptr->c_ptr, ptr->size);
+ test_true(rc == MEMCACHED_SUCCESS);
+ memcached_servers_reset(memc);
+ }
+
+ memcached_free(memc);
+
+ return TEST_SUCCESS;
+}
+
+test_return_t servers_test(memcached_st *junk)
+{
+ (void)junk;
+ memcached_st *memc;
+ memc= memcached_create(NULL);
+
+ scanner_string_st test_strings[]= {
+ { STRING_WITH_LEN("--servers=localhost:11221,localhost:11222,localhost:11223,localhost:11224,localhost:11225") },
+ { STRING_WITH_LEN("--servers=a.example.com:80,localhost:80,b.example.com") },
+ { STRING_WITH_LEN("--servers=localhost,localhost:80") },
+ { NULL, 0}
+ };
+
+ for (scanner_string_st *ptr= test_strings; ptr->size; ptr++)
+ {
+ memcached_return_t rc;
+ rc= memcached_parse_options(memc, ptr->c_ptr, ptr->size);
+
+ test_true(rc == MEMCACHED_SUCCESS);
+
+ memcached_server_fn callbacks[1];
+ callbacks[0]= server_print_callback;
+ memcached_server_cursor(memc, callbacks, memc, 1);
+
+ memcached_servers_reset(memc);
+ }
+
+ memcached_free(memc);
+
+ return TEST_SUCCESS;
+}
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Gearmand client and server library.
+ *
+ * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#pragma once
+
+#include <libtest/test.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+LIBTEST_INTERNAL_API
+test_return_t server_test(memcached_st *memc);
+
+LIBTEST_INTERNAL_API
+test_return_t servers_test(memcached_st *memc);
+
+#ifdef __cplusplus
+}
+#endif
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Gearmand client and server library.
+ *
+ * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <config.h>
+
+#include <iostream>
+
+#include <libmemcached/memcached.h>
+#include <libtest/test.h>
+
+#include "tests/print.h"
+
+memcached_return_t server_print_callback(const memcached_st *ptr,
+ const memcached_server_st *server,
+ void *context)
+{
+ (void)ptr;
+
+ if (context)
+ {
+ std::cerr << memcached_server_name(server) << ":" << memcached_server_port(server) << std::endl;
+ }
+
+ return MEMCACHED_SUCCESS;
+}
--- /dev/null
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * Gearmand client and server library.
+ *
+ * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+LIBTEST_INTERNAL_API
+memcached_return_t server_print_callback(const memcached_st *ptr,
+ const memcached_server_st *server,
+ void *context);
+
+#ifdef __cplusplus
+}
+#endif