4 * @brief Interface of child_sa_t.
9 * Copyright (C) 2005 Martin Willi
10 * Hochschule fuer Technik Rapperswil
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>.
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
28 #include <transforms/prf_plus.h>
29 #include <encoding/payloads/proposal_substructure.h>
31 typedef struct child_sa_t child_sa_t
;
34 * @brief Represents multiple IPsec SAs between two hosts.
36 * A child_sa_t contains multiple SAs. SAs for both
37 * directions are managed in one child_sa_t object, and
38 * if both AH and ESP is set up, both protocols are managed
39 * by one child_sa_t. This means we can have two or
40 * in the AH+ESP case four IPsec-SAs in one child_sa_t.
42 * The procedure for child sa setup is as follows:
43 * - A gets SPIs for a proposal via child_sa_t.alloc
44 * - A send the updated proposal to B
45 * - B selects a suitable proposal
46 * - B calls child_sa_t.add to add and update the selected proposal
47 * - B sends the updated proposal to A
48 * - A calls child_sa_t.update to update the already allocated SPIs with the chosen proposal
59 * @brief Allocate SPIs for a given proposals.
61 * Since the kernel manages SPIs for us, we need
62 * to allocate them. If the proposal contains more
63 * than one protocol, for each protocol an SPI is
64 * allocated. SPIs are stored internally and written
65 * back to the proposal.
67 * @param this calling object
68 * @param proposal proposal for which SPIs are allocated
70 status_t (*alloc
)(child_sa_t
*this, linked_list_t
* proposals
);
73 * @brief Install the kernel SAs for a proposal.
75 * Since the kernel manages SPIs for us, we need
76 * to allocate them. If the proposal contains more
77 * than one protocol, for each protocol an SPI is
78 * allocated. SPIs are stored internally and written
79 * back to the proposal.
81 * @param this calling object
82 * @param proposal proposal for which SPIs are allocated
83 * @param prf_plus key material to use for key derivation
85 status_t (*add
)(child_sa_t
*this, proposal_t
*proposal
, prf_plus_t
*prf_plus
);
88 * @brief Install the kernel SAs for a proposal, if SPIs already allocated.
90 * This one updates the SAs in the kernel, which are
91 * allocated via alloc, with a selected proposals.
93 * @param this calling object
94 * @param proposal proposal for which SPIs are allocated
95 * @param prf_plus key material to use for key derivation
97 status_t (*update
)(child_sa_t
*this, proposal_t
*proposal
, prf_plus_t
*prf_plus
);
100 * @brief Install the policies using some traffic selectors.
102 * Spplied lists of traffic_selector_t's specify the policies
103 * to use for this child sa.
105 * @param this calling object
106 * @param my_ts traffic selectors for local site
107 * @param other_ts traffic selectors for remote site
108 * @return SUCCESS or FAILED
110 status_t (*add_policies
) (child_sa_t
*this, linked_list_t
*my_ts_list
, linked_list_t
*other_ts_list
);
113 * @brief Destroys a child_sa.
115 * @param this calling object
117 void (*destroy
) (child_sa_t
*this);
121 * @brief Constructor to create a new child_sa_t.
123 * @param me own address
124 * @param other remote address
125 * @return child_sa_t object
129 child_sa_t
* child_sa_create(host_t
*me
, host_t
*other
);
131 #endif /*_CHILD_SA_H_*/