eap_example.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. * Alternatively, this software may be distributed under the terms of BSD
  13. * license.
  14. *
  15. * See README and COPYING for more details.
  16. */
  17. #include "includes.h"
  18. #include "common.h"
  19. int eap_example_peer_init(void);
  20. void eap_example_peer_deinit(void);
  21. int eap_example_peer_step(void);
  22. int eap_example_server_init(void);
  23. void eap_example_server_deinit(void);
  24. int eap_example_server_step(void);
  25. extern int wpa_debug_level;
  26. int main(int argc, char *argv[])
  27. {
  28. int res_s, res_p;
  29. wpa_debug_level = 0;
  30. if (eap_example_peer_init() < 0 ||
  31. eap_example_server_init() < 0)
  32. return -1;
  33. do {
  34. printf("---[ server ]--------------------------------\n");
  35. res_s = eap_example_server_step();
  36. printf("---[ peer ]----------------------------------\n");
  37. res_p = eap_example_peer_step();
  38. } while (res_s || res_p);
  39. eap_example_peer_deinit();
  40. eap_example_server_deinit();
  41. return 0;
  42. }