Fix problem with bumping the command counter _before_ connecting to the server
[m6w6/libmemcached] / libmemcached / result.h
1 /* LibMemcached
2 * Copyright (C) 2006-2009 Brian Aker
3 * All rights reserved.
4 *
5 * Use and distribution licensed under the BSD license. See
6 * the COPYING file in the parent directory for full text.
7 *
8 * Summary: Functions to manipulate the result structure.
9 *
10 */
11
12 #ifndef __MEMCACHED_RESULT_H__
13 #define __MEMCACHED_RESULT_H__
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19 struct memcached_result_st {
20 struct {
21 bool is_allocated:1;
22 bool is_initialized:1;
23 } options;
24 uint32_t flags;
25 time_t expiration;
26 memcached_st *root;
27 size_t key_length;
28 uint64_t cas;
29 memcached_string_st value;
30 char key[MEMCACHED_MAX_KEY];
31 /* Add result callback function */
32 };
33
34 /* Result Struct */
35 LIBMEMCACHED_API
36 void memcached_result_free(memcached_result_st *result);
37 LIBMEMCACHED_API
38 void memcached_result_reset(memcached_result_st *ptr);
39 LIBMEMCACHED_API
40 memcached_result_st *memcached_result_create(memcached_st *ptr,
41 memcached_result_st *result);
42 #define memcached_result_key_value(A) (A)->key
43 #define memcached_result_key_length(A) (A)->key_length
44 #define memcached_result_string_st(A) ((A)->value)
45 #ifdef FIX
46 #define memcached_result_value(A) memcached_string_value((A)->value)
47 #define memcached_result_length(A) memcached_string_length((A)->value)
48 #else
49
50 LIBMEMCACHED_API
51 char *memcached_result_value(memcached_result_st *ptr);
52
53 LIBMEMCACHED_API
54 size_t memcached_result_length(memcached_result_st *ptr);
55
56 #endif
57 #define memcached_result_flags(A) (A)->flags
58 #define memcached_result_cas(A) (A)->cas
59 LIBMEMCACHED_API
60 memcached_return_t memcached_result_set_value(memcached_result_st *ptr, const char *value, size_t length);
61 #define memcached_result_set_flags(A,B) (A)->flags=(B)
62 #define memcached_result_set_expiration(A,B) (A)->expiration=(B)
63
64 #ifdef __cplusplus
65 }
66 #endif
67
68 #endif /* __MEMCACHED_RESULT_H__ */