gtlsbackend.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /* GIO - GLib Input, Output and Streaming Library
  2. *
  3. * Copyright (C) 2010 Red Hat, Inc.
  4. * Copyright © 2015 Collabora, Ltd.
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General
  17. * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef __G_TLS_BACKEND_H__
  20. #define __G_TLS_BACKEND_H__
  21. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  22. #error "Only <gio/gio.h> can be included directly."
  23. #endif
  24. #include <gio/giotypes.h>
  25. G_BEGIN_DECLS
  26. /**
  27. * G_TLS_BACKEND_EXTENSION_POINT_NAME:
  28. *
  29. * Extension point for TLS functionality via #GTlsBackend.
  30. * See [Extending GIO][extending-gio].
  31. */
  32. #define G_TLS_BACKEND_EXTENSION_POINT_NAME "gio-tls-backend"
  33. #define G_TYPE_TLS_BACKEND (g_tls_backend_get_type ())
  34. #define G_TLS_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_TLS_BACKEND, GTlsBackend))
  35. #define G_IS_TLS_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_TLS_BACKEND))
  36. #define G_TLS_BACKEND_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_TLS_BACKEND, GTlsBackendInterface))
  37. typedef struct _GTlsBackend GTlsBackend;
  38. typedef struct _GTlsBackendInterface GTlsBackendInterface;
  39. /**
  40. * GTlsBackendInterface:
  41. * @g_iface: The parent interface.
  42. * @supports_tls: returns whether the backend supports TLS.
  43. * @supports_dtls: returns whether the backend supports DTLS
  44. * @get_default_database: returns a default #GTlsDatabase instance.
  45. * @get_certificate_type: returns the #GTlsCertificate implementation type
  46. * @get_client_connection_type: returns the #GTlsClientConnection implementation type
  47. * @get_server_connection_type: returns the #GTlsServerConnection implementation type
  48. * @get_file_database_type: returns the #GTlsFileDatabase implementation type.
  49. * @get_dtls_client_connection_type: returns the #GDtlsClientConnection implementation type
  50. * @get_dtls_server_connection_type: returns the #GDtlsServerConnection implementation type
  51. *
  52. * Provides an interface for describing TLS-related types.
  53. *
  54. * Since: 2.28
  55. */
  56. struct _GTlsBackendInterface
  57. {
  58. GTypeInterface g_iface;
  59. /* methods */
  60. gboolean ( *supports_tls) (GTlsBackend *backend);
  61. GType ( *get_certificate_type) (void);
  62. GType ( *get_client_connection_type) (void);
  63. GType ( *get_server_connection_type) (void);
  64. GType ( *get_file_database_type) (void);
  65. GTlsDatabase * ( *get_default_database) (GTlsBackend *backend);
  66. gboolean ( *supports_dtls) (GTlsBackend *backend);
  67. GType ( *get_dtls_client_connection_type) (void);
  68. GType ( *get_dtls_server_connection_type) (void);
  69. };
  70. GLIB_AVAILABLE_IN_ALL
  71. GType g_tls_backend_get_type (void) G_GNUC_CONST;
  72. GLIB_AVAILABLE_IN_ALL
  73. GTlsBackend * g_tls_backend_get_default (void);
  74. GLIB_AVAILABLE_IN_ALL
  75. GTlsDatabase * g_tls_backend_get_default_database (GTlsBackend *backend);
  76. GLIB_AVAILABLE_IN_ALL
  77. gboolean g_tls_backend_supports_tls (GTlsBackend *backend);
  78. GLIB_AVAILABLE_IN_2_48
  79. gboolean g_tls_backend_supports_dtls (GTlsBackend *backend);
  80. GLIB_AVAILABLE_IN_ALL
  81. GType g_tls_backend_get_certificate_type (GTlsBackend *backend);
  82. GLIB_AVAILABLE_IN_ALL
  83. GType g_tls_backend_get_client_connection_type (GTlsBackend *backend);
  84. GLIB_AVAILABLE_IN_ALL
  85. GType g_tls_backend_get_server_connection_type (GTlsBackend *backend);
  86. GLIB_AVAILABLE_IN_ALL
  87. GType g_tls_backend_get_file_database_type (GTlsBackend *backend);
  88. GLIB_AVAILABLE_IN_2_48
  89. GType g_tls_backend_get_dtls_client_connection_type (GTlsBackend *backend);
  90. GLIB_AVAILABLE_IN_2_48
  91. GType g_tls_backend_get_dtls_server_connection_type (GTlsBackend *backend);
  92. G_END_DECLS
  93. #endif /* __G_TLS_BACKEND_H__ */