[misc] Add net_evhttp_bind() for centralizing libevent based binding

This commit is contained in:
ejurgensen
2021-02-28 00:06:01 +01:00
parent c423f3af91
commit 11151affbd
2 changed files with 50 additions and 6 deletions

View File

@@ -14,6 +14,7 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <event2/http.h>
union net_sockaddr
{
@@ -33,12 +34,17 @@ net_address_get(char *addr, size_t addr_len, union net_sockaddr *naddr);
int
net_port_get(short unsigned *port, union net_sockaddr *naddr);
// Returns the socket fd from socket(), -1 on error
int
net_connect(const char *addr, unsigned short port, int type, const char *log_service_name);
// Returns the socket fd from socket(), -1 on error
int
net_bind(short unsigned *port, int type, const char *log_service_name);
int
net_evhttp_bind(struct evhttp *evhttp, short unsigned port, const char *log_service_name);
/* ----------------------- Conversion/hashing/sanitizers -------------------- */