summaryrefslogtreecommitdiff
path: root/src/libcharon/plugins/tnc_pdp/tnc_pdp_connections.h
blob: 442f29ce93308105a287c70a9ed300ea230efe31 (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
/*
 * Copyright (C) 2012 Andreas Steffen
 * HSR 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.
 */

/**
 * @defgroup tnc_pdp_connections tnc_pdp_connections
 * @{ @ingroup tnc_pdp
 */

#ifndef TNC_PDP_CONNECTIONS_H_
#define TNC_PDP_CONNECTIONS_H_

typedef struct tnc_pdp_connections_t tnc_pdp_connections_t;

#include <library.h>
#include <sa/ike_sa.h>
#include <sa/eap/eap_method.h>

/**
 * Public interface of a tnc_pdp_connections object
 */
struct tnc_pdp_connections_t {

	/**
	 * Register a new TNC PEP RADIUS Connection
	 *
	 * @param nas_id		NAS identifier of Policy Enforcement Point
	 * @param user_name		User name of TNC Client
	 * @param peer			Peer identity
	 * @param method		EAP method state for this TNC PEP Connection
	 */
	void (*add)(tnc_pdp_connections_t *this, chunk_t nas_id, chunk_t user_name,
				identification_t *peer, eap_method_t *method);

	/**
	 * Remove a TNC PEP RADIUS Connection
	 *
	 * @param nas_id		NAS identifier of Policy Enforcement Point
	 * @param user_name		User name of TNC Client
	 */
	void (*remove)(tnc_pdp_connections_t *this, chunk_t nas_id,
				   chunk_t user_name);

	/**
	 * Get the EAP method and IKE_SA of a registered TNC PEP RADIUS Connection.
	 *
	 * If this call succeeds, the connection manager is locked. Call unlock
	 * after using the return objects.
	 *
	 * @param nas_id		NAS identifier of Policy Enforcement Point
	 * @param user_name		User name of TNC Client
	 * @param ike_sa		IKE_SA used for bus communication only
	 * @return				EAP method for this connection or NULL if not found
	 */
	eap_method_t* (*get_state)(tnc_pdp_connections_t *this, chunk_t nas_id,
							   chunk_t user_name, ike_sa_t **ike_sa);

	/**
	 * Unlock connections after successfully calling get_state().
	 */
	void (*unlock)(tnc_pdp_connections_t *this);

	/**
	 * Destroys a tnc_pdp_connections_t object.
	 */
	void (*destroy)(tnc_pdp_connections_t *this);
};

/**
 * Create a tnc_pdp_connections_t instance
 */
tnc_pdp_connections_t* tnc_pdp_connections_create(void);

#endif /** TNC_PDP_CONNECTIONS_PLUGIN_H_ @}*/