e4f3a72224a08d6e8fc366fecf74a220c228af5e
[strongswan.git] / src / libcharon / plugins / eap_radius / radius_client.h
1 /*
2 * Copyright (C) 2009 Martin Willi
3 * Hochschule fuer Technik Rapperswil
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 radius_client radius_client
18 * @{ @ingroup eap_radius
19 */
20
21 #ifndef RADIUS_CLIENT_H_
22 #define RADIUS_CLIENT_H_
23
24 #include "radius_message.h"
25
26 typedef struct radius_client_t radius_client_t;
27
28 /**
29 * RADIUS client functionality.
30 *
31 * To communicate with a RADIUS server, create a client and send messages over
32 * it. The client allocates a socket from the best RADIUS server abailable.
33 */
34 struct radius_client_t {
35
36 /**
37 * Send a RADIUS request and wait for the response.
38 *
39 * The client fills in NAS-Identifier nad NAS-Port-Type
40 *
41 * @param msg RADIUS request message to send
42 * @return response, NULL if timed out/verification failed
43 */
44 radius_message_t* (*request)(radius_client_t *this, radius_message_t *msg);
45
46 /**
47 * Get the EAP MSK after successful RADIUS authentication.
48 *
49 * @return MSK, allocated
50 */
51 chunk_t (*get_msk)(radius_client_t *this);
52
53 /**
54 * Destroy the client, release the socket.
55 */
56 void (*destroy)(radius_client_t *this);
57 };
58
59 /**
60 * Create a RADIUS client.
61 *
62 * @return radius_client_t object
63 */
64 radius_client_t *radius_client_create();
65
66 #endif /** RADIUS_CLIENT_H_ @}*/