mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-27 04:26:07 +00:00
3c2daa8b80
* dummy c lib * go stuffz * Compile secp * Compile as shared library * Build with debug info * Prelude exposed fns with setupForeignThreadGc() (naive) To avoid GC/thread issues causing segmentation fault when running from Go. * Add logging, fix lib path and gomaxprocs to make debuggable * lock to os thread * Address basic feedback and mark TODOs * Use normal secp (shared lib flow now) * api: cleanup, move to api folder
33 lines
796 B
C
33 lines
796 B
C
#include <stdint.h>
|
|
#include <stddef.h>
|
|
|
|
typedef struct {
|
|
uint8_t* decoded;
|
|
size_t decodedLen;
|
|
uint32_t timestamp;
|
|
uint32_t ttl;
|
|
uint8_t topic[4];
|
|
double pow;
|
|
uint8_t hash[32];
|
|
} received_message;
|
|
|
|
typedef void (*received_msg_handler)(received_message* msg);
|
|
|
|
/** Initialize Nim and the status library */
|
|
void NimMain();
|
|
|
|
/** Start nimbus event loop, connect to bootnodes etc */
|
|
void nimbus_start(uint16_t port);
|
|
|
|
/** Add peers to connect to - must be called after nimbus_start */
|
|
void nimbus_add_peer(const char* nodeId);
|
|
|
|
/**
|
|
* Should be called in regularly - for example in a busy loop (beautiful!) on
|
|
* dedicated thread.
|
|
*/
|
|
void nimbus_poll();
|
|
|
|
void nimbus_post(const char* channel, const char* payload);
|
|
void nimbus_subscribe(const char* channel, received_msg_handler msg);
|