summaryrefslogtreecommitdiff
path: root/gio/src/tlspassword.hg
blob: 9dbd8f8e909f82bbe783491a571a18a3134ebdd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* Copyright (C) 2012 The giomm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <glibmm/object.h>

_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)

namespace Gio
{

_WRAP_ENUM(TlsPasswordFlags, GTlsPasswordFlags)

/** TlsPassword - TLS Passwords for prompting.
 * Holds a password used in TLS.
 * @newin{2,36}
 */
class TlsPassword : public Glib::Object
{
  _CLASS_GOBJECT(TlsPassword, GTlsPassword, G_TLS_PASSWORD, Glib::Object, GObject)

protected:
  _WRAP_CTOR(TlsPassword(const Glib::ustring& description{.}, TlsPasswordFlags flags{.} = Gio::TLS_PASSWORD_NONE), g_tls_password_new)

public:
  _WRAP_METHOD_DOCS_ONLY(g_tls_password_new)
  _WRAP_CREATE(const Glib::ustring& description{.}, TlsPasswordFlags flags{.} = Gio::TLS_PASSWORD_NONE)

  _WRAP_METHOD(const guchar* get_value(gsize& length{?}) const, g_tls_password_get_value)

  _WRAP_METHOD(void set_value(const guchar* value, gssize length = -1), g_tls_password_set_value)
  // This function does not copy the value as g_tls_password_set_value() does.
  // It keeps a reference to the original value and expects it to be freed
  // later in a specified GDestroyNotify callback.  Ignore it for now.
  _IGNORE(g_tls_password_set_value_full)

  _WRAP_METHOD(Glib::ustring get_description() const, g_tls_password_get_description)
  _WRAP_METHOD(void set_description(const Glib::ustring& description), g_tls_password_set_description)

  _WRAP_METHOD(TlsPasswordFlags get_flags() const, g_tls_password_get_flags)
  _WRAP_METHOD(void set_flags(TlsPasswordFlags flags), g_tls_password_set_flags)

  _WRAP_METHOD(Glib::ustring get_warning() const, g_tls_password_get_warning)
  _WRAP_METHOD(void set_warning(const Glib::ustring& warning), g_tls_password_set_warning)

  _WRAP_PROPERTY("description", Glib::ustring)
  _WRAP_PROPERTY("flags", TlsPasswordFlags)
  _WRAP_PROPERTY("warning", Glib::ustring)

#m4 _CONVERSION(`gsize*', `gsize&', `*($3)')
  _WRAP_VFUNC(const guchar* get_value(gsize& length) const, "get_value")

  //TODO? (See g_tls_password_set_value_full() comment above): _WRAP_VFUNC(void set_value(guchar* value, gssize length, GDestroyNotify destroy), "set_value")

#m4 _CONVERSION(`Glib::ustring', `const gchar*', `g_strdup($3.c_str())')
  _WRAP_VFUNC(Glib::ustring get_default_warning() const, "get_default_warning")
};

} // namespace Gio