## GTlsBackend GTlsBackend — TLS backend implementation |

## Functions

GTlsBackend * | g_tls_backend_get_default ()
gboolean | g_tls_backend_supports_tls ()
gboolean | g_tls_backend_supports_dtls ()
GTlsDatabase * | g_tls_backend_get_default_database ()
void | g_tls_backend_set_default_database ()
GType | g_tls_backend_get_certificate_type ()
GType | g_tls_backend_get_client_connection_type ()
GType | g_tls_backend_get_server_connection_type ()
GType | g_tls_backend_get_dtls_client_connection_type ()
GType | g_tls_backend_get_dtls_server_connection_type ()
GType | g_tls_backend_get_file_database_type ()

## Types and Values

#define | G_TLS_BACKEND_EXTENSION_POINT_NAME
| GTlsBackend
struct | GTlsBackendInterface

## Object Hierarchy

        GInterface
        ╰── GTlsBackend

## Prerequisites

GTlsBackend requires GObject.

## Includes

    #include <gio/gio.h>

## Description

TLS (Transport Layer Security, aka SSL) and DTLS backend.

## Functions

### g_tls_backend_get_default ()

    GTlsBackend *
    g_tls_backend_get_default (void);

Gets the default GTlsBackend for the system.

#### Returns

a GTlsBackend, which will be a dummy object if no TLS backend is available.

[not nullable][transfer none]

Since: 2.28

### g_tls_backend_supports_tls ()

    gboolean
    g_tls_backend_supports_tls (GTlsBackend *backend);

Checks if TLS is supported; if this returns `FALSE` for the default GTlsBackend, it means no "real" TLS backend is available.

#### Parameters

backend | the GTlsBackend |

#### Returns

whether or not TLS is supported

Since: 2.28

### g_tls_backend_supports_dtls ()

    gboolean
    g_tls_backend_supports_dtls (GTlsBackend *backend);

Checks if DTLS is supported. DTLS support may not be available even if TLS support is available, and vice-versa.

#### Parameters

backend | the GTlsBackend |

#### Returns

whether DTLS is supported

Since: 2.48

### g_tls_backend_get_default_database ()

    GTlsDatabase *
    g_tls_backend_get_default_database (GTlsBackend *backend);

Gets the default GTlsDatabase used to verify TLS connections.

#### Parameters

backend | the GTlsBackend |

#### Returns

the default database, which should be unreffed when done.

[transfer full]

Since: 2.30

### g_tls_backend_set_default_database ()

    void
    g_tls_backend_set_default_database (GTlsBackend *backend,
                                        GTlsDatabase *database);

Set the default GTlsDatabase used to verify TLS connections

Any subsequent call to `g_tls_backend_get_default_database()` will return the database set in this call. Existing databases and connections are not modified.

Setting a `NULL` default database will reset to using the system default database as if `g_tls_backend_set_default_database()` had never been called.

#### Parameters

backend | the GTlsBackend |
database | the GTlsDatabase. | [nullable]

Since: 2.60

### g_tls_backend_get_certificate_type ()

    GType
    g_tls_backend_get_certificate_type (GTlsBackend *backend);

Gets the GType of `backend` 's GTlsCertificate implementation.

#### Parameters

backend | the GTlsBackend |

#### Returns

the GType of `backend` 's GTlsCertificate implementation.

Since: 2.28

### g_tls_backend_get_client_connection_type ()

    GType
    g_tls_backend_get_client_connection_type
                                   (GTlsBackend *backend);

Gets the GType of `backend` 's GTlsClientConnection implementation.

#### Parameters

backend | the GTlsBackend |

#### Returns

the GType of `backend` 's GTlsClientConnection implementation.

Since: 2.28

### g_tls_backend_get_server_connection_type ()

    GType
    g_tls_backend_get_server_connection_type
                                   (GTlsBackend *backend);

Gets the GType of `backend` 's GTlsServerConnection implementation.

#### Parameters

backend | the GTlsBackend |

#### Returns

the GType of `backend` 's GTlsServerConnection implementation.

Since: 2.28

### g_tls_backend_get_dtls_client_connection_type ()

    GType
    g_tls_backend_get_dtls_client_connection_type
                                   (GTlsBackend *backend);

Gets the GType of `backend` ’s GDtlsClientConnection implementation.

#### Parameters

backend | the GTlsBackend |

#### Returns

the GType of `backend` ’s GDtlsClientConnection implementation, or `G_TYPE_INVALID` if this backend doesn’t support DTLS.

Since: 2.48

### g_tls_backend_get_dtls_server_connection_type ()

    GType
    g_tls_backend_get_dtls_server_connection_type
                                   (GTlsBackend *backend);

Gets the GType of `backend` ’s GDtlsServerConnection implementation.

#### Parameters

backend | the GTlsBackend |

#### Returns

the GType of `backend` ’s GDtlsServerConnection implementation, or `G_TYPE_INVALID` if this backend doesn’t support DTLS.

Since: 2.48

### g_tls_backend_get_file_database_type ()

    GType
    g_tls_backend_get_file_database_type (GTlsBackend *backend);

Gets the GType of `backend` 's GTlsFileDatabase implementation.

#### Parameters

backend | the GTlsBackend |

#### Returns

the GType of backend's GTlsFileDatabase implementation.

Since: 2.30

## Types and Values

### G_TLS_BACKEND_EXTENSION_POINT_NAME

    #define G_TLS_BACKEND_EXTENSION_POINT_NAME "gio-tls-backend"

Extension point for TLS functionality via GTlsBackend. See Extending GIO.

### GTlsBackend

    typedef struct _GTlsBackend GTlsBackend;

TLS (Transport Layer Security, aka SSL) and DTLS backend. This is an internal type used to coordinate the different classes implemented by a TLS backend.

Since: 2.28

### struct GTlsBackendInterface

    struct GTlsBackendInterface {
      GTypeInterface g_iface;

      /* methods */
      gboolean       ( *supports_tls)               (GTlsBackend *backend);
      GType          ( *get_certificate_type)       (void);
      GType          ( *get_client_connection_type) (void);
      GType          ( *get_server_connection_type) (void);
      GType          ( *get_file_database_type)     (void);
      GTlsDatabase * ( *get_default_database)       (GTlsBackend *backend);
      gboolean       ( *supports_dtls)              (GTlsBackend *backend);
      GType          ( *get_dtls_client_connection_type) (void);
      GType          ( *get_dtls_server_connection_type) (void);
    };

Provides an interface for describing TLS-related types.

#### Members

`supports_tls` () | returns whether the backend supports TLS. |
`get_certificate_type` () | returns the GTlsCertificate implementation type |
`get_client_connection_type` () | returns the GTlsClientConnection implementation type |
`get_server_connection_type` () | returns the GTlsServerConnection implementation type |
`get_file_database_type` () | returns the GTlsFileDatabase implementation type. |
`get_default_database` () | returns a default GTlsDatabase instance. |
`supports_dtls` () | returns whether the backend supports DTLS |
`get_dtls_client_connection_type` () | returns the GDtlsClientConnection implementation type |
`get_dtls_server_connection_type` () | returns the GDtlsServerConnection implementation type |

Since: 2.28