3b6c84ccd23d4a85d362e700792f2154762ab35a
[platform/upstream/glib-networking.git] / tls / openssl / openssl-module.c
1 /*
2  * gtlsbio.c
3  *
4  * Copyright (C) 2015 NICE s.r.l.
5  *
6  * This file 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.1 of the License, or (at your option) any later version.
10  *
11  * This file 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 Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  *
19  * In addition, when the library is used with OpenSSL, a special
20  * exception applies. Refer to the LICENSE_EXCEPTION file for details.
21  *
22  * Authors: Ignacio Casal Quinteiro
23  */
24
25 #include "config.h"
26
27 #include <glib/gi18n-lib.h>
28 #include <gio/gio.h>
29
30 #include "gtlsbackend-openssl.h"
31
32
33 G_MODULE_EXPORT void
34 g_io_openssl_load (GIOModule *module)
35 {
36   gchar *locale_dir;
37 #ifdef G_OS_WIN32
38   gchar *base_dir;
39 #endif
40
41   g_tls_backend_openssl_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_openssl_unload (GIOModule *module)
58 {
59 }
60
61 G_MODULE_EXPORT gchar **
62 g_io_openssl_query (void)
63 {
64   return g_strsplit (G_TLS_BACKEND_EXTENSION_POINT_NAME, "!", -1);
65 }