nwaku/nimcache/release/wakubridge/@m..@sv1@snode@swaku_helpers.nim.c

211 lines
14 KiB
C

/* Generated by Nim Compiler v1.2.6 */
/* (c) 2020 Andreas Rumpf */
/* The generated code is subject to the original license. */
/* Compiled for: Linux, amd64, gcc */
/* Command for C compiler:
gcc -c -w -pthread -I/home/runner/work/nim-waku/nim-waku/vendor/nim-libbacktrace -I/home/runner/work/nim-waku/nim-waku/vendor/nim-libbacktrace/install/usr/include -I/home/runner/work/nim-waku/nim-waku/vendor/nim-secp256k1/secp256k1_wrapper -I/home/runner/work/nim-waku/nim-waku/vendor/nim-secp256k1/secp256k1_wrapper/secp256k1 -I/home/runner/work/nim-waku/nim-waku/vendor/nim-secp256k1/secp256k1_wrapper/secp256k1/src -DHAVE_CONFIG_H -DHAVE_BUILTIN_EXPECT -I/home/runner/work/nim-waku/nim-waku/vendor/nim-bearssl/bearssl/csources/src -I/home/runner/work/nim-waku/nim-waku/vendor/nim-bearssl/bearssl/csources/inc -I/home/runner/work/nim-waku/nim-waku/vendor/nim-bearssl/bearssl/csources/tools -DBR_USE_UNIX_TIME=1 -DBR_USE_URANDOM=1 -DBR_LE_UNALIGNED=1 -DBR_64=1 -DBR_amd64=1 -DBR_INT128=1 -I/home/runner/work/nim-waku/nim-waku/vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc -I/home/runner/work/nim-waku/nim-waku/vendor/nim-nat-traversal/vendor/libnatpmp-upstream -DENABLE_STRNATPMPERR -march=native -g3 -Og -O3 -fno-strict-aliasing -fno-ident -I/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib -I/home/runner/work/nim-waku/nim-waku/waku/common -o nimcache/release/wakubridge/@m..@sv1@snode@swaku_helpers.nim.c.o nimcache/release/wakubridge/@m..@sv1@snode@swaku_helpers.nim.c */
#define NIM_INTBITS 64
#include "nimbase.h"
#include "bearssl_rand.h"
#include "bearssl_hash.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
#define nimfr_(x, y)
#define nimln_(x, y)
typedef struct tyObject_EthereumNodecolonObjectType___mgPxske6V9a9c4U2B9b7otGNQ tyObject_EthereumNodecolonObjectType___mgPxske6V9a9c4U2B9b7otGNQ;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct tyObject_ENode__bNRDNKJGQnqT2sH89bsDhBw tyObject_ENode__bNRDNKJGQnqT2sH89bsDhBw;
typedef struct tyObject_SkPublicKey__YxxaGK7KOKaWCOaZ44rHMA tyObject_SkPublicKey__YxxaGK7KOKaWCOaZ44rHMA;
typedef struct tyObject_secp256k1_pubkey__GYc9aFo1e2qOLdmAqUvIikQ tyObject_secp256k1_pubkey__GYc9aFo1e2qOLdmAqUvIikQ;
typedef struct tyObject_Address__x5U8qnsjGWstAJoOadUZ9aA tyObject_Address__x5U8qnsjGWstAJoOadUZ9aA;
typedef struct tyObject_IpAddress__t0yd6ha54oWXm7nwZ4QqfA tyObject_IpAddress__t0yd6ha54oWXm7nwZ4QqfA;
typedef struct tyObject_Result__pEDK7XSpIcDeFrCMtNkidQ tyObject_Result__pEDK7XSpIcDeFrCMtNkidQ;
typedef struct tyObject_FutureBasecolonObjectType___V9aHQccB2Pyjfqk9bdE5ZRnw tyObject_FutureBasecolonObjectType___V9aHQccB2Pyjfqk9bdE5ZRnw;
typedef struct tyObject_FuturecolonObjectType___GXFSekg1U8JRoedGa2vBSA tyObject_FuturecolonObjectType___GXFSekg1U8JRoedGa2vBSA;
typedef struct RootObj RootObj;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct tyObject_SrcLoc__9cugm8iqHlSb5d0xCTLlcbg tyObject_SrcLoc__9cugm8iqHlSb5d0xCTLlcbg;
typedef struct tySequence__qkV9cggxceO9cpfUWIbCnvJg tySequence__qkV9cggxceO9cpfUWIbCnvJg;
typedef struct Exception Exception;
typedef struct tyObject_PeerPoolcolonObjectType___r0RPreUzOT61wvY9bhIi3YA tyObject_PeerPoolcolonObjectType___r0RPreUzOT61wvY9bhIi3YA;
typedef struct tyObject_NodecolonObjectType___qHnzRdH4zCCluGzY2Ao49cg tyObject_NodecolonObjectType___qHnzRdH4zCCluGzY2Ao49cg;
typedef struct tyObject_AbstractChainDBcolonObjectType___phrKWOrz2sWtUNIvnwywJA tyObject_AbstractChainDBcolonObjectType___phrKWOrz2sWtUNIvnwywJA;
typedef struct tyObject_SkKeyPair__11md6PDL9c3Ydro9bo69avH7g tyObject_SkKeyPair__11md6PDL9c3Ydro9bo69avH7g;
typedef struct tyObject_SkSecretKey__aKiBFtqo69b60sWLnM5A9c3w tyObject_SkSecretKey__aKiBFtqo69b60sWLnM5A9c3w;
typedef struct tySequence__mmfgVYcOeCQQZ9a5CfuuLXw tySequence__mmfgVYcOeCQQZ9a5CfuuLXw;
typedef struct tySequence__LtBIN8CXQpJxPBU08Pl5Ew tySequence__LtBIN8CXQpJxPBU08Pl5Ew;
typedef struct tyObject_StreamServercolonObjectType___jsbainH9bqLrWJoHgf3JqYA tyObject_StreamServercolonObjectType___jsbainH9bqLrWJoHgf3JqYA;
typedef struct tySequence__bZnlXjZxt9bKsfZvcpqpZDA tySequence__bZnlXjZxt9bKsfZvcpqpZDA;
typedef struct tyObject_DiscoveryProtocolcolonObjectType___waQyUBIS0phbKWz5xVV9bTg tyObject_DiscoveryProtocolcolonObjectType___waQyUBIS0phbKWz5xVV9bTg;
typedef struct tyObject_AsyncCallback__Swoy2e9aGWZSpT0Jm9aqp3Zw tyObject_AsyncCallback__Swoy2e9aGWZSpT0Jm9aqp3Zw;
typedef struct tyObject_Capability__oMiYUJkdwZ19b9aXFIiVltLA tyObject_Capability__oMiYUJkdwZ19b9aXFIiVltLA;
typedef struct tyObject_ProtocolInfoObj__x9ayzfuh9abjpSPORCScZoQg tyObject_ProtocolInfoObj__x9ayzfuh9abjpSPORCScZoQg;
struct TGenericSeq {NI len;
NI reserved;
};
struct NimStringDesc { TGenericSeq Sup;NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NU8 tyArray__w5VB8h5K8DB3oWrO5U2wqg[64];
struct tyObject_secp256k1_pubkey__GYc9aFo1e2qOLdmAqUvIikQ {tyArray__w5VB8h5K8DB3oWrO5U2wqg data;
};
struct tyObject_SkPublicKey__YxxaGK7KOKaWCOaZ44rHMA {tyObject_secp256k1_pubkey__GYc9aFo1e2qOLdmAqUvIikQ data;
};
typedef NU8 tyEnum_IpAddressFamily__iqqacz9cr9bcNjYY74E10wPA;
typedef NU8 tyArray__qtqsWM5aXmcpMIVmvq3kAA[16];
typedef NU8 tyArray__H8qf9bpC2ziYA2earmO8m7w[4];
struct tyObject_IpAddress__t0yd6ha54oWXm7nwZ4QqfA {tyEnum_IpAddressFamily__iqqacz9cr9bcNjYY74E10wPA family;
union{
struct {tyArray__qtqsWM5aXmcpMIVmvq3kAA address_v6;
} _family_1;
struct {tyArray__H8qf9bpC2ziYA2earmO8m7w address_v4;
} _family_2;
};
};
struct tyObject_Address__x5U8qnsjGWstAJoOadUZ9aA {tyObject_IpAddress__t0yd6ha54oWXm7nwZ4QqfA ip;
NU16 udpPort;
NU16 tcpPort;
};
struct tyObject_ENode__bNRDNKJGQnqT2sH89bsDhBw {tyObject_SkPublicKey__YxxaGK7KOKaWCOaZ44rHMA pubkey;
tyObject_Address__x5U8qnsjGWstAJoOadUZ9aA address;
};
typedef NU8 tyEnum_ENodeError__dOsBvqflIo9aTtaKFUq4orQ;
struct tyObject_Result__pEDK7XSpIcDeFrCMtNkidQ {NIM_BOOL o;
union{
struct {tyEnum_ENodeError__dOsBvqflIo9aTtaKFUq4orQ e;
} _o_1;
struct {tyObject_ENode__bNRDNKJGQnqT2sH89bsDhBw v;
} _o_2;
};
};
typedef NU8 tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A;
typedef NU8 tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ;
typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
struct TNimType {NI size;
tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A kind;
tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
NCSTRING name;
TNimType* nextType;
NI instances;
NI sizes;
};
struct RootObj {TNimType* m_type;};
typedef tyObject_SrcLoc__9cugm8iqHlSb5d0xCTLlcbg* tyArray__06L8jjfbunFPxVliYUVjmQ[2];
typedef struct {
N_NIMCALL_PTR(void, ClP_0) (void* arg, void* ClE_0);
void* ClE_0;
} tyProc__9bqx36VxQxXejdrF09bFARDQ;
typedef NU8 tyEnum_FutureState__WzRzKRS6S9aqphI4AiMjRNA;
struct tyObject_FutureBasecolonObjectType___V9aHQccB2Pyjfqk9bdE5ZRnw { RootObj Sup;tyArray__06L8jjfbunFPxVliYUVjmQ location;
tySequence__qkV9cggxceO9cpfUWIbCnvJg* callbacks;
tyProc__9bqx36VxQxXejdrF09bFARDQ cancelcb;
tyObject_FutureBasecolonObjectType___V9aHQccB2Pyjfqk9bdE5ZRnw* child;
tyEnum_FutureState__WzRzKRS6S9aqphI4AiMjRNA state;
Exception* error;
NIM_BOOL mustCancel;
NI id;
};
struct tyObject_FuturecolonObjectType___GXFSekg1U8JRoedGa2vBSA { tyObject_FutureBasecolonObjectType___V9aHQccB2Pyjfqk9bdE5ZRnw Sup;};
typedef NU8 tyEnum_ConnectionState__kB7AohyIDJpEMjtdFGcsIQ;
typedef NU8 tyArray__vEOa9c5qaE9ajWxR5R4zwfQg[32];
struct tyObject_SkSecretKey__aKiBFtqo69b60sWLnM5A9c3w {tyArray__vEOa9c5qaE9ajWxR5R4zwfQg data;
};
struct tyObject_SkKeyPair__11md6PDL9c3Ydro9bo69avH7g {tyObject_SkSecretKey__aKiBFtqo69b60sWLnM5A9c3w seckey;
tyObject_SkPublicKey__YxxaGK7KOKaWCOaZ44rHMA pubkey;
};
struct tyObject_EthereumNodecolonObjectType___mgPxske6V9a9c4U2B9b7otGNQ {NU networkId;
tyObject_AbstractChainDBcolonObjectType___phrKWOrz2sWtUNIvnwywJA* chain;
NimStringDesc* clientId;
tyEnum_ConnectionState__kB7AohyIDJpEMjtdFGcsIQ connectionState;
tyObject_SkKeyPair__11md6PDL9c3Ydro9bo69avH7g keys;
tyObject_Address__x5U8qnsjGWstAJoOadUZ9aA address;
tyObject_PeerPoolcolonObjectType___r0RPreUzOT61wvY9bhIi3YA* peerPool;
tySequence__mmfgVYcOeCQQZ9a5CfuuLXw* capabilities;
tySequence__LtBIN8CXQpJxPBU08Pl5Ew* protocols;
tyObject_StreamServercolonObjectType___jsbainH9bqLrWJoHgf3JqYA* listeningServer;
tySequence__bZnlXjZxt9bKsfZvcpqpZDA* protocolStates;
tyObject_DiscoveryProtocolcolonObjectType___waQyUBIS0phbKWz5xVV9bTg* discovery;
br_hmac_drbg_context* rng;
};
struct tyObject_AsyncCallback__Swoy2e9aGWZSpT0Jm9aqp3Zw {tyProc__9bqx36VxQxXejdrF09bFARDQ function;
void* udata;
};
struct tyObject_Capability__oMiYUJkdwZ19b9aXFIiVltLA {NimStringDesc* name;
NI version;
};
typedef unsigned char tyArray__A1SHJCPZVISPTujoygIPEQ[64];
typedef N_CDECL_PTR(void, tyProc__3qI9bVHqiq07sTQRU9bkkkYQ) (br_prng_class** ctx, void* params, void* seed, NI seedLen);
typedef N_CDECL_PTR(void, tyProc__hquUwNr88w4T5ldt8BqLLQ) (br_prng_class** ctx, void* out_0, NI len_0);
typedef N_CDECL_PTR(void, tyProc__bF2JFxTs1q6Lq365NU79a2Q) (br_hash_class** ctx);
typedef N_CDECL_PTR(void, tyProc__Dc9br5a6SHw9cxie3cas0KTA) (br_hash_class** ctx, void* data_0, NI len_0);
typedef N_CDECL_PTR(void, tyProc__JETfgzvEnx6Tz9bYRct9a51g) (br_hash_class** ctx, void* dst);
typedef N_CDECL_PTR(NU64, tyProc__e9bd9aJH2sCZh75q9aAcv7ylg) (br_hash_class** ctx, void* dst);
typedef N_CDECL_PTR(void, tyProc__g9c2vH2tlPaPmvfTZ3PeWQQ) (br_hash_class** ctx, void* stb, NU64 count_0);
struct tySequence__qkV9cggxceO9cpfUWIbCnvJg { TGenericSeq Sup; tyObject_AsyncCallback__Swoy2e9aGWZSpT0Jm9aqp3Zw data[SEQ_DECL_SIZE];};struct tySequence__mmfgVYcOeCQQZ9a5CfuuLXw { TGenericSeq Sup; tyObject_Capability__oMiYUJkdwZ19b9aXFIiVltLA data[SEQ_DECL_SIZE];};struct tySequence__LtBIN8CXQpJxPBU08Pl5Ew { TGenericSeq Sup; tyObject_ProtocolInfoObj__x9ayzfuh9abjpSPORCScZoQg* data[SEQ_DECL_SIZE];};struct tySequence__bZnlXjZxt9bKsfZvcpqpZDA { TGenericSeq Sup; RootObj* data[SEQ_DECL_SIZE];};N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError2)(NI i, NI n);
N_LIB_PRIVATE N_NIMCALL(tyObject_ENode__bNRDNKJGQnqT2sH89bsDhBw, expect__mtdbJjnMCpSoBmO79col9ceA)(tyObject_Result__pEDK7XSpIcDeFrCMtNkidQ* self, NimStringDesc* m);
N_LIB_PRIVATE N_NIMCALL(tyObject_Result__pEDK7XSpIcDeFrCMtNkidQ, fromString__XcBztQFZOc1Ek3qHT5vq8w)(NimStringDesc* e_0);
N_LIB_PRIVATE N_NIMCALL(void, traceAsyncErrors__k0LzufGIalX8s5vVPZwX9ag)(tyObject_FutureBasecolonObjectType___V9aHQccB2Pyjfqk9bdE5ZRnw* fut);
N_LIB_PRIVATE N_NIMCALL(tyObject_FuturecolonObjectType___GXFSekg1U8JRoedGa2vBSA*, connectToNode__xldAjiqZBY3tP6QD0xxkFQ)(tyObject_PeerPoolcolonObjectType___r0RPreUzOT61wvY9bhIi3YA* p_0, tyObject_NodecolonObjectType___qHnzRdH4zCCluGzY2Ao49cg* n_0);
N_LIB_PRIVATE N_NIMCALL(tyObject_NodecolonObjectType___qHnzRdH4zCCluGzY2Ao49cg*, newNode__IrGG7Mbve9bjpWsVqX3sN9cA)(tyObject_ENode__bNRDNKJGQnqT2sH89bsDhBw* enode);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
STRING_LITERAL(TM__2YWo48WjVAdcqTZNWfJqKQ_2, "correct node", 12);
#line 11 "/home/runner/work/nim-waku/nim-waku/waku/v1/node/waku_helpers.nim"
N_LIB_PRIVATE N_NIMCALL(void, connectToNodes__OaVza6vjgVH0CRjD5siyrw)(tyObject_EthereumNodecolonObjectType___mgPxske6V9a9c4U2B9b7otGNQ* node, NimStringDesc** nodes, NI nodesLen_0) { { NimStringDesc* nodeId; NI i; nodeId = (NimStringDesc*)0;
#line 3 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system/iterators.nim"
i = ((NI) 0); {
#line 4 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system/iterators.nim"
while (1) { tyObject_ENode__bNRDNKJGQnqT2sH89bsDhBw whisperENode; tyObject_Result__pEDK7XSpIcDeFrCMtNkidQ T4_; tyObject_NodecolonObjectType___qHnzRdH4zCCluGzY2Ao49cg* T5_; tyObject_FuturecolonObjectType___GXFSekg1U8JRoedGa2vBSA* T6_; tyObject_FutureBasecolonObjectType___V9aHQccB2Pyjfqk9bdE5ZRnw* T7_; NI TM__2YWo48WjVAdcqTZNWfJqKQ_3;
#line 4 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system/iterators.nim"
#line 4 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system/iterators.nim"
if (!(i < nodesLen_0)) goto LA3;
#line 12 "/home/runner/work/nim-waku/nim-waku/waku/v1/node/waku_helpers.nim"
if ((NU)(i) >= (NU)(nodesLen_0)){ raiseIndexError2(i,nodesLen_0-1); } nodeId = nodes[i];
#line 14 "/home/runner/work/nim-waku/nim-waku/waku/v1/node/waku_helpers.nim"
#line 14 "/home/runner/work/nim-waku/nim-waku/waku/v1/node/waku_helpers.nim"
#line 14 "/home/runner/work/nim-waku/nim-waku/waku/v1/node/waku_helpers.nim"
T4_ = fromString__XcBztQFZOc1Ek3qHT5vq8w(nodeId);
#line 14 "/home/runner/work/nim-waku/nim-waku/waku/v1/node/waku_helpers.nim"
whisperENode = expect__mtdbJjnMCpSoBmO79col9ceA((&T4_), ((NimStringDesc*) &TM__2YWo48WjVAdcqTZNWfJqKQ_2));
#line 16 "/home/runner/work/nim-waku/nim-waku/waku/v1/node/waku_helpers.nim"
#line 16 "/home/runner/work/nim-waku/nim-waku/waku/v1/node/waku_helpers.nim"
#line 16 "/home/runner/work/nim-waku/nim-waku/waku/v1/node/waku_helpers.nim"
#line 16 "/home/runner/work/nim-waku/nim-waku/waku/v1/node/waku_helpers.nim"
T5_ = (tyObject_NodecolonObjectType___qHnzRdH4zCCluGzY2Ao49cg*)0; T5_ = newNode__IrGG7Mbve9bjpWsVqX3sN9cA((&whisperENode));
#line 16 "/home/runner/work/nim-waku/nim-waku/waku/v1/node/waku_helpers.nim"
T6_ = (tyObject_FuturecolonObjectType___GXFSekg1U8JRoedGa2vBSA*)0; T6_ = connectToNode__xldAjiqZBY3tP6QD0xxkFQ((*node).peerPool, T5_); T7_ = (tyObject_FutureBasecolonObjectType___V9aHQccB2Pyjfqk9bdE5ZRnw*)0; T7_ = &T6_->Sup;
#line 16 "/home/runner/work/nim-waku/nim-waku/waku/v1/node/waku_helpers.nim"
traceAsyncErrors__k0LzufGIalX8s5vVPZwX9ag(T7_);
#line 6 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system/iterators.nim"
if (nimAddInt(i, ((NI) 1), &TM__2YWo48WjVAdcqTZNWfJqKQ_3)) { raiseOverflow(); }; i = (NI)(TM__2YWo48WjVAdcqTZNWfJqKQ_3); } LA3: ;
}
}
}