restructuring of configuration backends
[strongswan.git] / src / charon / control / interface_manager.h
1 /**
2 * @file interface_manager.h
3 *
4 * @brief Interface of interface_manager_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2007 Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 */
22
23 #ifndef INTERFACE_MANAGER_H_
24 #define INTERFACE_MANAGER_H_
25
26 #include <bus/bus.h>
27
28 /**
29 * callback to log things triggered by interface_manager
30 *
31 * @param param echoed parameter supplied when function invoked
32 * @param signal type of signal
33 * @param level verbosity level if log
34 * @param ike_sa associated IKE_SA, if any
35 * @param format printf like format string
36 * @param args list of arguments to use for format
37 * @return FALSE to return from invoked function
38 * @ingroup control
39 */
40 typedef bool(*interface_manager_cb_t)(void* param, signal_t signal, level_t level,
41 ike_sa_t* ike_sa, char* format, va_list args);
42
43 typedef struct interface_manager_t interface_manager_t;
44
45 /**
46 * @brief The interface_manager controls the daemon.
47 *
48 * The interface_manager starts actions by creating jobs. It then tries to
49 * evaluate the result of the operation by listening on the bus.
50 *
51 * @b Constructors:
52 * - interface_manager_create()
53 *
54 * @ingroup control
55 */
56 struct interface_manager_t {
57
58 /**
59 * @brief Initiate a CHILD_SA, and if required, an IKE_SA.
60 *
61 * @param this calling object
62 * @param peer_cfg peer_cfg to use for IKE_SA setup
63 * @param child_cfg child_cfg to set up CHILD_SA from
64 * @param cb logging callback
65 * @param param parameter to include in each call of cb
66 * @return
67 * - SUCCESS, if CHILD_SA established
68 * - FAILED, if setup failed
69 * - NEED_MORE, if callback returned FALSE
70 */
71 status_t (*initiate)(interface_manager_t *this,
72 peer_cfg_t *peer_cfg, child_cfg_t *child_cfg,
73 interface_manager_cb_t callback, void *param);
74
75 /**
76 * @brief Destroy a interface_manager_t instance.
77 *
78 * @param this interface_manager_t objec to destroy
79 */
80 void (*destroy) (interface_manager_t *this);
81 };
82
83
84 /**
85 * @brief Create a interface_manager instance and loads all interface modules.
86 *
87 * @return interface_manager_t object
88 *
89 * @ingroup control
90 */
91 interface_manager_t *interface_manager_create(void);
92
93 #endif /* INTERFACE_MANAGER_H_ */
94