LinuxRoutingTable.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * ZeroTier One - Network Virtualization Everywhere
  3. * Copyright (C) 2011-2016 ZeroTier, Inc. https://www.zerotier.com/
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef ZT_LINUXROUTINGTABLE_HPP
  19. #define ZT_LINUXROUTINGTABLE_HPP
  20. #include "../node/Constants.hpp"
  21. #ifdef __LINUX__
  22. #include <vector>
  23. #include "RoutingTableEntry.hpp"
  24. namespace ZeroTier {
  25. /**
  26. * Routing table interface via /proc/net/route, /proc/net/ipv6_route, and /sbin/route command
  27. */
  28. class LinuxRoutingTable
  29. {
  30. public:
  31. LinuxRoutingTable();
  32. ~LinuxRoutingTable();
  33. std::vector<RoutingTableEntry> get(bool includeLinkLocal = false,bool includeLoopback = false) const;
  34. RoutingTableEntry set(const InetAddress &destination,const InetAddress &gateway,const char *device,int metric);
  35. };
  36. } // namespace ZeroTier
  37. #endif // __LINUX__
  38. #endif