Merge Monty
[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 uint32_t flags;
18 bool is_allocated;
19 time_t expiration;
20 memcached_st *root;
21 size_t key_length;
22 uint64_t cas;
23 memcached_string_st value;
24 char key[MEMCACHED_MAX_KEY];
25 /* Add result callback function */
26 };
27
28 /* Result Struct */
29 LIBMEMCACHED_API
30 void memcached_result_free(memcached_result_st *result);
31 LIBMEMCACHED_API
32 void memcached_result_reset(memcached_result_st *ptr);
33 LIBMEMCACHED_API
34 memcached_result_st *memcached_result_create(memcached_st *ptr,
35 memcached_result_st *result);
36 #define memcached_result_key_value(A) (A)->key
37 #define memcached_result_key_length(A) (A)->key_length
38 #define memcached_result_string_st(A) ((A)->value)
39 #ifdef FIX
40 #define memcached_result_value(A) memcached_string_value((A)->value)
41 #define memcached_result_length(A) memcached_string_length((A)->value)
42 #else
43 LIBMEMCACHED_API
44 char *memcached_result_value(memcached_result_st *ptr);
45 LIBMEMCACHED_API
46 size_t memcached_result_length(memcached_result_st *ptr);
47 #endif
48 #define memcached_result_flags(A) (A)->flags
49 #define memcached_result_cas(A) (A)->cas
50 LIBMEMCACHED_API
51 memcached_return memcached_result_set_value(memcached_result_st *ptr, const char *value, size_t length);
52 #define memcached_result_set_flags(A,B) (A)->flags=(B)
53 #define memcached_result_set_expiration(A,B) (A)->expiration=(B)
54
55 #ifdef __cplusplus
56 }
57 #endif
58
59 #endif /* __MEMCACHED_RESULT_H__ */