Jouni Malinen | 6fc6879 | 2008-02-27 17:34:43 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Example application showing how EAP peer and server code from |
| 3 | * wpa_supplicant/hostapd can be used as a library. This example program |
| 4 | * initializes both an EAP server and an EAP peer entities and then runs |
| 5 | * through an EAP-PEAP/MSCHAPv2 authentication. |
| 6 | * Copyright (c) 2007, Jouni Malinen <j@w1.fi> |
| 7 | * |
Jouni Malinen | 0f3d578 | 2012-02-11 16:46:35 +0200 | [diff] [blame] | 8 | * This software may be distributed under the terms of the BSD license. |
| 9 | * See README for more details. |
Jouni Malinen | 6fc6879 | 2008-02-27 17:34:43 -0800 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | #include "includes.h" |
| 13 | |
| 14 | #include "common.h" |
| 15 | |
| 16 | |
| 17 | int eap_example_peer_init(void); |
| 18 | void eap_example_peer_deinit(void); |
| 19 | int eap_example_peer_step(void); |
| 20 | |
| 21 | int eap_example_server_init(void); |
| 22 | void eap_example_server_deinit(void); |
| 23 | int eap_example_server_step(void); |
| 24 | |
| 25 | |
Jouni Malinen | 6fc6879 | 2008-02-27 17:34:43 -0800 | [diff] [blame] | 26 | int main(int argc, char *argv[]) |
| 27 | { |
| 28 | int res_s, res_p; |
| 29 | |
| 30 | wpa_debug_level = 0; |
| 31 | |
| 32 | if (eap_example_peer_init() < 0 || |
| 33 | eap_example_server_init() < 0) |
| 34 | return -1; |
| 35 | |
| 36 | do { |
| 37 | printf("---[ server ]--------------------------------\n"); |
| 38 | res_s = eap_example_server_step(); |
| 39 | printf("---[ peer ]----------------------------------\n"); |
| 40 | res_p = eap_example_peer_step(); |
| 41 | } while (res_s || res_p); |
| 42 | |
| 43 | eap_example_peer_deinit(); |
| 44 | eap_example_server_deinit(); |
| 45 | |
| 46 | return 0; |
| 47 | } |