X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ldk-net%2Fldk_net.h;fp=ldk-net%2Fldk_net.h;h=258b5bab2cfb308bdcc43df647885453e4989051;hb=2c56d2b4709d39d5e96ec84e4ecb07f9ebed0387;hp=0000000000000000000000000000000000000000;hpb=865c6ba04eef70ed33afe484e9df7d12093fc598;p=ldk-c-bindings diff --git a/ldk-net/ldk_net.h b/ldk-net/ldk_net.h new file mode 100644 index 0000000..258b5ba --- /dev/null +++ b/ldk-net/ldk_net.h @@ -0,0 +1,27 @@ +#include +#include +/** + * Initializes socket handling and spawns a background thread to handle socket + * events and pass them to the given LDKPeerManager. + * + * Returns NULL on error, otherwise an opaque pointer which should be passed as + * `handler` in the remaining functions. + */ +void* init_socket_handling(const struct LDKPeerManager *NONNULL_PTR ldk_peer_manger); +/** + * Stop the socket handling thread and free socket handling resources for the + * given handler, as returned by init_socket_handling. + */ +void interrupt_socket_handling(void* handler); +/** + * Bind the given address to accept incoming connections on the given handler's + * background thread. + * Returns 0 on success. + */ +int socket_bind(void* handler, struct sockaddr *addr, socklen_t addrlen); +/** + * Connect to the given address and handle socket events on the given handler's + * background thread. + * Returns 0 on success. + */ +int socket_connect(void* handler, LDKPublicKey counterparty_pubkey, struct sockaddr *addr, size_t addrlen);