mirror of https://github.com/waku-org/nwaku.git
122 lines
4.0 KiB
C
122 lines
4.0 KiB
C
|
|
// Generated manually and inspired by the one generated by the Nim Compiler.
|
|
// In order to see the header file generated by Nim just run `make libwaku`
|
|
// from the root repo folder and the header should be created in
|
|
// nimcache/release/libwaku/libwaku.h
|
|
#ifndef __libwaku__
|
|
#define __libwaku__
|
|
|
|
#include <stddef.h>
|
|
|
|
// The possible returned values for the functions that return int
|
|
#define RET_OK 0
|
|
#define RET_ERR 1
|
|
#define RET_MISSING_CALLBACK 2
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef void (*WakuCallBack) (int callerRet, const char* msg, size_t len, void* userData);
|
|
|
|
// Initializes the library. Should be called before any other function
|
|
void waku_setup();
|
|
|
|
// Creates a new instance of the waku node.
|
|
// Sets up the waku node from the given configuration.
|
|
// Returns a pointer to the Context needed by the rest of the API functions.
|
|
void* waku_new(
|
|
const char* configJson,
|
|
WakuCallBack callback,
|
|
void* userData);
|
|
|
|
int waku_start(void* ctx,
|
|
WakuCallBack callback,
|
|
void* userData);
|
|
|
|
int waku_stop(void* ctx,
|
|
WakuCallBack callback,
|
|
void* userData);
|
|
|
|
// Destroys an instance of a waku node created with waku_new
|
|
int waku_destroy(void* ctx,
|
|
WakuCallBack callback,
|
|
void* userData);
|
|
|
|
int waku_version(void* ctx,
|
|
WakuCallBack callback,
|
|
void* userData);
|
|
|
|
void waku_set_event_callback(void* ctx,
|
|
WakuCallBack callback,
|
|
void* userData);
|
|
|
|
int waku_content_topic(void* ctx,
|
|
const char* appName,
|
|
unsigned int appVersion,
|
|
const char* contentTopicName,
|
|
const char* encoding,
|
|
WakuCallBack callback,
|
|
void* userData);
|
|
|
|
int waku_pubsub_topic(void* ctx,
|
|
const char* topicName,
|
|
WakuCallBack callback,
|
|
void* userData);
|
|
|
|
int waku_default_pubsub_topic(void* ctx,
|
|
WakuCallBack callback,
|
|
void* userData);
|
|
|
|
int waku_relay_publish(void* ctx,
|
|
const char* pubSubTopic,
|
|
const char* jsonWakuMessage,
|
|
unsigned int timeoutMs,
|
|
WakuCallBack callback,
|
|
void* userData);
|
|
|
|
int waku_relay_subscribe(void* ctx,
|
|
const char* pubSubTopic,
|
|
WakuCallBack callback,
|
|
void* userData);
|
|
|
|
int waku_relay_unsubscribe(void* ctx,
|
|
const char* pubSubTopic,
|
|
WakuCallBack callback,
|
|
void* userData);
|
|
|
|
int waku_connect(void* ctx,
|
|
const char* peerMultiAddr,
|
|
unsigned int timeoutMs,
|
|
WakuCallBack callback,
|
|
void* userData);
|
|
|
|
int waku_listen_addresses(void* ctx,
|
|
WakuCallBack callback,
|
|
void* userData);
|
|
|
|
// Returns a list of multiaddress given a url to a DNS discoverable ENR tree
|
|
// Parameters
|
|
// char* entTreeUrl: URL containing a discoverable ENR tree
|
|
// char* nameDnsServer: The nameserver to resolve the ENR tree url.
|
|
// int timeoutMs: Timeout value in milliseconds to execute the call.
|
|
int waku_dns_discovery(void* ctx,
|
|
const char* entTreeUrl,
|
|
const char* nameDnsServer,
|
|
int timeoutMs,
|
|
WakuCallBack callback,
|
|
void* userData);
|
|
|
|
// Updates the bootnode list used for discovering new peers via DiscoveryV5
|
|
// bootnodes - JSON array containing the bootnode ENRs i.e. `["enr:...", "enr:..."]`
|
|
int waku_discv5_update_bootnodes(void* ctx,
|
|
char* bootnodes,
|
|
WakuCallBack callback,
|
|
void* userData);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* __libwaku__ */
|