1/* GIO - GLib Input, Output and Streaming Library
2 *
3 * Copyright (C) 2011 Collabora, Ltd.
4 *
5 * SPDX-License-Identifier: LGPL-2.1-or-later
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General
18 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
19 *
20 * Author: Stef Walter <stefw@collabora.co.uk>
21 */
22
23#ifndef __G_TLS_PASSWORD_H__
24#define __G_TLS_PASSWORD_H__
25
26#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
27#error "Only <gio/gio.h> can be included directly."
28#endif
29
30#include <gio/giotypes.h>
31
32G_BEGIN_DECLS
33
34#define G_TYPE_TLS_PASSWORD (g_tls_password_get_type ())
35#define G_TLS_PASSWORD(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_TLS_PASSWORD, GTlsPassword))
36#define G_TLS_PASSWORD_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_TLS_PASSWORD, GTlsPasswordClass))
37#define G_IS_TLS_PASSWORD(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_TLS_PASSWORD))
38#define G_IS_TLS_PASSWORD_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_TLS_PASSWORD))
39#define G_TLS_PASSWORD_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_TLS_PASSWORD, GTlsPasswordClass))
40
41typedef struct _GTlsPasswordClass GTlsPasswordClass;
42typedef struct _GTlsPasswordPrivate GTlsPasswordPrivate;
43
44struct _GTlsPassword
45{
46 GObject parent_instance;
47
48 GTlsPasswordPrivate *priv;
49};
50
51/**
52 * GTlsPasswordClass:
53 * @get_value: virtual method for g_tls_password_get_value()
54 * @set_value: virtual method for g_tls_password_set_value()
55 * @get_default_warning: virtual method for g_tls_password_get_warning() if no
56 * value has been set using g_tls_password_set_warning()
57 *
58 * Class structure for #GTlsPassword.
59 */
60struct _GTlsPasswordClass
61{
62 GObjectClass parent_class;
63
64 /* methods */
65
66 const guchar * ( *get_value) (GTlsPassword *password,
67 gsize *length);
68
69 void ( *set_value) (GTlsPassword *password,
70 guchar *value,
71 gssize length,
72 GDestroyNotify destroy);
73
74 const gchar* ( *get_default_warning) (GTlsPassword *password);
75
76 /*< private >*/
77 /* Padding for future expansion */
78 gpointer padding[4];
79};
80
81GIO_AVAILABLE_IN_ALL
82GType g_tls_password_get_type (void) G_GNUC_CONST;
83
84GIO_AVAILABLE_IN_ALL
85GTlsPassword * g_tls_password_new (GTlsPasswordFlags flags,
86 const gchar *description);
87
88GIO_AVAILABLE_IN_ALL
89const guchar * g_tls_password_get_value (GTlsPassword *password,
90 gsize *length);
91GIO_AVAILABLE_IN_ALL
92void g_tls_password_set_value (GTlsPassword *password,
93 const guchar *value,
94 gssize length);
95GIO_AVAILABLE_IN_ALL
96void g_tls_password_set_value_full (GTlsPassword *password,
97 guchar *value,
98 gssize length,
99 GDestroyNotify destroy);
100
101GIO_AVAILABLE_IN_ALL
102GTlsPasswordFlags g_tls_password_get_flags (GTlsPassword *password);
103GIO_AVAILABLE_IN_ALL
104void g_tls_password_set_flags (GTlsPassword *password,
105 GTlsPasswordFlags flags);
106
107GIO_AVAILABLE_IN_ALL
108const gchar* g_tls_password_get_description (GTlsPassword *password);
109GIO_AVAILABLE_IN_ALL
110void g_tls_password_set_description (GTlsPassword *password,
111 const gchar *description);
112
113GIO_AVAILABLE_IN_ALL
114const gchar * g_tls_password_get_warning (GTlsPassword *password);
115GIO_AVAILABLE_IN_ALL
116void g_tls_password_set_warning (GTlsPassword *password,
117 const gchar *warning);
118
119G_END_DECLS
120
121#endif /* __G_TLS_PASSWORD_H__ */
122