added more API documentation to backends/interfaces
[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 loads control interfaces and has helper methods.
47 *
48 * One job of the interface manager is to load pluggable control interface
49 * modules, implemented as interface_t.
50 * @verbatim
51
52 +---------+ +------------+ +--------------+ |
53 | | | |<----- +--------------+ | |
54 | daemon |<-----| interface- | +--------------+ |-+ <==|==> IPC
55 | core | | manager |<----| interfaces |-+ |
56 | |<-----| | +--------------+ |
57 | | | | |
58 +---------+ +------------+ |
59
60 @endverbatim
61 * The manager does not really use the interfaces, instead, the interface
62 * use the manager to fullfill their tasks (initiating, terminating, ...).
63 * The interface_manager starts actions by creating jobs. It then tries to
64 * evaluate the result of the operation by listening on the bus.
65 *
66 * @b Constructors:
67 * - interface_manager_create()
68 *
69 * @ingroup control
70 */
71 struct interface_manager_t {
72
73 /**
74 * @brief Initiate a CHILD_SA, and if required, an IKE_SA.
75 *
76 * @param this calling object
77 * @param peer_cfg peer_cfg to use for IKE_SA setup
78 * @param child_cfg child_cfg to set up CHILD_SA from
79 * @param cb logging callback
80 * @param param parameter to include in each call of cb
81 * @return
82 * - SUCCESS, if CHILD_SA established
83 * - FAILED, if setup failed
84 * - NEED_MORE, if callback returned FALSE
85 */
86 status_t (*initiate)(interface_manager_t *this,
87 peer_cfg_t *peer_cfg, child_cfg_t *child_cfg,
88 interface_manager_cb_t callback, void *param);
89
90 /**
91 * @brief Destroy a interface_manager_t instance.
92 *
93 * @param this interface_manager_t objec to destroy
94 */
95 void (*destroy) (interface_manager_t *this);
96 };
97
98
99 /**
100 * @brief Creates a interface_manager instance and loads all interface modules.
101 *
102 * @return interface_manager_t object
103 *
104 * @ingroup control
105 */
106 interface_manager_t *interface_manager_create(void);
107
108 #endif /* INTERFACE_MANAGER_H_ */
109