loginlog.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
  2. // For more information, see LICENCE in the main folder
  3. #ifndef LOGINLOG_HPP
  4. #define LOGINLOG_HPP
  5. #include <memory>
  6. #include <common/cbasetypes.hpp>
  7. /**
  8. * Get the number of failed login attempts by the ip in the last minutes.
  9. * @param ip: ip to search attempt from
  10. * @param minutes: intervall to search
  11. * @return number of failed attempts
  12. */
  13. unsigned long loginlog_failedattempts(uint32 ip, uint32 minutes);
  14. /**
  15. * Records an event in the login log.
  16. * @param ip:
  17. * @param username:
  18. * @param rcode:
  19. * @param message:
  20. */
  21. void login_log(uint32 ip, const char* username, int rcode, const char* message);
  22. /**
  23. * Read configuration options.
  24. * @param key: config keyword
  25. * @param value: config value for keyword
  26. * @return true if successful, false if config not complete or server already running
  27. */
  28. bool loginlog_config_read(const char* w1, const char* w2);
  29. /**
  30. * Initialize the module.
  31. * Launched at login-serv start, create db or other long scope variable here.
  32. * @return true if success else exit execution
  33. */
  34. bool loginlog_init(void);
  35. /**
  36. * Handler to cleanup module, called when login-server stops.
  37. * atm closing sql connection to log schema
  38. * @return true success
  39. */
  40. bool loginlog_final(void);
  41. #endif /* LOGINLOG_HPP */