eap_example.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. int main(int argc, char *argv[])
  20. {
  21. int res_s, res_p;
  22. wpa_debug_level = 0;
  23. if (eap_example_peer_init() < 0 ||
  24. eap_example_server_init() < 0)
  25. return -1;
  26. do {
  27. printf("---[ server ]--------------------------------\n");
  28. res_s = eap_example_server_step();
  29. printf("---[ peer ]----------------------------------\n");
  30. res_p = eap_example_peer_step();
  31. } while (res_s || res_p);
  32. eap_example_peer_deinit();
  33. eap_example_server_deinit();
  34. return 0;
  35. }