RouteGen.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 RouteGen_H
  16. #define RouteGen_H
  17. #include "util/platform/Sockaddr.h"
  18. #include "exception/Err.h"
  19. #include "util/log/Log.h"
  20. #include "util/Linker.h"
  21. Linker_require("tunnel/RouteGen.c")
  22. #include <stdbool.h>
  23. struct RouteGen
  24. {
  25. bool hasUncommittedChanges;
  26. };
  27. void RouteGen_addException(struct RouteGen* rg, struct Sockaddr* exempt);
  28. void RouteGen_addPrefix(struct RouteGen* rg, struct Sockaddr* destination);
  29. void RouteGen_addLocalPrefix(struct RouteGen* rg, struct Sockaddr* destination);
  30. Err_DEFUN RouteGen_commit(struct RouteGen* rg,
  31. const char* tunName,
  32. struct Allocator* tempAlloc);
  33. Dict* RouteGen_getPrefixes(struct RouteGen* rg, struct Allocator* alloc);
  34. Dict* RouteGen_getLocalPrefixes(struct RouteGen* rg, struct Allocator* alloc);
  35. Dict* RouteGen_getExceptions(struct RouteGen* rg, struct Allocator* alloc);
  36. Dict* RouteGen_getGeneratedRoutes(struct RouteGen* rg, struct Allocator* alloc);
  37. bool RouteGen_removePrefix(struct RouteGen* rg, struct Sockaddr* toRemove);
  38. bool RouteGen_removeLocalPrefix(struct RouteGen* rg, struct Sockaddr* toRemove);
  39. bool RouteGen_removeException(struct RouteGen* rg, struct Sockaddr* toRemove);
  40. struct RouteGen* RouteGen_new(struct Allocator* allocator, struct Log* log);
  41. #endif