2 * Copyright (C) 2018 Tobias Brunner
3 * Copyright (C) 2007 Martin Willi
4 * HSR Hochschule fuer Technik Rapperswil
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * @defgroup child_create child_create
19 * @{ @ingroup tasks_v2
22 #ifndef CHILD_CREATE_H_
23 #define CHILD_CREATE_H_
25 typedef struct child_create_t child_create_t
;
28 #include <sa/ike_sa.h>
30 #include <config/child_cfg.h>
33 * Task of type TASK_CHILD_CREATE, established a new CHILD_SA.
35 * This task may be included in the IKE_AUTH message or in a separate
36 * CREATE_CHILD_SA exchange.
38 struct child_create_t
{
41 * Implements the task_t interface
46 * Use a specific reqid for the CHILD_SA.
48 * When this task is used for rekeying, the same reqid is used
49 * for the new CHILD_SA.
51 * @param reqid reqid to use
53 void (*use_reqid
) (child_create_t
*this, uint32_t reqid
);
56 * Use specific mark values to override configuration.
58 * @param in inbound mark value
59 * @param out outbound mark value
61 void (*use_marks
)(child_create_t
*this, u_int in
, u_int out
);
64 * Initially propose a specific DH group to override configuration.
66 * This is used during rekeying to prefer the previously negotiated group.
68 * @param dh_group DH group to use
70 void (*use_dh_group
)(child_create_t
*this, diffie_hellman_group_t dh_group
);
73 * Get the lower of the two nonces, used for rekey collisions.
77 chunk_t (*get_lower_nonce
) (child_create_t
*this);
80 * Get the CHILD_SA established/establishing by this task.
84 child_sa_t
* (*get_child
) (child_create_t
*this);
87 * Enforce a specific CHILD_SA config as responder.
89 * @param cfg configuration to enforce, reference gets owned
91 void (*set_config
)(child_create_t
*this, child_cfg_t
*cfg
);
95 * Create a new child_create task.
97 * @param ike_sa IKE_SA this task works for
98 * @param config child_cfg if task initiator, NULL if responder
99 * @param rekey whether we do a rekey or not
100 * @param tsi source of triggering packet, or NULL
101 * @param tsr destination of triggering packet, or NULL
102 * @return child_create task to handle by the task_manager
104 child_create_t
*child_create_create(ike_sa_t
*ike_sa
,
105 child_cfg_t
*config
, bool rekey
,
106 traffic_selector_t
*tsi
, traffic_selector_t
*tsr
);
108 #endif /** CHILD_CREATE_H_ @}*/