summaryrefslogtreecommitdiff
path: root/src/common/socket.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-02-14 01:00:00 +0100
committerHaru <haru@dotalux.com>2016-08-19 21:32:25 +0200
commit445a68f4deb82fc5bdd9830d25e0f2ab8e33288f (patch)
treea6d8127ad0bf4e67386b7f3600e88b9442930096 /src/common/socket.c
parent8ecf5625936a87ce9057c15cf024a275d9f26f52 (diff)
downloadhercules-445a68f4deb82fc5bdd9830d25e0f2ab8e33288f.tar.gz
hercules-445a68f4deb82fc5bdd9830d25e0f2ab8e33288f.tar.bz2
hercules-445a68f4deb82fc5bdd9830d25e0f2ab8e33288f.tar.xz
hercules-445a68f4deb82fc5bdd9830d25e0f2ab8e33288f.zip
Removed unnecessary typedefs in socket.c
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/common/socket.c')
-rw-r--r--src/common/socket.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/common/socket.c b/src/common/socket.c
index af5e8aa73..72a3f5a17 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -2,7 +2,7 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2012-2015 Hercules Dev Team
+ * Copyright (C) 2012-2016 Hercules Dev Team
* Copyright (C) Athena Dev Teams
*
* Hercules is free software: you can redistribute it and/or modify
@@ -1059,17 +1059,17 @@ int do_sockets(int next)
//////////////////////////////
// IP rules and DDoS protection
-typedef struct connect_history {
+struct connect_history {
uint32 ip;
int64 tick;
int count;
unsigned ddos : 1;
-} ConnectHistory;
+};
-typedef struct access_control {
+struct access_control {
uint32 ip;
uint32 mask;
-} AccessControl;
+};
enum aco {
ACO_DENY_ALLOW,
@@ -1077,8 +1077,8 @@ enum aco {
ACO_MUTUAL_FAILURE
};
-static AccessControl* access_allow = NULL;
-static AccessControl* access_deny = NULL;
+static struct access_control *access_allow = NULL;
+static struct access_control *access_deny = NULL;
static int access_order = ACO_DENY_ALLOW;
static int access_allownum = 0;
static int access_denynum = 0;
@@ -1106,7 +1106,7 @@ static int connect_check(uint32 ip)
/// 1 or 2 : Connection Accepted
static int connect_check_(uint32 ip)
{
- ConnectHistory* hist = NULL;
+ struct connect_history *hist = NULL;
int i;
int is_allowip = 0;
int is_denyip = 0;
@@ -1187,7 +1187,7 @@ static int connect_check_(uint32 ip)
}
}
// IP not found, add to history
- CREATE(hist, ConnectHistory, 1);
+ CREATE(hist, struct connect_history, 1);
hist->ip = ip;
hist->tick = timer->gettick();
uidb_put(connect_history, ip, hist);
@@ -1199,7 +1199,7 @@ static int connect_check_(uint32 ip)
static int connect_check_clear(int tid, int64 tick, int id, intptr_t data) {
int clear = 0;
int list = 0;
- ConnectHistory *hist = NULL;
+ struct connect_history *hist = NULL;
struct DBIterator *iter;
if( !db_size(connect_history) )
@@ -1227,7 +1227,7 @@ static int connect_check_clear(int tid, int64 tick, int id, intptr_t data) {
/// Parses the ip address and mask and puts it into acc.
/// Returns 1 is successful, 0 otherwise.
-int access_ipmask(const char* str, AccessControl* acc)
+int access_ipmask(const char *str, struct access_control *acc)
{
uint32 ip;
uint32 mask;
@@ -1315,13 +1315,13 @@ int socket_config_read(const char* cfgName)
else if (!strcmpi(w2, "mutual-failure"))
access_order = ACO_MUTUAL_FAILURE;
} else if (!strcmpi(w1, "allow")) {
- RECREATE(access_allow, AccessControl, access_allownum+1);
+ RECREATE(access_allow, struct access_control, access_allownum+1);
if (access_ipmask(w2, &access_allow[access_allownum]))
++access_allownum;
else
ShowError("socket_config_read: Invalid ip or ip range '%s'!\n", line);
} else if (!strcmpi(w1, "deny")) {
- RECREATE(access_deny, AccessControl, access_denynum+1);
+ RECREATE(access_deny, struct access_control, access_denynum+1);
if (access_ipmask(w2, &access_deny[access_denynum]))
++access_denynum;
else