1
0

Router.h 2.0 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 <http://www.gnu.org/licenses/>.
  14. */
  15. #ifndef Router_H
  16. #define Router_H
  17. #include "dht/Address.h"
  18. #include "memory/Allocator.h"
  19. #include "dht/dhtcore/Node.h"
  20. #include "util/Linker.h"
  21. Linker_require("dht/dhtcore/Router.c")
  22. /**
  23. * This is a facad around the other internals of dht/dhtcore.
  24. * NO OTHER FILE IN dht/dhtcore SHOULD EVER INCLUDE THIS HEADER.
  25. * Files outside of dht/dhtcore should use this instead of the others.
  26. */
  27. struct Router
  28. {
  29. int unused;
  30. };
  31. void Router_sendGetPeers(struct Router* r,
  32. struct Address* addr,
  33. uint64_t nearbyLabel,
  34. uint32_t timeoutMilliseconds,
  35. struct Allocator* alloc);
  36. struct Node_Two* Router_lookup(struct Router* r, uint8_t targetAddr[16]);
  37. void Router_brokenLink(struct Router* r, uint64_t path, uint64_t labelAtErrorHop);
  38. void Router_searchForNode(struct Router* r, uint8_t ip6[16], struct Allocator* alloc);
  39. void Router_disconnectedPeer(struct Router* r, uint64_t path);
  40. struct Node_Link* Router_linkForPath(struct Router* r, uint64_t path);
  41. #if defined(NodeStore_H) && defined(SearchRunner_H) && defined(RouterModule_H)
  42. struct Router* Router_new(struct RouterModule* rm,
  43. struct NodeStore* ns,
  44. struct SearchRunner* sr,
  45. struct Allocator* alloc);
  46. #endif
  47. #endif