mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-06-05 21:49:31 +00:00
Libwaku spike start (#510)
* libwaku init e2e * basic cstring check * wip
This commit is contained in:
parent
6e83fe2084
commit
a56f5eee8b
2
.gitignore
vendored
2
.gitignore
vendored
@ -34,3 +34,5 @@ rln
|
|||||||
package-lock.json
|
package-lock.json
|
||||||
node_modules/
|
node_modules/
|
||||||
/.update.timestamp
|
/.update.timestamp
|
||||||
|
|
||||||
|
libwaku
|
||||||
|
|||||||
12
waku/v2/node/libwaku/README.md
Normal file
12
waku/v2/node/libwaku/README.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# libwaku
|
||||||
|
|
||||||
|
Exposes a C API that can be used by other environments other than C.
|
||||||
|
|
||||||
|
## Running
|
||||||
|
|
||||||
|
Make sure you run `$PROJECTDIR/env.sh bash` first. Then:
|
||||||
|
|
||||||
|
```
|
||||||
|
./build.sh
|
||||||
|
./libwaku
|
||||||
|
```
|
||||||
12
waku/v2/node/libwaku/libwaku.c
Normal file
12
waku/v2/node/libwaku/libwaku.c
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#include "libwaku.h"
|
||||||
|
|
||||||
|
int main(int argc, char* argv[]) {
|
||||||
|
char* string;
|
||||||
|
NimMain();
|
||||||
|
//echo();
|
||||||
|
string = info("hello there");
|
||||||
|
printf("Info: %s", string);
|
||||||
|
}
|
||||||
9
waku/v2/node/libwaku/libwaku.h
Normal file
9
waku/v2/node/libwaku/libwaku.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
// Initialize Nim
|
||||||
|
void NimMain();
|
||||||
|
|
||||||
|
char* info(const char* wakuNode);
|
||||||
|
|
||||||
|
void echo();
|
||||||
36
waku/v2/node/libwaku/libwaku.nim
Normal file
36
waku/v2/node/libwaku/libwaku.nim
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# libwaku
|
||||||
|
#
|
||||||
|
# Exposes a C API that can be used by other environment than C.
|
||||||
|
|
||||||
|
# TODO Start a node
|
||||||
|
# TODO Mock info call
|
||||||
|
# TODO Write header file
|
||||||
|
# TODO Write example C code file
|
||||||
|
# TODO Wrap info call
|
||||||
|
# TODO Init a node
|
||||||
|
|
||||||
|
# proc info*(node: WakuNode): WakuInfo =
|
||||||
|
proc info(foo: cstring): cstring {.exportc.} =
|
||||||
|
echo "info about node"
|
||||||
|
echo foo
|
||||||
|
return foo
|
||||||
|
|
||||||
|
proc echo() {.exportc.} =
|
||||||
|
echo "echo"
|
||||||
|
|
||||||
|
# TODO Here at the moment, start the node
|
||||||
|
# Then do info call
|
||||||
|
# WIP
|
||||||
|
#proc main() {.async.} =
|
||||||
|
# let
|
||||||
|
# rng = crypto.newRng()
|
||||||
|
# conf = WakuNodeConf.load()
|
||||||
|
# (extIp, extTcpPort, extUdpPort) = setupNat(conf.nat, clientId,
|
||||||
|
# Port(uint16(conf.tcpPort) + conf.portsShift),
|
||||||
|
# Port(uint16(conf.udpPort) + conf.portsShift))
|
||||||
|
# node = WakuNode.init(conf.nodeKey, conf.listenAddress,
|
||||||
|
# Port(uint16(conf.tcpPort) + conf.portsShift), extIp, extTcpPort)
|
||||||
|
#
|
||||||
|
# await node.start()
|
||||||
|
#
|
||||||
|
#main()
|
||||||
5
waku/v2/node/libwaku/nim.cfg
Normal file
5
waku/v2/node/libwaku/nim.cfg
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
-app:staticlib
|
||||||
|
o:"libwaku.a"
|
||||||
|
noMain
|
||||||
|
header
|
||||||
|
-d:"chronicles_sinks=textlines"
|
||||||
Loading…
x
Reference in New Issue
Block a user