SCARD: Clean up SIM/USIM selection
[mech_eap.git] / eap_example / eap_example.c
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  *
8  * This software may be distributed under the terms of the BSD license.
9  * See README for more details.
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
26 extern int wpa_debug_level;
27
28 int 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 }