2 * Copyright (C) 2009 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 trap_manager trap_manager
21 #ifndef TRAP_MANAGER_H_
22 #define TRAP_MANAGER_H_
25 #include <utils/enumerator.h>
26 #include <config/peer_cfg.h>
28 typedef struct trap_manager_t trap_manager_t
;
31 * Manage policies to create SAs from traffic.
33 struct trap_manager_t
{
36 * Install a policy as a trap.
38 * @param peer peer configuration to initiate on trap
39 * @param child child configuration to install as a trap
40 * @return reqid of installed CHILD_SA, 0 if failed
42 u_int32_t (*install
)(trap_manager_t
*this, peer_cfg_t
*peer
,
46 * Uninstall a trap policy.
48 * @param id reqid of CHILD_SA to uninstall, returned by install()
49 * @return TRUE if uninstalled successfully
51 bool (*uninstall
)(trap_manager_t
*this, u_int32_t reqid
);
54 * Create an enumerator over all installed traps.
56 * @return enumerator over (peer_cfg_t, child_sa_t)
58 enumerator_t
* (*create_enumerator
)(trap_manager_t
*this);
61 * Acquire an SA triggered by an installed trap.
63 * @param reqid requid of the triggering CHILD_SA
64 * @param src source of the triggering packet
65 * @param dst destination of the triggering packet
67 void (*acquire
)(trap_manager_t
*this, u_int32_t reqid
,
68 traffic_selector_t
*src
, traffic_selector_t
*dst
);
71 * Clear any installed trap.
73 void (*flush
)(trap_manager_t
*this);
76 * Destroy a trap_manager_t.
78 void (*destroy
)(trap_manager_t
*this);
82 * Create a trap_manager instance.
84 trap_manager_t
*trap_manager_create();
86 #endif /** TRAP_MANAGER_H_ @}*/