TUNTools.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* vim: set expandtab ts=4 sw=4: */
  2. /*
  3. * You may redistribute this program and/or modify it under the terms of
  4. * the GNU General Public License as published by the Free Software Foundation,
  5. * either version 3 of the License, or (at your option) any later version.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. * You should have received a copy of the GNU General Public License
  13. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  14. */
  15. #ifndef TUNTools_H
  16. #define TUNTools_H
  17. #include "interface/addressable/AddrIface.h"
  18. #include "memory/Allocator.h"
  19. #include "util/log/Log.h"
  20. #include "util/platform/Sockaddr.h"
  21. #include "util/events/EventBase.h"
  22. #include "util/Linker.h"
  23. Linker_require("interface/tuntap/test/TUNTools.c")
  24. struct TUNTools;
  25. typedef Iface_DEFUN (* TUNTools_Callback)(struct Message* msg, struct TUNTools* tt);
  26. Iface_DEFUN TUNTools_genericIP6Echo(struct Message* msg, struct TUNTools* tt);
  27. extern const uint8_t* TUNTools_testIP6AddrA;
  28. extern const uint8_t* TUNTools_testIP6AddrB;
  29. extern const uint8_t* TUNTools_testIP6AddrC;
  30. struct TUNTools
  31. {
  32. struct Iface tunIface;
  33. struct Iface udpIface;
  34. struct Sockaddr* tunDestAddr;
  35. struct Sockaddr* udpBindTo;
  36. struct Allocator* alloc;
  37. struct Log* log;
  38. struct EventBase* base;
  39. TUNTools_Callback cb;
  40. int receivedMessageTUNCount;
  41. };
  42. void TUNTools_echoTest(struct Sockaddr* udpBindTo,
  43. struct Sockaddr* tunDestAddr,
  44. TUNTools_Callback tunMessageHandler,
  45. struct Iface* tun,
  46. struct EventBase* base,
  47. struct Log* logger,
  48. struct Allocator* alloc);
  49. #endif