glib (2.79.0)
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
32 G_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
41 typedef struct _GTlsPasswordClass GTlsPasswordClass;
42 typedef struct _GTlsPasswordPrivate GTlsPasswordPrivate;
43
44 struct _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 */
60 struct _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
81 GIO_AVAILABLE_IN_ALL
82 GType g_tls_password_get_type (void) G_GNUC_CONST;
83
84 GIO_AVAILABLE_IN_ALL
85 GTlsPassword * g_tls_password_new (GTlsPasswordFlags flags,
86 const gchar *description);
87
88 GIO_AVAILABLE_IN_ALL
89 const guchar * g_tls_password_get_value (GTlsPassword *password,
90 gsize *length);
91 GIO_AVAILABLE_IN_ALL
92 void g_tls_password_set_value (GTlsPassword *password,
93 const guchar *value,
94 gssize length);
95 GIO_AVAILABLE_IN_ALL
96 void g_tls_password_set_value_full (GTlsPassword *password,
97 guchar *value,
98 gssize length,
99 GDestroyNotify destroy);
100
101 GIO_AVAILABLE_IN_ALL
102 GTlsPasswordFlags g_tls_password_get_flags (GTlsPassword *password);
103 GIO_AVAILABLE_IN_ALL
104 void g_tls_password_set_flags (GTlsPassword *password,
105 GTlsPasswordFlags flags);
106
107 GIO_AVAILABLE_IN_ALL
108 const gchar* g_tls_password_get_description (GTlsPassword *password);
109 GIO_AVAILABLE_IN_ALL
110 void g_tls_password_set_description (GTlsPassword *password,
111 const gchar *description);
112
113 GIO_AVAILABLE_IN_ALL
114 const gchar * g_tls_password_get_warning (GTlsPassword *password);
115 GIO_AVAILABLE_IN_ALL
116 void g_tls_password_set_warning (GTlsPassword *password,
117 const gchar *warning);
118
119 G_END_DECLS
120
121 #endif /* __G_TLS_PASSWORD_H__ */