dalli_memcached 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. data/BENCHMARKS +142 -0
  2. data/CHANGELOG +176 -0
  3. data/Gemfile +11 -0
  4. data/Gemfile.lock +45 -0
  5. data/LICENSE +184 -0
  6. data/Manifest +209 -0
  7. data/README.rdoc +124 -0
  8. data/Rakefile +134 -0
  9. data/TODO +1 -0
  10. data/dalli_memcached.gemspec +0 -0
  11. data/ext/extconf-make.rb +25 -0
  12. data/ext/extconf.rb +78 -0
  13. data/ext/libmemcached-0.32/AUTHORS +7 -0
  14. data/ext/libmemcached-0.32/COPYING +32 -0
  15. data/ext/libmemcached-0.32/ChangeLog +303 -0
  16. data/ext/libmemcached-0.32/INSTALL +302 -0
  17. data/ext/libmemcached-0.32/Makefile.am +36 -0
  18. data/ext/libmemcached-0.32/Makefile.in +911 -0
  19. data/ext/libmemcached-0.32/NEWS +1 -0
  20. data/ext/libmemcached-0.32/README +33 -0
  21. data/ext/libmemcached-0.32/THANKS +14 -0
  22. data/ext/libmemcached-0.32/TODO +11 -0
  23. data/ext/libmemcached-0.32/aclocal.m4 +2108 -0
  24. data/ext/libmemcached-0.32/clients/Makefile.am +80 -0
  25. data/ext/libmemcached-0.32/clients/Makefile.in +773 -0
  26. data/ext/libmemcached-0.32/clients/client_options.h +32 -0
  27. data/ext/libmemcached-0.32/clients/execute.c +64 -0
  28. data/ext/libmemcached-0.32/clients/execute.h +5 -0
  29. data/ext/libmemcached-0.32/clients/generator.c +74 -0
  30. data/ext/libmemcached-0.32/clients/generator.h +20 -0
  31. data/ext/libmemcached-0.32/clients/memcat.c +178 -0
  32. data/ext/libmemcached-0.32/clients/memcp.c +251 -0
  33. data/ext/libmemcached-0.32/clients/memdump.c +170 -0
  34. data/ext/libmemcached-0.32/clients/memerror.c +80 -0
  35. data/ext/libmemcached-0.32/clients/memflush.c +143 -0
  36. data/ext/libmemcached-0.32/clients/memrm.c +160 -0
  37. data/ext/libmemcached-0.32/clients/memslap.c +441 -0
  38. data/ext/libmemcached-0.32/clients/memstat.c +326 -0
  39. data/ext/libmemcached-0.32/clients/utilities.c +207 -0
  40. data/ext/libmemcached-0.32/clients/utilities.h +41 -0
  41. data/ext/libmemcached-0.32/config.h.in +254 -0
  42. data/ext/libmemcached-0.32/config/compile +143 -0
  43. data/ext/libmemcached-0.32/config/config.guess +1561 -0
  44. data/ext/libmemcached-0.32/config/config.rpath +666 -0
  45. data/ext/libmemcached-0.32/config/config.sub +1686 -0
  46. data/ext/libmemcached-0.32/config/depcomp +630 -0
  47. data/ext/libmemcached-0.32/config/install-sh +520 -0
  48. data/ext/libmemcached-0.32/config/ltmain.sh +9636 -0
  49. data/ext/libmemcached-0.32/config/missing +376 -0
  50. data/ext/libmemcached-0.32/configure +23843 -0
  51. data/ext/libmemcached-0.32/configure.ac +120 -0
  52. data/ext/libmemcached-0.32/libmemcached/Makefile.am +111 -0
  53. data/ext/libmemcached-0.32/libmemcached/Makefile.in +1069 -0
  54. data/ext/libmemcached-0.32/libmemcached/byteorder.c +31 -0
  55. data/ext/libmemcached-0.32/libmemcached/common.h +189 -0
  56. data/ext/libmemcached-0.32/libmemcached/crc.c +86 -0
  57. data/ext/libmemcached-0.32/libmemcached/hsieh_hash.c +68 -0
  58. data/ext/libmemcached-0.32/libmemcached/jenkins_hash.c +213 -0
  59. data/ext/libmemcached-0.32/libmemcached/libmemcached.ver +1 -0
  60. data/ext/libmemcached-0.32/libmemcached/libmemcached_probes.d +30 -0
  61. data/ext/libmemcached-0.32/libmemcached/libmemcached_probes.h +82 -0
  62. data/ext/libmemcached-0.32/libmemcached/md5.c +354 -0
  63. data/ext/libmemcached-0.32/libmemcached/memcached.c +153 -0
  64. data/ext/libmemcached-0.32/libmemcached/memcached.h +305 -0
  65. data/ext/libmemcached-0.32/libmemcached/memcached.hpp +799 -0
  66. data/ext/libmemcached-0.32/libmemcached/memcached/README.txt +7 -0
  67. data/ext/libmemcached-0.32/libmemcached/memcached/protocol_binary.h +385 -0
  68. data/ext/libmemcached-0.32/libmemcached/memcached_allocators.c +72 -0
  69. data/ext/libmemcached-0.32/libmemcached/memcached_analyze.c +100 -0
  70. data/ext/libmemcached-0.32/libmemcached/memcached_auto.c +207 -0
  71. data/ext/libmemcached-0.32/libmemcached/memcached_behavior.c +290 -0
  72. data/ext/libmemcached-0.32/libmemcached/memcached_callback.c +175 -0
  73. data/ext/libmemcached-0.32/libmemcached/memcached_configure.h.in +23 -0
  74. data/ext/libmemcached-0.32/libmemcached/memcached_connect.c +371 -0
  75. data/ext/libmemcached-0.32/libmemcached/memcached_constants.h +146 -0
  76. data/ext/libmemcached-0.32/libmemcached/memcached_delete.c +0 -0
  77. data/ext/libmemcached-0.32/libmemcached/memcached_do.c +72 -0
  78. data/ext/libmemcached-0.32/libmemcached/memcached_dump.c +79 -0
  79. data/ext/libmemcached-0.32/libmemcached/memcached_exist.c +114 -0
  80. data/ext/libmemcached-0.32/libmemcached/memcached_exist.h +20 -0
  81. data/ext/libmemcached-0.32/libmemcached/memcached_fetch.c +102 -0
  82. data/ext/libmemcached-0.32/libmemcached/memcached_flush.c +89 -0
  83. data/ext/libmemcached-0.32/libmemcached/memcached_flush_buffers.c +23 -0
  84. data/ext/libmemcached-0.32/libmemcached/memcached_get.c +494 -0
  85. data/ext/libmemcached-0.32/libmemcached/memcached_get.h +87 -0
  86. data/ext/libmemcached-0.32/libmemcached/memcached_hash.c +252 -0
  87. data/ext/libmemcached-0.32/libmemcached/memcached_hosts.c +510 -0
  88. data/ext/libmemcached-0.32/libmemcached/memcached_internal.h +31 -0
  89. data/ext/libmemcached-0.32/libmemcached/memcached_io.c +594 -0
  90. data/ext/libmemcached-0.32/libmemcached/memcached_io.h +72 -0
  91. data/ext/libmemcached-0.32/libmemcached/memcached_key.c +28 -0
  92. data/ext/libmemcached-0.32/libmemcached/memcached_parse.c +74 -0
  93. data/ext/libmemcached-0.32/libmemcached/memcached_pool.h +38 -0
  94. data/ext/libmemcached-0.32/libmemcached/memcached_purge.c +76 -0
  95. data/ext/libmemcached-0.32/libmemcached/memcached_quit.c +75 -0
  96. data/ext/libmemcached-0.32/libmemcached/memcached_response.c +529 -0
  97. data/ext/libmemcached-0.32/libmemcached/memcached_result.c +57 -0
  98. data/ext/libmemcached-0.32/libmemcached/memcached_result.h +59 -0
  99. data/ext/libmemcached-0.32/libmemcached/memcached_sasl.c +225 -0
  100. data/ext/libmemcached-0.32/libmemcached/memcached_sasl.h +44 -0
  101. data/ext/libmemcached-0.32/libmemcached/memcached_server.c +159 -0
  102. data/ext/libmemcached-0.32/libmemcached/memcached_server.h +93 -0
  103. data/ext/libmemcached-0.32/libmemcached/memcached_stats.c +437 -0
  104. data/ext/libmemcached-0.32/libmemcached/memcached_storage.c +514 -0
  105. data/ext/libmemcached-0.32/libmemcached/memcached_storage.h +107 -0
  106. data/ext/libmemcached-0.32/libmemcached/memcached_strerror.c +92 -0
  107. data/ext/libmemcached-0.32/libmemcached/memcached_string.c +138 -0
  108. data/ext/libmemcached-0.32/libmemcached/memcached_string.h +53 -0
  109. data/ext/libmemcached-0.32/libmemcached/memcached_touch.c +60 -0
  110. data/ext/libmemcached-0.32/libmemcached/memcached_touch.h +31 -0
  111. data/ext/libmemcached-0.32/libmemcached/memcached_types.h +44 -0
  112. data/ext/libmemcached-0.32/libmemcached/memcached_util.h +15 -0
  113. data/ext/libmemcached-0.32/libmemcached/memcached_verbosity.c +36 -0
  114. data/ext/libmemcached-0.32/libmemcached/memcached_version.c +112 -0
  115. data/ext/libmemcached-0.32/libmemcached/memcached_watchpoint.h +38 -0
  116. data/ext/libmemcached-0.32/libmemcached/murmur_hash.c +76 -0
  117. data/ext/libmemcached-0.32/libmemcached/visibility.h +51 -0
  118. data/ext/libmemcached-0.32/libmemcachedutil/Makefile.am +11 -0
  119. data/ext/libmemcached-0.32/libmemcachedutil/Makefile.in +604 -0
  120. data/ext/libmemcached-0.32/libmemcachedutil/libmemcachedutil.ver +1 -0
  121. data/ext/libmemcached-0.32/libmemcachedutil/memcached_pool.c +170 -0
  122. data/ext/libmemcached-0.32/m4/ac_cxx_compile_stdcxx_0x.m4 +103 -0
  123. data/ext/libmemcached-0.32/m4/ac_cxx_header_stdcxx_98.m4 +67 -0
  124. data/ext/libmemcached-0.32/m4/acx_pthread.m4 +276 -0
  125. data/ext/libmemcached-0.32/m4/byteorder.m4 +40 -0
  126. data/ext/libmemcached-0.32/m4/deprecated.m4 +17 -0
  127. data/ext/libmemcached-0.32/m4/enable_utillib.m4 +16 -0
  128. data/ext/libmemcached-0.32/m4/extensions.m4 +94 -0
  129. data/ext/libmemcached-0.32/m4/hsieh.m4 +18 -0
  130. data/ext/libmemcached-0.32/m4/lib-prefix.m4 +221 -0
  131. data/ext/libmemcached-0.32/m4/libtool.m4 +7831 -0
  132. data/ext/libmemcached-0.32/m4/ltoptions.m4 +369 -0
  133. data/ext/libmemcached-0.32/m4/ltsugar.m4 +123 -0
  134. data/ext/libmemcached-0.32/m4/ltversion.m4 +23 -0
  135. data/ext/libmemcached-0.32/m4/lt~obsolete.m4 +98 -0
  136. data/ext/libmemcached-0.32/m4/memcached.m4 +30 -0
  137. data/ext/libmemcached-0.32/m4/pandora_64bit.m4 +55 -0
  138. data/ext/libmemcached-0.32/m4/pandora_canonical.m4 +151 -0
  139. data/ext/libmemcached-0.32/m4/pandora_check_compiler_version.m4 +37 -0
  140. data/ext/libmemcached-0.32/m4/pandora_check_cxx_standard.m4 +16 -0
  141. data/ext/libmemcached-0.32/m4/pandora_enable_dtrace.m4 +41 -0
  142. data/ext/libmemcached-0.32/m4/pandora_ensure_gcc_version.m4 +36 -0
  143. data/ext/libmemcached-0.32/m4/pandora_have_better_malloc.m4 +54 -0
  144. data/ext/libmemcached-0.32/m4/pandora_have_sasl.m4 +133 -0
  145. data/ext/libmemcached-0.32/m4/pandora_header_assert.m4 +23 -0
  146. data/ext/libmemcached-0.32/m4/pandora_libtool.m4 +15 -0
  147. data/ext/libmemcached-0.32/m4/pandora_optimize.m4 +79 -0
  148. data/ext/libmemcached-0.32/m4/pandora_shared_ptr.m4 +56 -0
  149. data/ext/libmemcached-0.32/m4/pandora_vc_build.m4 +32 -0
  150. data/ext/libmemcached-0.32/m4/pandora_warnings.m4 +262 -0
  151. data/ext/libmemcached-0.32/m4/pod2man.m4 +7 -0
  152. data/ext/libmemcached-0.32/m4/protocol_binary.m4 +23 -0
  153. data/ext/libmemcached-0.32/m4/setsockopt.m4 +57 -0
  154. data/ext/libmemcached-0.32/m4/visibility.m4 +52 -0
  155. data/ext/libmemcached-0.32/support/Makefile.am +4 -0
  156. data/ext/libmemcached-0.32/support/Makefile.in +487 -0
  157. data/ext/libmemcached-0.32/support/libmemcached-fc.spec.in +105 -0
  158. data/ext/libmemcached-0.32/support/libmemcached.pc.in +10 -0
  159. data/ext/libmemcached-0.32/support/libmemcached.spec +105 -0
  160. data/ext/libmemcached-0.32/support/libmemcached.spec.in +105 -0
  161. data/ext/libmemcached-0.32/support/set_benchmark.sh +5 -0
  162. data/ext/libmemcached-0.32/tests/Makefile.am +113 -0
  163. data/ext/libmemcached-0.32/tests/Makefile.in +762 -0
  164. data/ext/libmemcached-0.32/tests/atomsmasher.c +245 -0
  165. data/ext/libmemcached-0.32/tests/function.c +4904 -0
  166. data/ext/libmemcached-0.32/tests/ketama_test_cases.h +108 -0
  167. data/ext/libmemcached-0.32/tests/output.cmp +7 -0
  168. data/ext/libmemcached-0.32/tests/output.res +7 -0
  169. data/ext/libmemcached-0.32/tests/output2.res +46 -0
  170. data/ext/libmemcached-0.32/tests/plus.cpp +293 -0
  171. data/ext/libmemcached-0.32/tests/r/memcat.res +19 -0
  172. data/ext/libmemcached-0.32/tests/r/memcp.res +27 -0
  173. data/ext/libmemcached-0.32/tests/r/memrm.res +19 -0
  174. data/ext/libmemcached-0.32/tests/r/memslap.res +33 -0
  175. data/ext/libmemcached-0.32/tests/r/memstat.res +33 -0
  176. data/ext/libmemcached-0.32/tests/server.c +118 -0
  177. data/ext/libmemcached-0.32/tests/server.h +25 -0
  178. data/ext/libmemcached-0.32/tests/start.c +16 -0
  179. data/ext/libmemcached-0.32/tests/t/memcat.test +4 -0
  180. data/ext/libmemcached-0.32/tests/t/memcp.test +3 -0
  181. data/ext/libmemcached-0.32/tests/t/memrm.test +3 -0
  182. data/ext/libmemcached-0.32/tests/t/memslap.test +5 -0
  183. data/ext/libmemcached-0.32/tests/t/memstat.test +3 -0
  184. data/ext/libmemcached-0.32/tests/test.c +137 -0
  185. data/ext/libmemcached-0.32/tests/test.h +46 -0
  186. data/ext/libmemcached-0.32/tests/udp.c +76 -0
  187. data/ext/rlibmemcached.i +258 -0
  188. data/ext/rlibmemcached_wrap.c +13917 -0
  189. data/lib/memcached.rb +33 -0
  190. data/lib/memcached/auth.rb +16 -0
  191. data/lib/memcached/behaviors.rb +78 -0
  192. data/lib/memcached/exceptions.rb +84 -0
  193. data/lib/memcached/experimental.rb +48 -0
  194. data/lib/memcached/marshal_codec.rb +10 -0
  195. data/lib/memcached/memcached.rb +732 -0
  196. data/lib/memcached/rails.rb +250 -0
  197. data/test/profile/benchmark.rb +280 -0
  198. data/test/profile/c_profiler.rb +14 -0
  199. data/test/profile/exercise.rb +185 -0
  200. data/test/profile/rb_profiler.rb +21 -0
  201. data/test/profile/valgrind.rb +10 -0
  202. data/test/setup.rb +30 -0
  203. data/test/teardown.rb +0 -0
  204. data/test/test_helper.rb +18 -0
  205. data/test/unit/binding_test.rb +8 -0
  206. data/test/unit/memcached_experimental_test.rb +272 -0
  207. data/test/unit/memcached_test.rb +1487 -0
  208. data/test/unit/rails_test.rb +330 -0
  209. metadata +347 -0
