X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-c-bindings;a=blobdiff_plain;f=ldk-net%2Fldk_net.h;fp=ldk-net%2Fldk_net.h;h=258b5bab2cfb308bdcc43df647885453e4989051;hp=0000000000000000000000000000000000000000;hb=78bee4f7e0ea0a48dbf5bb1227ed96e6cb3a041a;hpb=74665e3b6e24cb9dc4d9c6cd68db2a9ba02d72ad 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);