1
0

PeeringSeeder.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 PeeringQuerier_H
  16. #define PeeringQuerier_H
  17. // Try to get our public IP -> List of peers + SwitchPinger
  18. // Try to get the current snode -> Notify from SubnodePathfinder.
  19. // Send the peering info to the snode as an unsigned message -> MsgCore
  20. #include "crypto/Ca.h"
  21. #include "dht/Address.h"
  22. #include "net/SwitchPinger.h"
  23. #include "subnode/MsgCore.h"
  24. #include "subnode/ReachabilityCollector.h"
  25. #include "util/Linker.h"
  26. Linker_require("subnode/PeeringSeeder.c")
  27. typedef struct PeeringSeeder {
  28. Iface_t* seederIface;
  29. } PeeringSeeder_t;
  30. typedef struct PeeringSeeder_PublicStatus {
  31. bool active;
  32. String_t* peerId;
  33. String_t* ipv4;
  34. String_t* ipv6;
  35. String_t* snode;
  36. } PeeringSeeder_PublicStatus_t;
  37. Err_DEFUN PeeringSeeder_publicStatus(PeeringSeeder_PublicStatus_t** outP, PeeringSeeder_t* self, Allocator_t* alloc);
  38. void PeeringSeeder_setSnode(PeeringSeeder_t* self, struct Address* snode);
  39. #define PeeringSeeder_publicPeer_ID_MAX_LEN 30
  40. Err_DEFUN PeeringSeeder_publicPeer(
  41. PeeringSeeder_t* self,
  42. String_t* code,
  43. String_t* addr4,
  44. String_t* addr6,
  45. Allocator_t* reqAlloc);
  46. // Get as a void pointer so that we don't need to pull in Rffi
  47. void* PeeringSeeder_getRsSeeder(PeeringSeeder_t* self);
  48. PeeringSeeder_t* PeeringSeeder_new(
  49. struct SwitchPinger* sp,
  50. struct ReachabilityCollector* rc,
  51. Allocator_t* alloc,
  52. Log_t* log,
  53. struct MsgCore* mc,
  54. EventBase_t* base,
  55. Ca_t* ca);
  56. #endif