b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | Example application using RADIUS client as a library |
| 2 | Copyright (c) 2007, Jouni Malinen <j@w1.fi> |
| 3 | |
| 4 | This software may be distributed under the terms of the BSD license. |
| 5 | See the parent directory README for more details. |
| 6 | |
| 7 | |
| 8 | This directory contains an example showing how the RADIUS client |
| 9 | functionality from hostapd can be used as a library in another |
| 10 | program. The example program initializes the RADIUS client and send a |
| 11 | Access-Request using User-Name and User-Password attributes. A reply |
| 12 | from the RADIUS authentication server will be processed and it is used |
| 13 | as a trigger to terminate the example program. |
| 14 | |
| 15 | The RADIUS library links in couple of helper functions from src/utils and |
| 16 | src/crypto directories. Most of these are suitable as-is, but it may |
| 17 | be desirable to replace the debug output code in src/utils/wpa_debug.c |
| 18 | by dropping this file from the library and re-implementing the |
| 19 | functions there in a way that better fits in with the main |
| 20 | application. |
| 21 | |
| 22 | RADIUS client implementation takes care of receiving messages, |
| 23 | timeouts, and retransmissions of packets. Consequently, it requires |
| 24 | functionality for registering timeouts and received packet |
| 25 | notifications. This is implemented using the generic event loop |
| 26 | implementation (see src/utils/eloop.h). |
| 27 | |
| 28 | The main application may either use the included event loop |
| 29 | implementation or alternatively, implement eloop_* wrapper functions |
| 30 | to use whatever event loop design is used in the main program. This |
| 31 | would involve removing src/utils/eloop.o from the library and |
| 32 | implementing following functions defines in src/utils/eloop.h: |
| 33 | eloop_register_timeout(), eloop_cancel_timeout(), |
| 34 | eloop_register_read_sock(), eloop_unregister_read_sock(), and |
| 35 | eloop_terminated(). |