Router.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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_disconnectedPeer(struct Router* r, uint64_t path);
  39. struct Node_Link* Router_linkForPath(struct Router* r, uint64_t path);
  40. #if defined(NodeStore_H) && defined(SearchRunner_H) && defined(RouterModule_H)
  41. struct Router* Router_new(struct RouterModule* rm,
  42. struct NodeStore* ns,
  43. struct SearchRunner* sr,
  44. struct Allocator* alloc);
  45. #endif
  46. #endif