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