LoginServer.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. EQ2Emulator: Everquest II Server Emulator
  3. Copyright (C) 2007 EQ2EMulator Development Team (http://www.eq2emulator.net)
  4. This file is part of EQ2Emulator.
  5. EQ2Emulator is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. EQ2Emulator is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with EQ2Emulator. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #ifndef LOGINSERVER_H
  17. #define LOGINSERVER_H
  18. #include "../common/servertalk.h"
  19. #include "../common/linked_list.h"
  20. #include "../common/timer.h"
  21. #include "../common/queue.h"
  22. #include "../common/Mutex.h"
  23. #include "../common/TCPConnection.h"
  24. #include <deque>
  25. #include "MutexMap.h"
  26. #ifdef WIN32
  27. void AutoInitLoginServer(void *tmp);
  28. #else
  29. void *AutoInitLoginServer(void *tmp);
  30. #endif
  31. bool InitLoginServer();
  32. class LoginServer{
  33. public:
  34. LoginServer(const char* iAddress = 0, int16 iPort = 5999);
  35. ~LoginServer();
  36. bool Process();
  37. bool Connect(const char* iAddress = 0, int16 iPort = 0);
  38. bool ConnectToUpdateServer(const char* iAddress = 0, int16 iPort = 0);
  39. void SendInfo();
  40. void SendStatus();
  41. void GetLatestTables();
  42. void SendPacket(ServerPacket* pack) { tcpc->SendPacket(pack); }
  43. int8 GetState() { return tcpc->GetState(); }
  44. bool Connected() { return tcpc->Connected(); }
  45. int32 ProcessTableUpdates(uchar* data);
  46. int32 ProcessDataUpdates(uchar* data);
  47. void ProcessTableUpdate(uchar* data);
  48. void ProcessDataUpdate(uchar* data);
  49. bool CheckAndWait(Timer* timer);
  50. bool UpdatesAuto(){ return updates_always; }
  51. void UpdatesAuto(bool val){ updates_always = val; }
  52. void UpdatesAsk(bool val){ updates_ask = val; }
  53. bool UpdatesAsk(){ return updates_ask; }
  54. void UpdatesVerbose(bool val){ updates_verbose = val; }
  55. bool UpdatesVerbose(){ return updates_verbose; }
  56. void UpdatesAutoData(bool val){ updates_auto_data = val; }
  57. bool UpdatesAutoData(){ return updates_auto_data; }
  58. void SendFilterNameResponse ( int8 resp , int32 acct_id , int32 char_id );
  59. void SendDeleteCharacter ( CharacterTimeStamp_Struct* cts );
  60. int32 DetermineCharacterLoginRequest ( UsertoWorldRequest_Struct* utwr );
  61. void InitLoginServerVariables();
  62. sint16 minLockedStatus;
  63. sint16 maxPlayers;
  64. sint16 minGameFullStatus;
  65. void SendImmediateEquipmentUpdatesForChar(int32 char_id);
  66. bool CanReconnect() { return pTryReconnect; }
  67. private:
  68. bool try_auto_update;
  69. bool pTryReconnect;
  70. TCPConnection* tcpc;
  71. int32 LoginServerIP;
  72. int32 UpdateServerIP;
  73. int16 LoginServerPort;
  74. int16 UpdateServerPort;
  75. bool updates_ask;
  76. bool updates_always;
  77. bool updates_verbose;
  78. bool updates_auto_data;
  79. bool update_server_verified;
  80. bool update_server_completed;
  81. uchar* data_waiting;
  82. string last_data_update_table;
  83. deque<uchar*> table_updates_waiting;
  84. deque<uchar*> data_updates_waiting;
  85. MutexMap<int32, LoginZoneUpdate>* zone_updates;
  86. MutexMap<int32, LoginEquipmentUpdate>* loginEquip_updates;
  87. int32 last_checked_time;
  88. Timer* statusupdate_timer;
  89. };
  90. #endif