gtlspassword.h 4.4 KB

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