gtlsbackend.h 4.5 KB

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