list-taps.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * OpenConnect (SSL + DTLS) VPN client
  3. *
  4. * Copyright © 2019 David Woodhouse
  5. *
  6. * Author: David Woodhouse <dwmw2@infradead.org>
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public License
  10. * version 2.1, as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. */
  17. #include <config.h>
  18. #include <stdint.h>
  19. #include <stdio.h>
  20. #define __OPENCONNECT_INTERNAL_H__
  21. #define vpn_progress(v, d, ...) printf(__VA_ARGS__)
  22. #define _(x) x
  23. struct openconnect_info {
  24. char *ifname;
  25. };
  26. #define OPEN_TUN_SOFTFAIL 0
  27. #define OPEN_TUN_HARDFAIL -1
  28. #define __LIST_TAPS__
  29. #include "../tun-win32.c"
  30. static intptr_t print_tun(struct openconnect_info *vpninfo, int type, char *guid, wchar_t *wname)
  31. {
  32. printf("Found %s device '%S' guid %s\n",
  33. type ? "Wintun" : "Tap", wname, guid);
  34. return 0;
  35. }
  36. int main(void)
  37. {
  38. search_taps(NULL, print_tun);
  39. return 0;
  40. }