3 #include <sys/socket.h>
4 #include <netinet/tcp.h>
7 These functions provide data and function callback support
10 memcached_return
memcached_callback_set(memcached_st
*ptr
,
11 memcached_callback flag
,
16 case MEMCACHED_CALLBACK_USER_DATA
:
21 case MEMCACHED_CALLBACK_CLEANUP_FUNCTION
:
23 cleanup_func func
= (cleanup_func
)data
;
24 ptr
->on_cleanup
= func
;
27 case MEMCACHED_CALLBACK_CLONE_FUNCTION
:
29 clone_func func
= (clone_func
)data
;
34 return MEMCACHED_FAILURE
;
37 return MEMCACHED_SUCCESS
;
40 void *memcached_callback_get(memcached_st
*ptr
,
41 memcached_callback flag
,
42 memcached_return
*error
)
46 case MEMCACHED_CALLBACK_USER_DATA
:
48 *error
= ptr
->user_data
? MEMCACHED_SUCCESS
: MEMCACHED_FAILURE
;
49 return (void *)ptr
->user_data
;
51 case MEMCACHED_CALLBACK_CLEANUP_FUNCTION
:
53 *error
= ptr
->on_cleanup
? MEMCACHED_SUCCESS
: MEMCACHED_FAILURE
;
54 return (void *)ptr
->on_cleanup
;
56 case MEMCACHED_CALLBACK_CLONE_FUNCTION
:
58 *error
= ptr
->on_clone
? MEMCACHED_SUCCESS
: MEMCACHED_FAILURE
;
59 return (void *)ptr
->on_clone
;
63 *error
= MEMCACHED_FAILURE
;