1
0

Rffi.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. #ifndef rffi_H
  2. #define rffi_H
  3. // This file is generated from src/rffi.rs using cbindgen
  4. #include "RffiPrefix.h"
  5. typedef struct RTypes_CryptoAuth2_t RTypes_CryptoAuth2_t;
  6. typedef struct {
  7. uint8_t octets[16];
  8. uint8_t netmask[16];
  9. bool is_ipv6;
  10. } Rffi_Address;
  11. typedef struct {
  12. const char *name;
  13. uint8_t phys_addr[6];
  14. bool is_internal;
  15. Rffi_Address address;
  16. } Rffi_NetworkInterface;
  17. extern const uintptr_t Rffi_CURRENT_PROTOCOL;
  18. RTypes_IfWrapper_t Rffi_testwrapper_create(Allocator_t *a);
  19. RTypes_IfWrapper_t Rffi_android_create(Allocator_t *a);
  20. int Rffi_CryptoAuth2_addUser_ipv6(String_t *password,
  21. String_t *login,
  22. uint8_t *ipv6,
  23. RTypes_CryptoAuth2_t *ca);
  24. int Rffi_CryptoAuth2_removeUsers(RTypes_CryptoAuth2_t *context, String_t *user);
  25. RTypes_StrList_t *Rffi_CryptoAuth2_getUsers(const RTypes_CryptoAuth2_t *ca, Allocator_t *alloc);
  26. RTypes_CryptoAuth2_t *Rffi_CryptoAuth2_new(Allocator_t *allocator,
  27. const uint8_t *privateKey,
  28. Random_t *random);
  29. void Rffi_CryptoAuth2_tryHandshake(RTypes_CryptoAuth2_t *ca,
  30. Message_t *c_msg,
  31. Allocator_t *alloc,
  32. bool requireAuth,
  33. RTypes_CryptoAuth2_TryHandshake_Ret_t *ret);
  34. RTypes_CryptoAuth2_Session_t *Rffi_CryptoAuth2_newSession(RTypes_CryptoAuth2_t *ca,
  35. Allocator_t *alloc,
  36. const uint8_t *herPublicKey,
  37. bool requireAuth,
  38. const char *name,
  39. bool useNoise);
  40. Message_t *Rffi_CryptoAuth2_noiseTick(RTypes_CryptoAuth2_Session_t *sess, Allocator_t *alloc);
  41. void Rffi_CryptoAuth2_setAuth(const String_t *password,
  42. const String_t *login,
  43. RTypes_CryptoAuth2_Session_t *caSession);
  44. void Rffi_CryptoAuth2_resetIfTimeout(RTypes_CryptoAuth2_Session_t *session);
  45. void Rffi_CryptoAuth2_reset(RTypes_CryptoAuth2_Session_t *caSession);
  46. RTypes_CryptoAuth_State_t Rffi_CryptoAuth2_getState(RTypes_CryptoAuth2_Session_t *session);
  47. void Rffi_CryptoAuth2_getHerPubKey(const RTypes_CryptoAuth2_Session_t *session, uint8_t *pkOut);
  48. void Rffi_CryptoAuth2_getHerIp6(const RTypes_CryptoAuth2_Session_t *session, uint8_t *ipOut);
  49. String_t *Rffi_CryptoAuth2_getName(const RTypes_CryptoAuth2_Session_t *session, Allocator_t *alloc);
  50. void Rffi_CryptoAuth2_getPubKey(const RTypes_CryptoAuth2_t *ca, uint8_t *pkOut);
  51. void Rffi_CryptoAuth2_stats(const RTypes_CryptoAuth2_Session_t *session,
  52. RTypes_CryptoStats_t *statsOut);
  53. uint32_t Rffi_CryptoAuth2_cjdnsVer(const RTypes_CryptoAuth2_Session_t *session);
  54. void Rffi_panic(const char *msg);
  55. void Rffi_setLogger(Log_t *l);
  56. RTypes_Error_t *Rffi_error(const char *msg, Allocator_t *alloc);
  57. RTypes_Error_t *Rffi_error_fl(const char *msg, const char *file, int line, Allocator_t *alloc);
  58. const char *Rffi_printError(RTypes_Error_t *e, Allocator_t *alloc);
  59. /**
  60. * Convert IPv4 and IPv6 addresses from binary to text form.
  61. */
  62. int32_t Rffi_inet_ntop(bool is_ip6, const void *addr, uint8_t *dst, uint32_t dst_sz);
  63. /**
  64. * Convert IPv4 and IPv6 addresses from text to binary form.
  65. */
  66. int32_t Rffi_inet_pton(bool is_ip6, const char *src, uint8_t *addr);
  67. /**
  68. * Non-monotonic nanosecond time, which has no relationship to any wall clock.
  69. */
  70. uint64_t Rffi_hrtime(void);
  71. /**
  72. * Monotonic millisecond time.
  73. */
  74. uint64_t Rffi_now_ms(void);
  75. /**
  76. * Get a list of available network interfaces for the current machine.
  77. */
  78. int32_t Rffi_interface_addresses(const Rffi_NetworkInterface **out, Allocator_t *alloc);
  79. /**
  80. * Get the full filesystem path of the current running executable.
  81. */
  82. int32_t Rffi_exepath(const char **out, Allocator_t *alloc);
  83. /**
  84. * Spawn a new child process, and monitors its result.
  85. */
  86. int32_t Rffi_spawn(const char *file,
  87. const char *const *args,
  88. int num_args,
  89. Allocator_t *_alloc,
  90. void (*cb)(long, int));
  91. #endif /* rffi_H */