8821282454e32f5f80682666c8af25761b95e4b4
[m6w6/libmemcached] / libmemcached / memcached_result.h
1 /*
2 * Summary: Result structure used for libmemcached.
3 *
4 * Copy: See Copyright for the status of this software.
5 *
6 * Author: Brian Aker
7 */
8
9 #ifndef __MEMCACHED_RESULT_H__
10 #define __MEMCACHED_RESULT_H__
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16 struct memcached_result_st {
17 struct {
18 bool is_allocated:1;
19 bool is_initialized:1;
20 } options;
21 uint32_t flags;
22 time_t expiration;
23 memcached_st *root;
24 size_t key_length;
25 uint64_t cas;
26 memcached_string_st value;
27 char key[MEMCACHED_MAX_KEY];
28 /* Add result callback function */
29 };
30
31 /* Result Struct */
32 LIBMEMCACHED_API
33 void memcached_result_free(memcached_result_st *result);
34 LIBMEMCACHED_API
35 void memcached_result_reset(memcached_result_st *ptr);
36 LIBMEMCACHED_API
37 memcached_result_st *memcached_result_create(memcached_st *ptr,
38 memcached_result_st *result);
39 #define memcached_result_key_value(A) (A)->key
40 #define memcached_result_key_length(A) (A)->key_length
41 #define memcached_result_string_st(A) ((A)->value)
42 #ifdef FIX
43 #define memcached_result_value(A) memcached_string_value((A)->value)
44 #define memcached_result_length(A) memcached_string_length((A)->value)
45 #else
46 LIBMEMCACHED_API
47 char *memcached_result_value(memcached_result_st *ptr);
48 LIBMEMCACHED_API
49 size_t memcached_result_length(memcached_result_st *ptr);
50 #endif
51 #define memcached_result_flags(A) (A)->flags
52 #define memcached_result_cas(A) (A)->cas
53 LIBMEMCACHED_API
54 memcached_return memcached_result_set_value(memcached_result_st *ptr, const char *value, size_t length);
55 #define memcached_result_set_flags(A,B) (A)->flags=(B)
56 #define memcached_result_set_expiration(A,B) (A)->expiration=(B)
57
58 #ifdef __cplusplus
59 }
60 #endif
61
62 #endif /* __MEMCACHED_RESULT_H__ */