blob: 68f3c002ca929f8b0eb64777d3c53cb357a730e2 [file] [log] [blame]
Jouni Malinen6fc68792008-02-27 17:34:43 -08001/*
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 Malinen0f3d5782012-02-11 16:46:35 +02008 * This software may be distributed under the terms of the BSD license.
9 * See README for more details.
Jouni Malinen6fc68792008-02-27 17:34:43 -080010 */
11
12#include "includes.h"
13
14#include "common.h"
15
16
17int eap_example_peer_init(void);
18void eap_example_peer_deinit(void);
19int eap_example_peer_step(void);
20
21int eap_example_server_init(void);
22void eap_example_server_deinit(void);
23int eap_example_server_step(void);
24
25
26extern int wpa_debug_level;
27
28int main(int argc, char *argv[])
29{
30 int res_s, res_p;
31
32 wpa_debug_level = 0;
33
34 if (eap_example_peer_init() < 0 ||
35 eap_example_server_init() < 0)
36 return -1;
37
38 do {
39 printf("---[ server ]--------------------------------\n");
40 res_s = eap_example_server_step();
41 printf("---[ peer ]----------------------------------\n");
42 res_p = eap_example_peer_step();
43 } while (res_s || res_p);
44
45 eap_example_peer_deinit();
46 eap_example_server_deinit();
47
48 return 0;
49}