9824e4e3bfd96bf8f2b2f8c3c3e802b24edea377
[strongswan.git] / src / libstrongswan / library.h
1 /*
2 * Copyright (C) 2008 Martin Willi
3 * Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 *
15 * $Id$
16 */
17
18 /**
19 * @defgroup libstrongswan libstrongswan
20 *
21 * @defgroup asn1 asn1
22 * @ingroup libstrongswan
23 *
24 * @defgroup credentials credentials
25 * @ingroup libstrongswan
26 *
27 * @defgroup keys keys
28 * @ingroup credentials
29 *
30 * @defgroup certificates certificates
31 * @ingroup credentials
32 *
33 * @defgroup crypto crypto
34 * @ingroup libstrongswan
35
36 * @defgroup database database
37 * @ingroup libstrongswan
38
39 * @defgroup fetcher fetcher
40 * @ingroup libstrongswan
41
42 * @defgroup fips fips
43 * @ingroup libstrongswan
44
45 * @defgroup plugins plugins
46 * @ingroup libstrongswan
47
48 * @defgroup utils utils
49 * @ingroup libstrongswan
50 */
51
52 /**
53 * @defgroup library library
54 * @{ @ingroup libstrongswan
55 */
56
57 #ifndef LIBRARY_H_
58 #define LIBRARY_H_
59
60 #include <printf_hook.h>
61 #include <utils.h>
62 #include <chunk.h>
63 #include <settings.h>
64 #include <plugins/plugin_loader.h>
65 #include <crypto/crypto_factory.h>
66 #include <credentials/credential_factory.h>
67 #include <fetcher/fetcher_manager.h>
68 #include <database/database_factory.h>
69
70 typedef struct library_t library_t;
71
72 /**
73 * Libstrongswan library context, contains library relevant globals.
74 */
75 struct library_t {
76
77 /**
78 * Printf hook registering facility
79 */
80 printf_hook_t *printf_hook;
81
82 /**
83 * crypto algorithm registry and factory
84 */
85 crypto_factory_t *crypto;
86
87 /**
88 * credential constructor registry and factory
89 */
90 credential_factory_t *creds;
91
92 /**
93 * URL fetching facility
94 */
95 fetcher_manager_t *fetcher;
96
97 /**
98 * database construction factory
99 */
100 database_factory_t *db;
101
102 /**
103 * plugin loading facility
104 */
105 plugin_loader_t *plugins;
106
107 /**
108 * various settings loaded from settings file
109 */
110 settings_t *settings;
111
112 /**
113 * is leak detective running?
114 */
115 bool leak_detective;
116 };
117
118 /**
119 * Initialize library, creates "lib" instance.
120 *
121 * @param settings file to read settings from, may be NULL for none
122 */
123 void library_init(char *settings);
124
125 /**
126 * Deinitialize library, destroys "lib" instance.
127 */
128 void library_deinit();
129
130 /**
131 * Library instance, set after between library_init() and library_deinit() calls.
132 */
133 extern library_t *lib;
134
135 #endif /* LIBRARY_H_ @}*/