diff options
author | Daiki Ueno <dueno@redhat.com> | 2018-11-01 15:37:42 +0100 |
---|---|---|
committer | Daiki Ueno <dueno@redhat.com> | 2018-11-12 14:08:45 +0100 |
commit | 8ada9c280c9044644dfad1f234e3da32f0df86a0 (patch) | |
tree | f60f3a15e2d40fe02c27e5487a32a697bdb6ca34 /lib/db.c | |
parent | 0a590e15e17383c5b18650465266da5f4cfd2af1 (diff) | |
download | gnutls-8ada9c280c9044644dfad1f234e3da32f0df86a0.tar.gz |
db: introduce gnutls_db_set_add_function
This adds a way to store an entry if it is not found in the database,
so that the implementation can provide atomic test-and-set.
Signed-off-by: Daiki Ueno <dueno@redhat.com>
Diffstat (limited to 'lib/db.c')
-rw-r--r-- | lib/db.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -56,6 +56,29 @@ gnutls_db_set_retrieve_function(gnutls_session_t session, } /** + * gnutls_db_set_add_function: + * @session: is a #gnutls_session_t type. + * @add_func: is the function. + * + * Sets the function that will be used to store an entry if it is not + * already present in the resumed sessions database. This function returns 0 + * if the entry is successfully stored, and a negative error code + * otherwise. In particular, if the entry is found in the database, + * it returns %GNUTLS_E_DB_ENTRY_EXISTS. + * + * The first argument to @add_func will be null unless + * gnutls_db_set_ptr() has been called. + * + * Since: 3.6.5 + **/ +void +gnutls_db_set_add_function(gnutls_session_t session, + gnutls_db_add_func add_func) +{ + session->internals.db_add_func = add_func; +} + +/** * gnutls_db_set_remove_function: * @session: is a #gnutls_session_t type. * @rem_func: is the function. |