From bbc008ec9447ebcdfaaba5c935c9acf407ff5378 Mon Sep 17 00:00:00 2001 From: Gabriel mermelstein Date: Wed, 23 Oct 2024 13:30:31 +0300 Subject: [PATCH] adding initial procs --- library/libwaku.h | 3 +++ library/libwaku.nim | 13 +++++++++++++ .../requests/debug_node_request.nim | 3 +++ 3 files changed, 19 insertions(+) diff --git a/library/libwaku.h b/library/libwaku.h index 5660e3a10..5117708ec 100644 --- a/library/libwaku.h +++ b/library/libwaku.h @@ -180,6 +180,9 @@ int waku_peer_exchange_request(void* ctx, int numPeers, WakuCallBack callback, void* userData); +int waku_get_health_report(void* ctx, + WakuCallBack callback, + void* userData); #ifdef __cplusplus } diff --git a/library/libwaku.nim b/library/libwaku.nim index 93d468f1e..c0f88d2af 100644 --- a/library/libwaku.nim +++ b/library/libwaku.nim @@ -672,5 +672,18 @@ proc waku_peer_exchange_request( ) .handleRes(callback, userData) +proc waku_get_health_report( + ctx: ptr WakuContext, callback: WakuCallBack, userData: pointer +): cint {.dynlib, exportc.} = + checkLibwakuParams(ctx, callback, userData) + + waku_thread + .sendRequestToWakuThread( + ctx, + RequestType.DEBUG, + DebugNodeRequest.createShared(DebugNodeMsgType.GET_HEALTH_REPORT), + ) + .handleRes(callback, userData) + ### End of exported procs ################################################################################ diff --git a/library/waku_thread/inter_thread_communication/requests/debug_node_request.nim b/library/waku_thread/inter_thread_communication/requests/debug_node_request.nim index 53715e0ed..e66942ec4 100644 --- a/library/waku_thread/inter_thread_communication/requests/debug_node_request.nim +++ b/library/waku_thread/inter_thread_communication/requests/debug_node_request.nim @@ -6,6 +6,7 @@ type DebugNodeMsgType* = enum RETRIEVE_LISTENING_ADDRESSES RETRIEVE_MY_ENR RETRIEVE_MY_PEER_ID + GET_HEALTH_REPORT type DebugNodeRequest* = object operation: DebugNodeMsgType @@ -35,6 +36,8 @@ proc process*( return ok(waku.node.enr.toURI()) of RETRIEVE_MY_PEER_ID: return ok($waku.node.peerId()) + of GET_HEALTH_REPORT: + error "unsupported operation in DebugNodeRequest" return err("unsupported operation in DebugNodeRequest")