PeeringSeeder.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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(PeeringSeeder_t* self, String* code, Allocator_t* reqAlloc);
  41. // Get as a void pointer so that we don't need to pull in Rffi
  42. void* PeeringSeeder_getRsSeeder(PeeringSeeder_t* self);
  43. PeeringSeeder_t* PeeringSeeder_new(
  44. struct SwitchPinger* sp,
  45. struct ReachabilityCollector* rc,
  46. Allocator_t* alloc,
  47. Log_t* log,
  48. struct MsgCore* mc,
  49. EventBase_t* base,
  50. Ca_t* ca);
  51. #endif