Use slims for BSD Sockets functions.

This commit is contained in:
2019-10-20 20:47:36 +01:00
parent 318b171262
commit 9889fc743e
4 changed files with 115 additions and 79 deletions

View File

@@ -20,6 +20,7 @@
#include <arpa/inet.h>
#include <ifaddrs.h>
#include <stdio.h>
#include <unistd.h>
int PrintNetworkAddresses()
{
@@ -49,4 +50,13 @@ int PrintNetworkAddresses()
freeifaddrs(ifa_start);
return 0;
}
}
char* PrintIpv4Address(struct in_addr addr) { return inet_ntoa(addr); }
int32_t NetSocket(uint32_t domain, uint32_t type, uint32_t protocol) { return socket(domain, type, protocol); }
int32_t NetBind(int32_t sockfd, struct sockaddr* addr, socklen_t addrlen) { return bind(sockfd, addr, addrlen); }
int32_t NetListen(int32_t sockfd, uint32_t backlog) { return listen(sockfd, backlog); }
int32_t NetAccept(int32_t sockfd, struct sockaddr* addr, socklen_t* addrlen) { return accept(sockfd, addr, addrlen); }
int32_t NetRecv(int32_t sockfd, void* buf, int32_t len, uint32_t flags) { return recv(sockfd, buf, len, flags); }
int32_t NetWrite(int32_t fd, const void* buf, int32_t size) { return write(fd, buf, size); }
int32_t NetClose(int32_t fd) { return close(fd); }