2023-07-07 08:53:00 +00:00
|
|
|
|
|
|
|
// 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__
|
|
|
|
|
2024-02-13 14:21:31 +00:00
|
|
|
#include <stddef.h>
|
2024-09-11 08:13:54 +00:00
|
|
|
#include <stdint.h>
|
2024-02-13 14:21:31 +00:00
|
|
|
|
2023-07-07 08:53:00 +00:00
|
|
|
// The possible returned values for the functions that return int
|
|
|
|
#define RET_OK 0
|
|
|
|
#define RET_ERR 1
|
|
|
|
#define RET_MISSING_CALLBACK 2
|
|
|
|
|
2023-09-28 09:10:42 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2024-02-13 14:22:22 +00:00
|
|
|
typedef void (*WakuCallBack) (int callerRet, const char* msg, size_t len, void* userData);
|
2023-10-23 06:37:28 +00:00
|
|
|
|
2023-07-07 08:53:00 +00:00
|
|
|
// Creates a new instance of the waku node.
|
|
|
|
// Sets up the waku node from the given configuration.
|
2023-12-15 12:32:12 +00:00
|
|
|
// Returns a pointer to the Context needed by the rest of the API functions.
|
|
|
|
void* waku_new(
|
2023-10-23 06:37:28 +00:00
|
|
|
const char* configJson,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
2023-07-07 08:53:00 +00:00
|
|
|
|
2023-10-23 06:37:28 +00:00
|
|
|
int waku_start(void* ctx,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
2023-07-07 08:53:00 +00:00
|
|
|
|
2023-10-23 06:37:28 +00:00
|
|
|
int waku_stop(void* ctx,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
2023-07-07 08:53:00 +00:00
|
|
|
|
2024-03-07 17:53:03 +00:00
|
|
|
// Destroys an instance of a waku node created with waku_new
|
|
|
|
int waku_destroy(void* ctx,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
|
|
|
|
2023-10-23 06:37:28 +00:00
|
|
|
int waku_version(void* ctx,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
2023-07-07 08:53:00 +00:00
|
|
|
|
2024-02-13 14:22:22 +00:00
|
|
|
void waku_set_event_callback(void* ctx,
|
|
|
|
WakuCallBack callback,
|
2023-10-23 06:37:28 +00:00
|
|
|
void* userData);
|
2023-07-07 08:53:00 +00:00
|
|
|
|
2023-10-23 06:37:28 +00:00
|
|
|
int waku_content_topic(void* ctx,
|
|
|
|
const char* appName,
|
2023-07-07 08:53:00 +00:00
|
|
|
unsigned int appVersion,
|
|
|
|
const char* contentTopicName,
|
|
|
|
const char* encoding,
|
2023-10-23 06:37:28 +00:00
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
2023-07-07 08:53:00 +00:00
|
|
|
|
2023-10-23 06:37:28 +00:00
|
|
|
int waku_pubsub_topic(void* ctx,
|
|
|
|
const char* topicName,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
2023-07-07 08:53:00 +00:00
|
|
|
|
2023-10-23 06:37:28 +00:00
|
|
|
int waku_default_pubsub_topic(void* ctx,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
2023-07-07 08:53:00 +00:00
|
|
|
|
2023-10-23 06:37:28 +00:00
|
|
|
int waku_relay_publish(void* ctx,
|
|
|
|
const char* pubSubTopic,
|
2023-07-07 08:53:00 +00:00
|
|
|
const char* jsonWakuMessage,
|
|
|
|
unsigned int timeoutMs,
|
2023-10-23 06:37:28 +00:00
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
2023-07-07 08:53:00 +00:00
|
|
|
|
2024-08-29 12:29:02 +00:00
|
|
|
int waku_lightpush_publish(void* ctx,
|
|
|
|
const char* pubSubTopic,
|
|
|
|
const char* jsonWakuMessage,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
|
|
|
|
2023-10-23 06:37:28 +00:00
|
|
|
int waku_relay_subscribe(void* ctx,
|
|
|
|
const char* pubSubTopic,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
2023-07-07 08:53:00 +00:00
|
|
|
|
2023-10-23 06:37:28 +00:00
|
|
|
int waku_relay_unsubscribe(void* ctx,
|
|
|
|
const char* pubSubTopic,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
2023-07-07 08:53:00 +00:00
|
|
|
|
2024-11-29 14:31:08 +00:00
|
|
|
int waku_filter_subscribe(void* ctx,
|
|
|
|
const char* pubSubTopic,
|
|
|
|
const char* contentTopics,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
|
|
|
|
|
|
|
int waku_filter_unsubscribe(void* ctx,
|
|
|
|
const char* pubSubTopic,
|
|
|
|
const char* contentTopics,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
|
|
|
|
|
|
|
int waku_filter_unsubscribe_all(void* ctx,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
|
|
|
|
2024-08-29 12:29:02 +00:00
|
|
|
int waku_relay_get_num_connected_peers(void* ctx,
|
|
|
|
const char* pubSubTopic,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
|
|
|
|
|
|
|
int waku_relay_get_num_peers_in_mesh(void* ctx,
|
|
|
|
const char* pubSubTopic,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
|
|
|
|
|
|
|
int waku_store_query(void* ctx,
|
|
|
|
const char* jsonQuery,
|
|
|
|
const char* peerAddr,
|
|
|
|
int timeoutMs,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
|
|
|
|
2023-10-23 06:37:28 +00:00
|
|
|
int waku_connect(void* ctx,
|
|
|
|
const char* peerMultiAddr,
|
2023-07-07 08:53:00 +00:00
|
|
|
unsigned int timeoutMs,
|
2023-10-23 06:37:28 +00:00
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
2024-10-15 12:32:02 +00:00
|
|
|
|
|
|
|
int waku_disconnect_peer_by_id(void* ctx,
|
|
|
|
const char* peerId,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
|
|
|
|
2024-10-30 14:26:33 +00:00
|
|
|
int waku_dial_peer(void* ctx,
|
|
|
|
const char* peerMultiAddr,
|
|
|
|
const char* protocol,
|
|
|
|
int timeoutMs,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
|
|
|
|
2024-10-15 12:32:02 +00:00
|
|
|
int waku_dial_peer_by_id(void* ctx,
|
|
|
|
const char* peerId,
|
|
|
|
const char* protocol,
|
|
|
|
int timeoutMs,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
2023-07-07 08:53:00 +00:00
|
|
|
|
2024-09-11 08:13:54 +00:00
|
|
|
int waku_get_peerids_from_peerstore(void* ctx,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
|
|
|
|
|
|
|
int waku_get_peerids_by_protocol(void* ctx,
|
|
|
|
const char* protocol,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
|
|
|
|
2024-02-21 11:06:05 +00:00
|
|
|
int waku_listen_addresses(void* ctx,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
|
|
|
|
2024-10-30 14:26:33 +00:00
|
|
|
int waku_get_connected_peers(void* ctx,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
|
|
|
|
2024-05-21 16:37:50 +00:00
|
|
|
// 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);
|
|
|
|
|
2024-08-29 12:29:02 +00:00
|
|
|
int waku_start_discv5(void* ctx,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
|
|
|
|
|
|
|
int waku_stop_discv5(void* ctx,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
|
|
|
|
2024-08-22 10:01:14 +00:00
|
|
|
// Retrieves the ENR information
|
|
|
|
int waku_get_my_enr(void* ctx,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
|
|
|
|
2024-10-17 16:13:00 +00:00
|
|
|
int waku_get_my_peerid(void* ctx,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
|
|
|
|
2024-09-11 08:13:54 +00:00
|
|
|
int waku_peer_exchange_request(void* ctx,
|
|
|
|
int numPeers,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
|
|
|
|
2024-10-24 13:07:08 +00:00
|
|
|
int waku_ping_peer(void* ctx,
|
|
|
|
const char* peerAddr,
|
|
|
|
int timeoutMs,
|
|
|
|
WakuCallBack callback,
|
|
|
|
void* userData);
|
|
|
|
|
2023-09-28 09:10:42 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2023-07-07 08:53:00 +00:00
|
|
|
#endif /* __libwaku__ */
|