e87451ae5ef4a8933be28419d00972a7aa2ab0c2
[awesomized/libmemcached] / docs / source / libmemcached / memcached_sasl.rst
1 SASL support
2 ============
3
4 .. index:: object: memcached_st
5
6 SYNOPSIS
7 --------
8
9 #include <libmemcached/memcached_pool.h>
10
11 .. function:: void memcached_set_sasl_callbacks(memcached_st *ptr, const sasl_callback_t *callbacks)
12
13 .. function:: const sasl_callback_t *memcached_get_sasl_callbacks(memcached_st *ptr)
14
15 .. function:: memcached_return_t memcached_set_sasl_auth_data(memcached_st *ptr, const char *username, const char *password)
16
17 .. function:: memcached_return_t memcached_destroy_sasl_auth_data(memcached_st *ptr)
18
19 Compile and link with -lmemcached
20
21 DESCRIPTION
22 -----------
23
24 libmemcached(3) allows you to plug in your own callbacks function used by
25 libsasl to perform SASL authentication.
26
27 Please note that SASL requires the memcached binary protocol, and you have
28 to specify the callbacks before you connect to the server.
29
30 :func:`memcached_set_sasl_auth_data` is a helper function defining
31 the basic functionality for you, but it will store the username and password
32 in memory. If you choose to use this method you have to call
33 :type:`memcached_destroy_sasl_auth_data` before calling
34 :type:`memcached_free` to avoid a memory leak. You should NOT call
35 :type:`memcached_destroy_sasl_auth_data` if you specify your own callback
36 function with :func:`memcached_set_sasl_callbacks`.
37
38 RETURN VALUE
39 ------------
40
41 :func:`memcached_get_sasl_callbacks` returns the callbacks currently used by
42 this memcached handle. :func:`memcached_set_sasl_auth_data` returns
43 `MEMCACHED_SUCCESS` upon success.
44
45 SEE ALSO
46 --------
47
48 .. only:: man
49
50 :manpage:`memcached(1)` :manpage:`libmemcached(3)` :manpage:`memcached_strerror(3)`