libwpa_test.c 611 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * libwpa_test - Test program for libwpa_client.* library linking
  3. * Copyright (c) 2015, Jouni Malinen <j@w1.fi>
  4. *
  5. * This software may be distributed under the terms of the BSD license.
  6. * See README for more details.
  7. */
  8. #include "includes.h"
  9. #include "common/wpa_ctrl.h"
  10. int main(int argc, char *argv[])
  11. {
  12. struct wpa_ctrl *ctrl;
  13. ctrl = wpa_ctrl_open("foo");
  14. if (!ctrl)
  15. return -1;
  16. if (wpa_ctrl_attach(ctrl) == 0)
  17. wpa_ctrl_detach(ctrl);
  18. if (wpa_ctrl_pending(ctrl)) {
  19. char buf[10];
  20. size_t len;
  21. len = sizeof(buf);
  22. wpa_ctrl_recv(ctrl, buf, &len);
  23. }
  24. wpa_ctrl_close(ctrl);
  25. return 0;
  26. }