RouteGen.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 <http://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. void RouteGen_commit(struct RouteGen* rg,
  32. const char* tunName,
  33. struct Allocator* tempAlloc,
  34. struct Except* eh);
  35. Dict* RouteGen_getPrefixes(struct RouteGen* rg, struct Allocator* alloc);
  36. Dict* RouteGen_getLocalPrefixes(struct RouteGen* rg, struct Allocator* alloc);
  37. Dict* RouteGen_getExceptions(struct RouteGen* rg, struct Allocator* alloc);
  38. Dict* RouteGen_getGeneratedRoutes(struct RouteGen* rg, struct Allocator* alloc);
  39. bool RouteGen_removePrefix(struct RouteGen* rg, struct Sockaddr* toRemove);
  40. bool RouteGen_removeLocalPrefix(struct RouteGen* rg, struct Sockaddr* toRemove);
  41. bool RouteGen_removeException(struct RouteGen* rg, struct Sockaddr* toRemove);
  42. struct RouteGen* RouteGen_new(struct Allocator* allocator, struct Log* log);
  43. #endif