summaryrefslogtreecommitdiff
path: root/src/login/ipban.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-01-24 02:55:56 +0300
committerAndrei Karas <akaras@inbox.ru>2018-02-09 18:34:44 +0300
commita58b96c5dab055e5563de3ff92482c92ce0bc50c (patch)
treeeabadce3905644f00b029e71ae6dc145fd4f3be5 /src/login/ipban.h
parenta4cbec10932f12f849a942dff29d282975aabd45 (diff)
downloadhercules-a58b96c5dab055e5563de3ff92482c92ce0bc50c.tar.gz
hercules-a58b96c5dab055e5563de3ff92482c92ce0bc50c.tar.bz2
hercules-a58b96c5dab055e5563de3ff92482c92ce0bc50c.tar.xz
hercules-a58b96c5dab055e5563de3ff92482c92ce0bc50c.zip
Add interface into ipban.c.
Diffstat (limited to 'src/login/ipban.h')
-rw-r--r--src/login/ipban.h46
1 files changed, 32 insertions, 14 deletions
diff --git a/src/login/ipban.h b/src/login/ipban.h
index 104e3a8a3..29aafba9d 100644
--- a/src/login/ipban.h
+++ b/src/login/ipban.h
@@ -22,26 +22,44 @@
#define LOGIN_IPBAN_H
#include "common/cbasetypes.h"
+#include "common/hercules.h"
/* Forward Declarations */
struct config_t; // common/conf.h
-#ifdef HERCULES_CORE
-// TODO: Interface
-// initialize
-void ipban_init(void);
-
-// finalize
-void ipban_final(void);
-
-// check ip against ban list
-bool ipban_check(uint32 ip);
+struct s_ipban_dbs {
+ char db_hostname[32];
+ uint16 db_port;
+ char db_username[32];
+ char db_password[100];
+ char db_database[32];
+ char codepage[32];
+ char table[32];
+};
-// increases failure count for the specified IP
-void ipban_log(uint32 ip);
+/**
+ * Ipban.c Interface
+ **/
+struct ipban_interface {
+ struct s_ipban_dbs *dbs;
+ struct Sql *sql_handle;
+ int cleanup_timer_id;
+ bool inited;
+ void (*init) (void);
+ void (*final) (void);
+ int (*cleanup) (int tid, int64 tick, int id, intptr_t data);
+ bool (*config_read_inter) (const char *filename, bool imported);
+ bool (*config_read_connection) (const char *filename, struct config_t *config, bool imported);
+ bool (*config_read_dynamic) (const char *filename, struct config_t *config, bool imported);
+ bool (*config_read) (const char *filename, struct config_t *config, bool imported);
+ bool (*check) (uint32 ip);
+ void (*log) (uint32 ip);
+};
-// parses configuration options
-bool ipban_config_read(const char *filename, struct config_t *config, bool imported);
+#ifdef HERCULES_CORE
+void ipban_defaults(void);
#endif // HERCULES_CORE
+HPShared struct ipban_interface *ipban;
+
#endif /* LOGIN_IPBAN_H */