eap_example.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. #include "includes.h"
  12. #include "common.h"
  13. int eap_example_peer_init(void);
  14. void eap_example_peer_deinit(void);
  15. int eap_example_peer_step(void);
  16. int eap_example_server_init(void);
  17. void eap_example_server_deinit(void);
  18. int eap_example_server_step(void);
  19. extern int wpa_debug_level;
  20. int main(int argc, char *argv[])
  21. {
  22. int res_s, res_p;
  23. wpa_debug_level = 0;
  24. if (eap_example_peer_init() < 0 ||
  25. eap_example_server_init() < 0)
  26. return -1;
  27. do {
  28. printf("---[ server ]--------------------------------\n");
  29. res_s = eap_example_server_step();
  30. printf("---[ peer ]----------------------------------\n");
  31. res_p = eap_example_peer_step();
  32. } while (res_s || res_p);
  33. eap_example_peer_deinit();
  34. eap_example_server_deinit();
  35. return 0;
  36. }