summaryrefslogtreecommitdiff
path: root/src/common/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/socket.c')
-rw-r--r--src/common/socket.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/common/socket.c b/src/common/socket.c
index b2c9810b4..6d89b26e6 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -57,6 +57,7 @@
#include "../common/timer.h"
#include "../common/malloc.h"
#include "../common/showmsg.h"
+#include "../common/strlib.h"
fd_set readfds;
int fd_max;
@@ -1110,3 +1111,9 @@ const char* ip2str(uint32 ip, char ip_str[16])
addr.s_addr = htonl(ip);
return (ip_str == NULL) ? inet_ntoa(addr) : strncpy(ip_str, inet_ntoa(addr), 16);
}
+
+// Converts a dot-formatted ip string into a numeric ip.
+uint32 str2ip(const char* ip_str)
+{
+ return ntohl(inet_addr(ip_str));
+}