@@ -0,0 +1,207 @@
1
+ #include "libmemcached/common.h"
2
+ #include <stdio.h>
3
+ #include <ctype.h>
4
+ #include <string.h>
5
+ #include "utilities.h"
6
+
7
+
8
+ long int timedif(struct timeval a, struct timeval b)
9
+ {
10
+ register int us, s;
11
+
12
+ us = (int)(a.tv_usec - b.tv_usec);
13
+ us /= 1000;
14
+ s = (int)(a.tv_sec - b.tv_sec);
15
+ s *= 1000;
16
+ return s + us;
17
+ }
18
+
19
+ void version_command(const char *command_name)
20
+ {
21
+ printf("%s v%u.%u\n", command_name, 1, 0);
22
+ exit(0);
23
+ }
24
+
25
+ static const char *lookup_help(memcached_options option)
26
+ {
27
+ switch (option)
28
+ {
29
+ case OPT_SERVERS: return("List which servers you wish to connect to.");
30
+ case OPT_VERSION: return("Display the version of the application and then exit.");
31
+ case OPT_HELP: return("Diplay this message and then exit.");
32
+ case OPT_VERBOSE: return("Give more details on the progression of the application.");
33
+ case OPT_DEBUG: return("Provide output only useful for debugging.");
34
+ case OPT_FLAG: return("Provide flag information for storage operation.");
35
+ case OPT_EXPIRE: return("Set the expire option for the object.");
36
+ case OPT_SET: return("Use set command with memcached when storing.");
37
+ case OPT_REPLACE: return("Use replace command with memcached when storing.");
38
+ case OPT_ADD: return("Use add command with memcached when storing.");
39
+ case OPT_SLAP_EXECUTE_NUMBER: return("Number of times to execute the given test.");
40
+ case OPT_SLAP_INITIAL_LOAD: return("Number of key pairs to load before executing tests.");
41
+ case OPT_SLAP_TEST: return("Test to run (currently \"get\" or \"set\").");
42
+ case OPT_SLAP_CONCURRENCY: return("Number of users to simulate with load.");
43
+ case OPT_SLAP_NON_BLOCK: return("Set TCP up to use non-blocking IO.");
44
+ case OPT_SLAP_TCP_NODELAY: return("Set TCP socket up to use nodelay.");
45
+ case OPT_FLUSH: return("Flush servers before running tests.");
46
+ case OPT_HASH: return("Select hash type.");
47
+ case OPT_BINARY: return("Switch to binary protocol.");
48
+ case OPT_ANALYZE: return("Analyze the provided servers.");
49
+ case OPT_UDP: return("Use UDP protocol when communicating with server.");
50
+ case OPT_USERNAME: return "Username to use for SASL authentication";
51
+ case OPT_PASSWD: return "Password to use for SASL authentication";
52
+ default: WATCHPOINT_ASSERT(0);
53
+ };
54
+
55
+ WATCHPOINT_ASSERT(0);
56
+ return "forgot to document this function :)";
57
+ }
58
+
59
+ void help_command(const char *command_name, const char *description,
60
+ const struct option *long_options,
61
+ memcached_programs_help_st *options __attribute__((unused)))
62
+ {
63
+ unsigned int x;
64
+
65
+ printf("%s v%u.%u\n\n", command_name, 1, 0);
66
+ printf("\t%s\n\n", description);
67
+ printf("Current options. A '=' means the option takes a value.\n\n");
68
+
69
+ for (x= 0; long_options[x].name; x++)
70
+ {
71
+ const char *help_message;
72
+
73
+ printf("\t --%s%c\n", long_options[x].name,
74
+ long_options[x].has_arg ? '=' : ' ');
75
+ if ((help_message= lookup_help(long_options[x].val)))
76
+ printf("\t\t%s\n", help_message);
77
+ }
78
+
79
+ printf("\n");
80
+ exit(0);
81
+ }
82
+
83
+ void process_hash_option(memcached_st *memc, char *opt_hash)
84
+ {
85
+ uint64_t set;
86
+ memcached_return rc;
87
+
88
+ if (opt_hash == NULL)
89
+ return;
90
+
91
+ set= MEMCACHED_HASH_DEFAULT; /* Just here to solve warning */
92
+ if (!strcasecmp(opt_hash, "CRC"))
93
+ set= MEMCACHED_HASH_CRC;
94
+ else if (!strcasecmp(opt_hash, "FNV1_64"))
95
+ set= MEMCACHED_HASH_FNV1_64;
96
+ else if (!strcasecmp(opt_hash, "FNV1A_64"))
97
+ set= MEMCACHED_HASH_FNV1A_64;
98
+ else if (!strcasecmp(opt_hash, "FNV1_32"))
99
+ set= MEMCACHED_HASH_FNV1_32;
100
+ else if (!strcasecmp(opt_hash, "FNV1A_32"))
101
+ set= MEMCACHED_HASH_FNV1A_32;
102
+ else if (!strcasecmp(opt_hash, "NONE"))
103
+ set= MEMCACHED_HASH_NONE;
104
+ else
105
+ {
106
+ fprintf(stderr, "hash: type not recognized %s\n", opt_hash);
107
+ exit(1);
108
+ }
109
+
110
+ rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, set);
111
+ if (rc != MEMCACHED_SUCCESS)
112
+ {
113
+ fprintf(stderr, "hash: memcache error %s\n", memcached_strerror(memc, rc));
114
+ exit(1);
115
+ }
116
+ }
117
+
118
+ static char *username;
119
+ static char *passwd;
120
+
121
+ #ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
122
+ static int get_username(void *context, int id, const char **result,
123
+ unsigned int *len)
124
+ {
125
+ (void)context;
126
+ if (!result || (id != SASL_CB_USER && id != SASL_CB_AUTHNAME))
127
+ return SASL_BADPARAM;
128
+
129
+ *result= username;
130
+ if (len)
131
+ *len= (username == NULL) ? 0 : (unsigned int)strlen(username);
132
+
133
+ return SASL_OK;
134
+ }
135
+
136
+ static int get_password(sasl_conn_t *conn, void *context, int id,
137
+ sasl_secret_t **psecret)
138
+ {
139
+ (void)context;
140
+ static sasl_secret_t* x;
141
+
142
+ if (!conn || ! psecret || id != SASL_CB_PASS)
143
+ return SASL_BADPARAM;
144
+
145
+ if (passwd == NULL)
146
+ {
147
+ *psecret= NULL;
148
+ return SASL_OK;
149
+ }
150
+
151
+ size_t len= strlen(passwd);
152
+ x = realloc(x, sizeof(sasl_secret_t) + len);
153
+ if (!x)
154
+ return SASL_NOMEM;
155
+
156
+ x->len = len;
157
+ strcpy((void *)x->data, passwd);
158
+
159
+ *psecret = x;
160
+ return SASL_OK;
161
+ }
162
+
163
+ /* callbacks we support */
164
+ static sasl_callback_t sasl_callbacks[] = {
165
+ {
166
+ SASL_CB_USER, &get_username, NULL
167
+ }, {
168
+ SASL_CB_AUTHNAME, &get_username, NULL
169
+ }, {
170
+ SASL_CB_PASS, &get_password, NULL
171
+ }, {
172
+ SASL_CB_LIST_END, NULL, NULL
173
+ }
174
+ };
175
+ #endif
176
+
177
+ bool initialize_sasl(memcached_st *memc, char *user, char *password)
178
+ {
179
+ #ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
180
+ if (user != NULL && password != NULL)
181
+ {
182
+ username= user;
183
+ passwd= password;
184
+
185
+ if (sasl_client_init(NULL) != SASL_OK)
186
+ {
187
+ fprintf(stderr, "Failed to initialize sasl library!\n");
188
+ return false;
189
+ }
190
+ memcached_set_sasl_callbacks(memc, sasl_callbacks);
191
+ }
192
+ #else
193
+ (void)memc;
194
+ (void)user;
195
+ (void)passwd;
196
+ #endif
197
+
198
+ return true;
199
+ }
200
+
201
+ void shutdown_sasl(void)
202
+ {
203
+ #if LIBMEMCACHED_WITH_SASL_SUPPORT
204
+ if (username != NULL || passwd != NULL)
205
+ sasl_done();
206
+ #endif
207
+ }
@@ -0,0 +1,41 @@
1
+ #include <getopt.h>
2
+ #include <libmemcached/memcached.h>
3
+ #include "client_options.h"
4
+
5
+ #if TIME_WITH_SYS_TIME
6
+ # include <sys/time.h>
7
+ # include <time.h>
8
+ #else
9
+ # if HAVE_SYS_TIME_H
10
+ # include <sys/time.h>
11
+ # else
12
+ # include <time.h>
13
+ # endif
14
+ #endif
15
+
16
+ #ifdef __sun
17
+ /* For some odd reason the option struct on solaris defines the argument
18
+ * as char* and not const char*
19
+ */
20
+ #define OPTIONSTRING char*
21
+ #else
22
+ #define OPTIONSTRING const char*
23
+ #endif
24
+
25
+ typedef struct memcached_programs_help_st memcached_programs_help_st;
26
+
27
+ struct memcached_programs_help_st
28
+ {
29
+ char *not_used_yet;
30
+ };
31
+
32
+ char *strdup_cleanup(const char *str);
33
+ void cleanup(void);
34
+ long int timedif(struct timeval a, struct timeval b);
35
+ void version_command(const char *command_name);
36
+ void help_command(const char *command_name, const char *description,
37
+ const struct option *long_options,
38
+ memcached_programs_help_st *options);
39
+ void process_hash_option(memcached_st *memc, char *opt_hash);
40
+ bool initialize_sasl(memcached_st *memc, char *user, char *password);
41
+ void shutdown_sasl(void);
@@ -0,0 +1,254 @@
1
+ /* config.h.in. Generated from configure.ac by autoheader. */
2
+
3
+ /* Define if building universal (internal helper macro) */
4
+ #undef AC_APPLE_UNIVERSAL_BUILD
5
+
6
+ /* Enable big endian byteorder */
7
+ #undef BYTEORDER_BIG_ENDIAN
8
+
9
+ /* Enable little endian byteorder */
10
+ #undef BYTEORDER_LITTLE_ENDIAN
11
+
12
+ /* Define to 1 if you have the <assert.h> header file. */
13
+ #undef HAVE_ASSERT_H
14
+
15
+ /* Define to 1 if you have the <boost/shared_ptr.hpp> header file. */
16
+ #undef HAVE_BOOST_SHARED_PTR_HPP
17
+
18
+ /* Define to 1 if you have the <dlfcn.h> header file. */
19
+ #undef HAVE_DLFCN_H
20
+
21
+ /* Enables DTRACE Support */
22
+ #undef HAVE_DTRACE
23
+
24
+ /* Enables hsieh hashing support */
25
+ #undef HAVE_HSIEH_HASH
26
+
27
+ /* Have ntohll */
28
+ #undef HAVE_HTONLL
29
+
30
+ /* Define to 1 if you have the <inttypes.h> header file. */
31
+ #undef HAVE_INTTYPES_H
32
+
33
+ /* Define to 1 if you have the `c_p' library (-lc_p). */
34
+ #undef HAVE_LIBC_P
35
+
36
+ /* Enables libmemcachedutil Support */
37
+ #undef HAVE_LIBMEMCACHEDUTIL
38
+
39
+ /* Define to 1 if you have the `mtmalloc' library (-lmtmalloc). */
40
+ #undef HAVE_LIBMTMALLOC
41
+
42
+ /* Define if you have the libsasl library. */
43
+ #undef HAVE_LIBSASL
44
+
45
+ /* Define if you have the libsasl2 library. */
46
+ #undef HAVE_LIBSASL2
47
+
48
+ /* Define to 1 if you have the `tcmalloc' library (-ltcmalloc). */
49
+ #undef HAVE_LIBTCMALLOC
50
+
51
+ /* Define to 1 if you have the `tcmalloc-minimal' library
52
+ (-ltcmalloc-minimal). */
53
+ #undef HAVE_LIBTCMALLOC_MINIMAL
54
+
55
+ /* Define to 1 if you have the `umem' library (-lumem). */
56
+ #undef HAVE_LIBUMEM
57
+
58
+ /* Define to 1 if your system has a GNU libc compatible `malloc' function, and
59
+ to 0 otherwise. */
60
+ #undef HAVE_MALLOC
61
+
62
+ /* Define to 1 if you have the <memory> header file. */
63
+ #undef HAVE_MEMORY
64
+
65
+ /* Define to 1 if you have the <memory.h> header file. */
66
+ #undef HAVE_MEMORY_H
67
+
68
+ /* Define if you have POSIX threads libraries and header files. */
69
+ #undef HAVE_PTHREAD
70
+
71
+ /* Define to 1 if you have a working SO_RCVTIMEO */
72
+ #undef HAVE_RCVTIMEO
73
+
74
+ /* Define to 1 if your system has a GNU libc compatible `realloc' function,
75
+ and to 0 otherwise. */
76
+ #undef HAVE_REALLOC
77
+
78
+ /* Define to 1 if you have a working SO_SNDTIMEO */
79
+ #undef HAVE_SNDTIMEO
80
+
81
+ /* Define if g++ supports C++0x features. */
82
+ #undef HAVE_STDCXX_0X
83
+
84
+ /* Define to 1 if you have the <stdint.h> header file. */
85
+ #undef HAVE_STDINT_H
86
+
87
+ /* Define to 1 if you have the <stdlib.h> header file. */
88
+ #undef HAVE_STDLIB_H
89
+
90
+ /* Define to 1 if you have the <strings.h> header file. */
91
+ #undef HAVE_STRINGS_H
92
+
93
+ /* Define to 1 if you have the <string.h> header file. */
94
+ #undef HAVE_STRING_H
95
+
96
+ /* Define to 1 if you have the <sys/stat.h> header file. */
97
+ #undef HAVE_SYS_STAT_H
98
+
99
+ /* Define to 1 if you have the <sys/types.h> header file. */
100
+ #undef HAVE_SYS_TYPES_H
101
+
102
+ /* Define to 1 if you have the <tr1/memory> header file. */
103
+ #undef HAVE_TR1_MEMORY
104
+
105
+ /* Define to 1 if you have the <unistd.h> header file. */
106
+ #undef HAVE_UNISTD_H
107
+
108
+ /* Define to 1 or 0, depending whether the compiler supports simple visibility
109
+ declarations. */
110
+ #undef HAVE_VISIBILITY
111
+
112
+ /* Define to the sub-directory in which libtool stores uninstalled libraries.
113
+ */
114
+ #undef LT_OBJDIR
115
+
116
+ /* Name of the memcached binary used in make test */
117
+ #undef MEMCACHED_BINARY
118
+
119
+ /* Define to 1 if assertions should be disabled. */
120
+ #undef NDEBUG
121
+
122
+ /* Name of package */
123
+ #undef PACKAGE
124
+
125
+ /* Define to the address where bug reports for this package should be sent. */
126
+ #undef PACKAGE_BUGREPORT
127
+
128
+ /* Define to the full name of this package. */
129
+ #undef PACKAGE_NAME
130
+
131
+ /* Define to the full name and version of this package. */
132
+ #undef PACKAGE_STRING
133
+
134
+ /* Define to the one symbol short name of this package. */
135
+ #undef PACKAGE_TARNAME
136
+
137
+ /* Define to the home page for this package. */
138
+ #undef PACKAGE_URL
139
+
140
+ /* Define to the version of this package. */
141
+ #undef PACKAGE_VERSION
142
+
143
+ /* Define to necessary symbol if this constant uses a non-standard name on
144
+ your system. */
145
+ #undef PTHREAD_CREATE_JOINABLE
146
+
147
+ /* The namespace in which SHARED_PTR can be found */
148
+ #undef SHARED_PTR_NAMESPACE
149
+
150
+ /* Define if ISO C++ 1998 header files are present. */
151
+ #undef STDCXX_98_HEADERS
152
+
153
+ /* Define to 1 if you have the ANSI C header files. */
154
+ #undef STDC_HEADERS
155
+
156
+ /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
157
+ #undef TIME_WITH_SYS_TIME
158
+
159
+ /* Version number of package */
160
+ #undef VERSION
161
+
162
+ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
163
+ significant byte first (like Motorola and SPARC, unlike Intel). */
164
+ #if defined AC_APPLE_UNIVERSAL_BUILD
165
+ # if defined __BIG_ENDIAN__
166
+ # define WORDS_BIGENDIAN 1
167
+ # endif
168
+ #else
169
+ # ifndef WORDS_BIGENDIAN
170
+ # undef WORDS_BIGENDIAN
171
+ # endif
172
+ #endif
173
+
174
+ /* Enable large inode numbers on Mac OS X 10.5. */
175
+ #ifndef _DARWIN_USE_64_BIT_INODE
176
+ # define _DARWIN_USE_64_BIT_INODE 1
177
+ #endif
178
+
179
+ /* Number of bits in a file offset, on hosts where this is settable. */
180
+ #undef _FILE_OFFSET_BITS
181
+
182
+ /* Define for large files, on AIX-style hosts. */
183
+ #undef _LARGE_FILES
184
+
185
+ /* Define to 1 if on MINIX. */
186
+ #undef _MINIX
187
+
188
+ /* Define to 2 if the system does not provide POSIX.1 features except with
189
+ this defined. */
190
+ #undef _POSIX_1_SOURCE
191
+
192
+ /* Define to 1 if you need to in order for `stat' and other things to work. */
193
+ #undef _POSIX_SOURCE
194
+
195
+ /* Define to 500 only on HP-UX. */
196
+ #undef _XOPEN_SOURCE
197
+
198
+ /* Enable extensions on AIX 3, Interix. */
199
+ #ifndef _ALL_SOURCE
200
+ # undef _ALL_SOURCE
201
+ #endif
202
+ /* Enable GNU extensions on systems that have them. */
203
+ #ifndef _GNU_SOURCE
204
+ # undef _GNU_SOURCE
205
+ #endif
206
+ /* Enable threading extensions on Solaris. */
207
+ #ifndef _POSIX_PTHREAD_SEMANTICS
208
+ # undef _POSIX_PTHREAD_SEMANTICS
209
+ #endif
210
+ /* Enable extensions on HP NonStop. */
211
+ #ifndef _TANDEM_SOURCE
212
+ # undef _TANDEM_SOURCE
213
+ #endif
214
+ /* Enable general extensions on Solaris. */
215
+ #ifndef __EXTENSIONS__
216
+ # undef __EXTENSIONS__
217
+ #endif
218
+
219
+
220
+ /* Define to empty if `const' does not conform to ANSI C. */
221
+ #undef const
222
+
223
+ /* Define to `__inline__' or `__inline' if that's what the C compiler
224
+ calls it, or to nothing if 'inline' is not supported under any name. */
225
+ #ifndef __cplusplus
226
+ #undef inline
227
+ #endif
228
+
229
+ /* Define to rpl_malloc if the replacement function should be used. */
230
+ #undef malloc
231
+
232
+ /* Define to rpl_realloc if the replacement function should be used. */
233
+ #undef realloc
234
+
235
+ /* Define to the equivalent of the C99 'restrict' keyword, or to
236
+ nothing if this is not supported. Do not define if restrict is
237
+ supported directly. */
238
+ #undef restrict
239
+ /* Work around a bug in Sun C++: it does not support _Restrict or
240
+ __restrict__, even though the corresponding Sun C compiler ends up with
241
+ "#define restrict _Restrict" or "#define restrict __restrict__" in the
242
+ previous line. Perhaps some future version of Sun C++ will work with
243
+ restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
244
+ #if defined __SUNPRO_CC && !defined __RESTRICT
245
+ # define _Restrict
246
+ # define __restrict__
247
+ #endif
248
+
249
+ /* Define to `unsigned int' if <sys/types.h> does not define. */
250
+ #undef size_t
251
+
252
+ /* Define to empty if the keyword `volatile' does not work. Warning: valid
253
+ code using `volatile' can become incorrect without. Disable with care. */
254
+ #undef volatile