Annotation of embedaddon/strongswan/src/libcharon/sa/child_sa_manager.h, revision 1.1.1.1
1.1 misho 1: /*
2: * Copyright (C) 2014 Martin Willi
3: * Copyright (C) 2014 revosec AG
4: *
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>.
9: *
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
13: * for more details.
14: */
15:
16: /**
17: * @defgroup child_sa_manager child_sa_manager
18: * @{ @ingroup sa
19: */
20:
21: #ifndef CHILD_SA_MANAGER_H_
22: #define CHILD_SA_MANAGER_H_
23:
24: #include <sa/ike_sa.h>
25: #include <sa/child_sa.h>
26:
27: typedef struct child_sa_manager_t child_sa_manager_t;
28:
29: /**
30: * Handle CHILD_SA to IKE_SA relations
31: */
32: struct child_sa_manager_t {
33:
34: /**
35: * Register a CHILD_SA/IKE_SA relation.
36: *
37: * @param child_sa CHILD_SA to register
38: * @param ike_sa IKE_SA owning the CHILD_SA
39: */
40: void (*add)(child_sa_manager_t *this, child_sa_t *child_sa, ike_sa_t *ike_sa);
41:
42: /**
43: * Unregister a CHILD_SA/IKE_SA relation.
44: *
45: * @param child_sa CHILD_SA to unregister
46: */
47: void (*remove)(child_sa_manager_t *this, child_sa_t *child_sa);
48:
49: /**
50: * Find a CHILD_SA and check out the associated IKE_SA by SPI.
51: *
52: * On success, the returned IKE_SA must be checked in after use to
53: * the IKE_SA manager.
54: *
55: * @param protocol IPsec protocol, AH|ESP
56: * @param spi SPI of CHILD_SA to check out
57: * @param dst SA destination host related to SPI
58: * @param child_sa returns CHILD_SA managed by IKE_SA
59: * @return IKE_SA, NULL if not found
60: */
61: ike_sa_t *(*checkout)(child_sa_manager_t *this,
62: protocol_id_t protocol, uint32_t spi, host_t *dst,
63: child_sa_t **child_sa);
64:
65: /**
66: * Find a CHILD_SA and check out the associated IKE_SA by unique_id.
67: *
68: * On success, the returned IKE_SA must be checked in after use to
69: * the IKE_SA manager.
70: *
71: * @param unique_id unique ID of CHILD_SA to check out
72: * @param child_sa returns CHILD_SA managed by IKE_SA
73: * @return IKE_SA, NULL if not found
74: */
75: ike_sa_t *(*checkout_by_id)(child_sa_manager_t *this, uint32_t unique_id,
76: child_sa_t **child_sa);
77:
78: /**
79: * Destroy a child_sa_manager_t.
80: */
81: void (*destroy)(child_sa_manager_t *this);
82: };
83:
84: /**
85: * Create a child_sa_manager instance.
86: */
87: child_sa_manager_t *child_sa_manager_create();
88:
89: #endif /** CHILD_SA_MANAGER_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>