aboutsummaryrefslogtreecommitdiffstats
path: root/Source/charon/sa/child_sa.h
blob: bde032b74935ec204f9fbd44c819d9167885dbcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**
 * @file child_sa.h
 *
 * @brief Interface of child_sa_t.
 *
 */

/*
 * Copyright (C) 2005 Jan Hutter, Martin Willi
 * Hochschule fuer Technik Rapperswil
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 */


#ifndef _CHILD_SA_H_
#define _CHILD_SA_H_

#include <types.h>
#include <transforms/prf_plus.h>
#include <encoding/payloads/proposal_substructure.h>

typedef struct child_sa_t child_sa_t;

/**
 * @brief Represents a CHILD_SA between to hosts.
 * 
 * 
 * @b Constructors:
 *  - child_sa_create
 * 
 * @ingroup sa
 */
struct child_sa_t {
	
	/**
	 * @brief Returns the SPI value of this CHILD_SA.
	 * 
	 * AH and ESP are using 4 byte SPI values.
	 * 
	 * @param this		calling object
	 * @return 			4 Byte SPI value
	 */
	u_int32_t (*get_spi) (child_sa_t *this);

	/**
	 * @brief Destroys a child_sa.
	 *
	 * @param this 		calling object
	 */
	void (*destroy) (child_sa_t *this);
};

/**
 * @brief Constructor to create a new CHILD_SA.
 * 
 * @param protocol_id	protocol id (AH or ESP) of CHILD_SA
 * @param prf_plus		prf_plus_t object use to derive shared secrets
 * @return				child_sa_t object
 * @ingroup sa
 */
child_sa_t * child_sa_create(proposal_t *proposal, prf_plus_t *prf_plus);

#endif /*_CHILD_SA_H_*/