mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-17 15:25:35 +00:00
64 lines
1.3 KiB
C
64 lines
1.3 KiB
C
#ifndef LLARP_RC_H
|
|
#define LLARP_RC_H
|
|
#include <llarp/address_info.h>
|
|
#include <llarp/crypto.h>
|
|
#include <llarp/exit_info.h>
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
// forward declare
|
|
struct llarp_alloc;
|
|
|
|
#define MAX_RC_SIZE (1024)
|
|
|
|
struct llarp_rc
|
|
{
|
|
struct llarp_ai_list *addrs;
|
|
// public encryption public key
|
|
byte_t enckey[PUBKEYSIZE];
|
|
// public signing public key
|
|
byte_t pubkey[PUBKEYSIZE];
|
|
struct llarp_xi_list *exits;
|
|
byte_t signature[SIGSIZE];
|
|
uint64_t last_updated;
|
|
};
|
|
|
|
bool
|
|
llarp_rc_bdecode(struct llarp_rc *rc, llarp_buffer_t *buf);
|
|
bool
|
|
llarp_rc_bencode(struct llarp_rc *rc, llarp_buffer_t *buf);
|
|
|
|
void
|
|
llarp_rc_free(struct llarp_rc *rc);
|
|
|
|
bool
|
|
llarp_rc_verify_sig(struct llarp_crypto *crypto, struct llarp_rc *rc);
|
|
|
|
void
|
|
llarp_rc_copy(struct llarp_rc *dst, const struct llarp_rc *src);
|
|
|
|
void
|
|
llarp_rc_set_addrs(struct llarp_rc *rc, struct llarp_alloc *mem,
|
|
struct llarp_ai_list *addr);
|
|
void
|
|
llarp_rc_set_pubkey(struct llarp_rc *rc, const uint8_t *pubkey);
|
|
|
|
void
|
|
llarp_rc_sign(struct llarp_crypto *crypto, const byte_t *seckey,
|
|
struct llarp_rc *rc);
|
|
|
|
void
|
|
llarp_rc_clear(struct llarp_rc *rc);
|
|
|
|
bool
|
|
llarp_rc_addr_list_iter(struct llarp_ai_list_iter *iter, struct llarp_ai *ai);
|
|
|
|
bool
|
|
llarp_rc_write(struct llarp_rc *rc, const char *our_rc_file);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif
|