8dd09ca5b329ffae06229da3aff43a1dc54e6f5c
[platform/upstream/glib-networking.git] / tls / gnutls / gnutls-module.c
1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3  * GIO - GLib Input, Output and Streaming Library
4  *
5  * Copyright 2010 Red Hat, Inc.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General
18  * Public License along with this library; if not, see
19  * <http://www.gnu.org/licenses/>.
20  *
21  * In addition, when the library is used with OpenSSL, a special
22  * exception applies. Refer to the LICENSE_EXCEPTION file for details.
23  */
24
25 #include "config.h"
26
27 #include <gio/gio.h>
28 #include <glib/gi18n-lib.h>
29
30 #include "gtlsbackend-gnutls.h"
31
32
33 G_MODULE_EXPORT void
34 g_io_gnutls_load (GIOModule *module)
35 {
36   gchar *locale_dir;
37 #ifdef G_OS_WIN32
38   gchar *base_dir;
39 #endif
40
41   g_tls_backend_gnutls_register (module);
42
43 #ifdef G_OS_WIN32
44   base_dir = g_win32_get_package_installation_directory_of_module (NULL);
45   locale_dir = g_build_filename (base_dir, "share", "locale", NULL);
46   g_free (base_dir);
47 #else
48   locale_dir = g_strdup (LOCALE_DIR);
49 #endif
50
51   bindtextdomain (GETTEXT_PACKAGE, locale_dir);
52   bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
53   g_free (locale_dir);
54 }
55
56 G_MODULE_EXPORT void
57 g_io_gnutls_unload (GIOModule *module)
58 {
59 }
60
61 G_MODULE_EXPORT gchar **
62 g_io_gnutls_query (void)
63 {
64   gchar *eps[] = {
65     G_TLS_BACKEND_EXTENSION_POINT_NAME,
66     NULL
67   };
68   return g_strdupv (eps);
69 }