aboutsummaryrefslogtreecommitdiffstats
path: root/eap_example/eap_example.c
blob: b8917c8c351307e6a8265d12794df40b9e423636 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
 * Example application showing how EAP peer and server code from
 * wpa_supplicant/hostapd can be used as a library. This example program
 * initializes both an EAP server and an EAP peer entities and then runs
 * through an EAP-PEAP/MSCHAPv2 authentication.
 * Copyright (c) 2007, Jouni Malinen <j@w1.fi>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * Alternatively, this software may be distributed under the terms of BSD
 * license.
 *
 * See README and COPYING for more details.
 */

#include "includes.h"

#include "common.h"


int eap_example_peer_init(void);
void eap_example_peer_deinit(void);
int eap_example_peer_step(void);

int eap_example_server_init(void);
void eap_example_server_deinit(void);
int eap_example_server_step(void);


extern int wpa_debug_level;

int main(int argc, char *argv[])
{
	int res_s, res_p;

	wpa_debug_level = 0;

	if (eap_example_peer_init() < 0 ||
	    eap_example_server_init() < 0)
		return -1;

	do {
		printf("---[ server ]--------------------------------\n");
		res_s = eap_example_server_step();
		printf("---[ peer ]----------------------------------\n");
		res_p = eap_example_peer_step();
	} while (res_s || res_p);

	eap_example_peer_deinit();
	eap_example_server_deinit();

	return 0;
}