summaryrefslogtreecommitdiff
path: root/src/charon/config/configuration.h
blob: c1207171dbc072259deeea50e3b689a783b270f0 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/**
 * @file configuration.h
 * 
 * @brief Interface configuration_t.
 *  
 */

/*
 * Copyright (C) 2006 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 CONFIGURATION_H_
#define CONFIGURATION_H_

typedef struct configuration_t configuration_t;

#include <library.h>

/**
 * @brief The interface for various daemon related configs.
 * 
 * @b Constructors:
 * 	- configuration_create()
 * 
 * @ingroup config
 */
struct configuration_t {

	/**
	 * @brief Returns the retransmit timeout.
	 *
	 * A return value of zero means the request should not be
	 * retransmitted again.
	 *
	 * @param this				calling object
	 * @param retransmitted		number of times a message was retransmitted so far
	 * @return					time in milliseconds, when to do next retransmit
	 */
	u_int32_t (*get_retransmit_timeout) (configuration_t *this, 
										 u_int32_t retransmitted);
	
	/**
	 * @brief Returns the timeout for an half open IKE_SA in ms.
	 *
	 * Half open means that the IKE_SA is still on a not established state
	 *
	 * @param this				calling object
	 * @return					timeout in milliseconds (ms)
	 */
	u_int32_t (*get_half_open_ike_sa_timeout) (configuration_t *this);

	/**
	 * @brief Returns the keepalive interval in s.
	 * 
	 * The keepalive interval defines the idle time after which a
	 * NAT keepalive packet should be sent.
	 * 
	 * @param this				calling object
	 * @return					interval in s
	 */	
	u_int32_t (*get_keepalive_interval) (configuration_t *this);

	/**
	 * @brief Returns the interval to retry a failed action again.
	 *
	 * In some situations, the protocol may be in a state where processing
	 * is not possible and an action must be retried (e.g. rekeying).
	 * 
	 * @param this				calling object
	 * @return					interval in s
	 */	
	u_int32_t (*get_retry_interval) (configuration_t *this);

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

/**
 * @brief Creates a configuration backend.
 * 
 * @return static_configuration_t object
 * 
 * @ingroup config
 */
configuration_t *configuration_create(void);

#endif /*CONFIGURATION_H_*/