syslog-ng source
secret-storage.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Balabit
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * As an additional exemption you are allowed to compile & link against the
19  * OpenSSL libraries as published by the OpenSSL project. See the file
20  * COPYING for details.
21  *
22  */
23 
24 #ifndef SECRET_STORAGE_H_INCLUDED
25 #define SECRET_STORAGE_H_INCLUDED
26 
27 #include "compat/glib.h"
28 
29 #define PUBLIC __attribute__ ((visibility ("default")))
30 #define INTERNAL __attribute__ ((visibility ("hidden")))
31 
32 typedef struct
33 {
34  gsize len;
35  gchar data[];
36 } Secret;
37 
38 typedef void(*SecretStorageCB)(Secret *secret, gpointer user_data);
39 
40 void secret_storage_init(void) PUBLIC;
41 void secret_storage_deinit(void) PUBLIC;
42 
43 gboolean secret_storage_store_string(const gchar *key, gchar *secret) PUBLIC;
44 gboolean secret_storage_store_secret(const gchar *key, gchar *secret, gsize len) PUBLIC;
45 void secret_storage_wipe(gpointer s, gsize len) PUBLIC;
46 
47 void secret_storage_with_secret(const gchar *key, SecretStorageCB func, gpointer user_data) PUBLIC;
51 
52 gboolean secret_storage_subscribe_for_key(const gchar *key, SecretStorageCB func, gpointer user_data) PUBLIC;
53 void secret_storage_unsubscribe(const gchar *key, SecretStorageCB func, gpointer user_data) PUBLIC;
54 
55 typedef
56 enum
57 {
63 
65 
66 typedef struct
67 {
68  gchar *key;
70 } SecretStatus;
71 typedef gboolean (*SecretStatusCB)(SecretStatus *secret_status, gpointer user_data);
72 void secret_storage_status_foreach(SecretStatusCB cb, gpointer user_data) PUBLIC;
73 
74 gboolean secret_storage_contains_key(const gchar *key) PUBLIC;
75 
76 #endif
void secret_storage_init(void) PUBLIC
Definition: secret-storage.c:67
Secret * secret_storage_get_secret_by_name(const gchar *key) PUBLIC
Definition: secret-storage.c:205
void secret_storage_unsubscribe(const gchar *key, SecretStorageCB func, gpointer user_data) PUBLIC
Definition: secret-storage.c:256
Secret * secret_storage_clone_secret(Secret *self) PUBLIC
Definition: secret-storage.c:194
SecretStorageSecretState
Definition: secret-storage.h:57
@ SECRET_STORAGE_STATUS_INVALID_PASSWORD
Definition: secret-storage.h:61
@ SECRET_STORAGE_STATUS_PENDING
Definition: secret-storage.h:58
@ SECRET_STORAGE_SUCCESS
Definition: secret-storage.h:59
@ SECRET_STORAGE_STATUS_FAILED
Definition: secret-storage.h:60
void secret_storage_with_secret(const gchar *key, SecretStorageCB func, gpointer user_data) PUBLIC
Definition: secret-storage.c:220
void(* SecretStorageCB)(Secret *secret, gpointer user_data)
Definition: secret-storage.h:38
gboolean secret_storage_subscribe_for_key(const gchar *key, SecretStorageCB func, gpointer user_data) PUBLIC
Definition: secret-storage.c:236
gboolean(* SecretStatusCB)(SecretStatus *secret_status, gpointer user_data)
Definition: secret-storage.h:71
void secret_storage_put_secret(Secret *self) PUBLIC
Definition: secret-storage.c:214
void secret_storage_update_status(const gchar *key, SecretStorageSecretState state) PUBLIC
Definition: secret-storage.c:304
void secret_storage_status_foreach(SecretStatusCB cb, gpointer user_data) PUBLIC
Definition: secret-storage.c:297
void secret_storage_deinit(void) PUBLIC
Definition: secret-storage.c:80
gboolean secret_storage_store_string(const gchar *key, gchar *secret) PUBLIC
Definition: secret-storage.c:189
gboolean secret_storage_store_secret(const gchar *key, gchar *secret, gsize len) PUBLIC
Definition: secret-storage.c:160
#define PUBLIC
Definition: secret-storage.h:29
void secret_storage_wipe(gpointer s, gsize len) PUBLIC
Definition: secret-storage.c:183
gboolean secret_storage_contains_key(const gchar *key) PUBLIC
Definition: secret-storage.c:315
Definition: secret-storage.h:67
gchar * key
Definition: secret-storage.h:68
SecretStorageSecretState state
Definition: secret-storage.h:69
Definition: secret-storage.h:33
gsize len
Definition: secret-storage.h:34
struct @95 state
struct tm key
Definition: cache.c:63