ike: Reuse interface ID during CHILD_SA rekeyings
[strongswan.git] / src / libcharon / sa / ikev1 / tasks / quick_mode.h
1 /*
2 * Copyright (C) 2015-2019 Tobias Brunner
3 * HSR Hochschule fuer Technik Rapperswil
4 *
5 * Copyright (C) 2011 Martin Willi
6 * Copyright (C) 2011 revosec AG
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * for more details.
17 */
18
19 /**
20 * @defgroup quick_mode quick_mode
21 * @{ @ingroup tasks_v1
22 */
23
24 #ifndef QUICK_MODE_H_
25 #define QUICK_MODE_H_
26
27 typedef struct quick_mode_t quick_mode_t;
28
29 #include <library.h>
30 #include <sa/ike_sa.h>
31 #include <sa/task.h>
32
33 /**
34 * IKEv1 quick mode, establishes a CHILD_SA in IKEv1.
35 */
36 struct quick_mode_t {
37
38 /**
39 * Implements the task_t interface
40 */
41 task_t task;
42
43 /**
44 * Get the message ID of the quick mode exchange handled by this task as
45 * responder.
46 *
47 * @return message ID, or 0 (not defined yet or as initiator)
48 */
49 uint32_t (*get_mid)(quick_mode_t *this);
50
51 /**
52 * Use a specific reqid to install this CHILD_SA.
53 *
54 * @param reqid reqid to use
55 */
56 void (*use_reqid)(quick_mode_t *this, uint32_t reqid);
57
58 /**
59 * Use specific mark values, overriding configuration.
60 *
61 * @param in inbound mark value
62 * @param out outbound mark value
63 */
64 void (*use_marks)(quick_mode_t *this, uint32_t in, uint32_t out);
65
66 /**
67 * Use specific interface IDs, overriding configuration.
68 *
69 * @param in inbound interface ID
70 * @param out outbound interface ID
71 */
72 void (*use_if_ids)(quick_mode_t *this, uint32_t in, uint32_t out);
73
74 /**
75 * Set the SPI of the old SA, if rekeying.
76 *
77 * @param spi spi of SA to rekey
78 */
79 void (*rekey)(quick_mode_t *this, uint32_t spi);
80 };
81
82 /**
83 * Create a new quick_mode task.
84 *
85 * @param ike_sa IKE_SA this task works for
86 * @param config child_cfg if task initiator, NULL if responder
87 * @param tsi source of triggering packet, or NULL
88 * @param tsr destination of triggering packet, or NULL
89 * @return task to handle by the task_manager
90 */
91 quick_mode_t *quick_mode_create(ike_sa_t *ike_sa, child_cfg_t *config,
92 traffic_selector_t *tsi, traffic_selector_t *tsr);
93
94 #endif /** QUICK_MODE_H_ @}*/