2 * Copyright (C) 2008 Martin Willi
3 * Hochschule fuer Technik Rapperswil
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>.
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
17 * @defgroup libstrongswan libstrongswan
20 * @ingroup libstrongswan
23 * @ingroup libstrongswan
25 * @defgroup collections collections
26 * @ingroup libstrongswan
28 * @defgroup credentials credentials
29 * @ingroup libstrongswan
32 * @ingroup credentials
34 * @defgroup certificates certificates
35 * @ingroup credentials
38 * @ingroup credentials
40 * @defgroup crypto crypto
41 * @ingroup libstrongswan
43 * @defgroup database database
44 * @ingroup libstrongswan
46 * @defgroup fetcher fetcher
47 * @ingroup libstrongswan
49 * @defgroup ipsec ipsec
50 * @ingroup libstrongswan
52 * @defgroup networking networking
53 * @ingroup libstrongswan
55 * @defgroup plugins plugins
56 * @ingroup libstrongswan
58 * @defgroup processing processing
59 * @ingroup libstrongswan
64 * @defgroup threading threading
65 * @ingroup libstrongswan
67 * @defgroup utils utils
68 * @ingroup libstrongswan
72 * @defgroup library library
73 * @{ @ingroup libstrongswan
79 #ifndef CONFIG_H_INCLUDED
80 # error config.h not included, pass "-include [...]/config.h" to gcc
83 /* make sure we include printf_hook.h and utils.h first */
84 #include "utils/printf_hook.h"
85 #include "utils/utils.h"
86 #include "networking/host_resolver.h"
87 #include "processing/processor.h"
88 #include "processing/scheduler.h"
89 #include "crypto/crypto_factory.h"
90 #include "crypto/proposal/proposal_keywords.h"
91 #include "fetcher/fetcher_manager.h"
92 #include "database/database_factory.h"
93 #include "credentials/credential_factory.h"
94 #include "credentials/credential_manager.h"
95 #include "credentials/cred_encoding.h"
96 #include "utils/chunk.h"
97 #include "utils/integrity_checker.h"
98 #include "utils/leak_detective.h"
99 #include "utils/settings.h"
100 #include "plugins/plugin_loader.h"
102 typedef struct library_t library_t
;
105 * Libstrongswan library context, contains library relevant globals.
110 * Get an arbitrary object registered by name.
112 * @param name name of the object to get
113 * @return object, NULL if none found
115 void* (*get
)(library_t
*this, char *name
);
118 * (Un-)Register an arbitrary object using the given name.
120 * @param name name to register object under
121 * @param object object to register, NULL to unregister
122 * @return TRUE if registered, FALSE if name already taken
124 bool (*set
)(library_t
*this, char *name
, void *object
);
127 * Printf hook registering facility
129 printf_hook_t
*printf_hook
;
132 * Proposal keywords registry
134 proposal_keywords_t
*proposal
;
137 * crypto algorithm registry and factory
139 crypto_factory_t
*crypto
;
142 * credential constructor registry and factory
144 credential_factory_t
*creds
;
147 * Manager for the credential set backends
149 credential_manager_t
*credmgr
;
152 * Credential encoding registry and factory
154 cred_encoding_t
*encoding
;
157 * URL fetching facility
159 fetcher_manager_t
*fetcher
;
162 * database construction factory
164 database_factory_t
*db
;
167 * plugin loading facility
169 plugin_loader_t
*plugins
;
172 * process jobs using a thread pool
174 processor_t
*processor
;
179 scheduler_t
*scheduler
;
182 * resolve hosts by DNS name
184 host_resolver_t
*hosts
;
187 * various settings loaded from settings file
189 settings_t
*settings
;
192 * integrity checker to verify code integrity
194 integrity_checker_t
*integrity
;
197 * Leak detective, if built and enabled
199 leak_detective_t
*leak_detective
;
203 * Initialize library, creates "lib" instance.
205 * @param settings file to read settings from, may be NULL for default
206 * @return FALSE if integrity check failed
208 bool library_init(char *settings
);
211 * Deinitialize library, destroys "lib" instance.
213 void library_deinit();
216 * Library instance, set after library_init() and before library_deinit() calls.
218 extern library_t
*lib
;
220 #endif /** LIBRARY_H_ @}*/