summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/ip.c25
-rw-r--r--src/common/ip.h9
2 files changed, 34 insertions, 0 deletions
diff --git a/src/common/ip.c b/src/common/ip.c
new file mode 100644
index 0000000..bad4b61
--- /dev/null
+++ b/src/common/ip.c
@@ -0,0 +1,25 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 Evol developers
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "../../../common/HPMi.h"
+#include "../../../common/malloc.h"
+#include "../../../common/mmo.h"
+#include "../../../common/socket.h"
+#include "../../../common/strlib.h"
+
+#include "common/ip.h"
+
+bool checkAllowedIp(const char* const mask, const char* const ip)
+{
+ char buf[1000];
+
+ strcpy(buf, ",");
+ strcat(buf, ip);
+ strcat(buf, ",");
+
+ return strstr(mask, buf) != NULL;
+}
diff --git a/src/common/ip.h b/src/common/ip.h
new file mode 100644
index 0000000..1b0ba18
--- /dev/null
+++ b/src/common/ip.h
@@ -0,0 +1,9 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 Evol developers
+
+#ifndef EVOL_COMMON_IP
+#define EVOL_COMMON_IP
+
+bool checkAllowedIp(const char* const mask, const char* const ip);
+
+#endif // EVOL_COMMON_IP