NagyZoltanPeter 3603b838b9
feat: liblogosdelivery FFI library of new API (#3714)
* Initial for liblogosdelivery library (static & dynamic) based on current state of API. 
* nix build support added.
* logosdelivery_example
* Added support for missing logLevel/logFormat in new API create_node
* Added full JSON to NodeConfig support
* Added ctx and ctx.myLib check to avoid uninitialzed calls and crash. Adjusted logosdelivery_example with proper error handling and JSON config format
* target aware install phase
* Fix base64 decode of payload
2026-02-17 10:38:35 +01:00

25 lines
719 B
Nim

import ffi
import waku/factory/waku
declareLibrary("logosdelivery")
template requireInitializedNode*(
ctx: ptr FFIContext[Waku], opName: string, onError: untyped
) =
if isNil(ctx):
let errMsg {.inject.} = opName & " failed: invalid context"
onError
elif isNil(ctx.myLib) or isNil(ctx.myLib[]):
let errMsg {.inject.} = opName & " failed: node is not initialized"
onError
proc logosdelivery_set_event_callback(
ctx: ptr FFIContext[Waku], callback: FFICallBack, userData: pointer
) {.dynlib, exportc, cdecl.} =
if isNil(ctx):
echo "error: invalid context in logosdelivery_set_event_callback"
return
ctx[].eventCallback = cast[pointer](callback)
ctx[].eventUserData = userData