Converted easysock from CPP to C, because it was mostly just C code anyways

This commit is contained in:
2024-03-09 11:02:50 -05:00
parent 9972e146d5
commit f9d5e8cdeb
2 changed files with 43 additions and 7 deletions

View File

@@ -1,5 +1,8 @@
#ifndef EASYSOCK_HPP_
#define EASYSOCK_HPP_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef EASYSOCK_H_
#define EASYSOCK_H_
#ifdef _WIN32
#include <winsock2.h>
@@ -70,6 +73,12 @@ IPv6 address (returns 6) or neither (returns -1). */
int check_ip_ver(const char* address);
/* port_to_num - Converts a string representing a port, into a numeric value.
Returns -1 if the string is not numeric, or exceeds the maximum port length.
Returns -2 if the string is lower than 1024, This serves as a warning, as ports less
than 1023 are reserved. */
int port_to_num(const char* port_str);
/* int_to_inet - Takes an int value (4 for IPv4, 6 for IPv6) and returns AF_INET or
AF_INET6 respectively. */
@@ -92,3 +101,6 @@ int sock_quit(void);
int sock_close(SOCKET);
#endif
#ifdef __cplusplus
}
#endif