RouteGen.h 1.9 KB

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