]>
Commit | Line | Data |
---|---|---|
4a6b84a9 MW |
1 | /* |
2 | * Copyright (C) 2009 Martin Willi | |
19ef2aec TB |
3 | * |
4 | * Copyright (C) secunet Security Networks AG | |
4a6b84a9 MW |
5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | |
7 | * under the terms of the GNU General Public License as published by the | |
8 | * Free Software Foundation; either version 2 of the License, or (at your | |
9 | * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, but | |
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 | * for more details. | |
4a6b84a9 MW |
15 | */ |
16 | ||
17 | /** | |
18 | * @defgroup radius_client radius_client | |
f0f94e2c | 19 | * @{ @ingroup libradius |
4a6b84a9 MW |
20 | */ |
21 | ||
22 | #ifndef RADIUS_CLIENT_H_ | |
23 | #define RADIUS_CLIENT_H_ | |
24 | ||
25 | #include "radius_message.h" | |
d1fbb0a4 | 26 | #include "radius_config.h" |
4a6b84a9 MW |
27 | |
28 | typedef struct radius_client_t radius_client_t; | |
29 | ||
30 | /** | |
31 | * RADIUS client functionality. | |
32 | * | |
33 | * To communicate with a RADIUS server, create a client and send messages over | |
2db6d5b8 | 34 | * it. The client allocates a socket from the best RADIUS server available. |
4a6b84a9 MW |
35 | */ |
36 | struct radius_client_t { | |
7daf5226 | 37 | |
4a6b84a9 MW |
38 | /** |
39 | * Send a RADIUS request and wait for the response. | |
40 | * | |
ce7967c5 | 41 | * The client fills in NAS-Identifier nad NAS-Port-Type |
4a6b84a9 MW |
42 | * |
43 | * @param msg RADIUS request message to send | |
44 | * @return response, NULL if timed out/verification failed | |
45 | */ | |
46 | radius_message_t* (*request)(radius_client_t *this, radius_message_t *msg); | |
7daf5226 | 47 | |
4a6b84a9 | 48 | /** |
ce7967c5 | 49 | * Get the EAP MSK after successful RADIUS authentication. |
4a6b84a9 | 50 | * |
ce7967c5 | 51 | * @return MSK, allocated |
4a6b84a9 | 52 | */ |
ce7967c5 | 53 | chunk_t (*get_msk)(radius_client_t *this); |
7daf5226 | 54 | |
4a6b84a9 MW |
55 | /** |
56 | * Destroy the client, release the socket. | |
57 | */ | |
58 | void (*destroy)(radius_client_t *this); | |
59 | }; | |
60 | ||
61 | /** | |
ce7967c5 | 62 | * Create a RADIUS client. |
4a6b84a9 | 63 | * |
d1fbb0a4 | 64 | * @param config reference to a server configuration, gets owned |
4a6b84a9 MW |
65 | * @return radius_client_t object |
66 | */ | |
d1fbb0a4 | 67 | radius_client_t *radius_client_create(radius_config_t *config); |
4a6b84a9 | 68 | |
1490ff4d | 69 | #endif /** RADIUS_CLIENT_H_ @}*/ |