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
19 * @defgroup trap_manager trap_manager
23 #ifndef TRAP_MANAGER_H_
24 #define TRAP_MANAGER_H_
27 #include <utils/enumerator.h>
28 #include <config/peer_cfg.h>
30 typedef struct trap_manager_t trap_manager_t
;
33 * Manage policies to create SAs from traffic.
35 struct trap_manager_t
{
38 * Install a policy as a trap.
40 * @param peer peer configuration to initiate on trap
41 * @param child child configuration to install as a trap
42 * @return reqid of installed CHILD_SA, 0 if failed
44 u_int (*install
)(trap_manager_t
*this, peer_cfg_t
*peer
, child_cfg_t
*child
);
47 * Uninstall a trap policy.
49 * @param id reqid of CHILD_SA to uninstall, returned by install()
50 * @return TRUE if uninstalled successfully
52 bool (*uninstall
)(trap_manager_t
*this, u_int reqid
);
55 * Create an enumerator over all installed traps.
57 * @return enumerator over (peer_cfg_t, child_sa_t)
59 enumerator_t
* (*create_enumerator
)(trap_manager_t
*this);
62 * Acquire an SA triggered by an installed trap.
64 * @param reqid requid of the triggering CHILD_SA
65 * @param src source of the triggering packet
66 * @param dst destination of the triggering packet
68 void (*acquire
)(trap_manager_t
*this, u_int reqid
, traffic_selector_t
*src
,
69 traffic_selector_t
*dst
);
72 * Destroy a trap_manager_t.
74 void (*destroy
)(trap_manager_t
*this);
78 * Create a trap_manager instance.
80 trap_manager_t
*trap_manager_create();
82 #endif /* TRAP_MANAGER_ @}*/