aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2025-06-12 20:51:28 +0200
committerShauren <shauren.trinity@gmail.com>2025-06-12 20:51:28 +0200
commit805f8e68177e04827f7be8afc351ad59b97cafbb (patch)
treeac8666d7912db42517c2a8f306c5121ec3176279
parent7002766c0a72b3919011c422e0bdb83422bc7ddc (diff)
Core/Bnet: Update PCH content to include most commonly used headers
-rw-r--r--src/server/bnetserver/PrecompiledHeaders/bnetPCH.h26
-rw-r--r--src/server/bnetserver/Server/Session.cpp6
-rw-r--r--src/server/bnetserver/Services/AccountService.cpp1
-rw-r--r--src/server/bnetserver/Services/AuthenticationService.cpp1
-rw-r--r--src/server/bnetserver/Services/ConnectionService.cpp4
-rw-r--r--src/server/bnetserver/Services/GameUtilitiesService.cpp1
-rw-r--r--src/server/bnetserver/Services/Service.cpp44
-rw-r--r--src/server/bnetserver/Services/Service.h66
-rw-r--r--src/server/bnetserver/Services/ServiceDispatcher.cpp18
-rw-r--r--src/server/bnetserver/Services/ServiceDispatcher.h29
10 files changed, 152 insertions, 44 deletions
diff --git a/src/server/bnetserver/PrecompiledHeaders/bnetPCH.h b/src/server/bnetserver/PrecompiledHeaders/bnetPCH.h
index 0be88a714d5..3ef8f4878ed 100644
--- a/src/server/bnetserver/PrecompiledHeaders/bnetPCH.h
+++ b/src/server/bnetserver/PrecompiledHeaders/bnetPCH.h
@@ -1,5 +1,23 @@
-#include "Configuration/Config.h"
+/*
+ * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "AccountService.h"
+#include "DatabaseEnv.h"
#include "LoginRESTService.h"
-#include "SessionManager.h"
-#include "SslContext.h"
-#include "ServiceDispatcher.h"
+#include "Service.h"
+#include "Session.h"
+#include "Util.h"
diff --git a/src/server/bnetserver/Server/Session.cpp b/src/server/bnetserver/Server/Session.cpp
index 7b9d6f45a3e..732e96088d6 100644
--- a/src/server/bnetserver/Server/Session.cpp
+++ b/src/server/bnetserver/Server/Session.cpp
@@ -16,6 +16,8 @@
*/
#include "Session.h"
+#include "AccountService.h"
+#include "AuthenticationService.h"
#include "BattlenetRpcErrorCodes.h"
#include "ByteConverter.h"
#include "CryptoRandom.h"
@@ -33,6 +35,10 @@
#include "ServiceDispatcher.h"
#include "SslContext.h"
#include "Timezone.h"
+#include "attribute_types.pb.h"
+#include "challenge_service.pb.h"
+#include "game_utilities_service.pb.h"
+#include "rpc_types.pb.h"
#include <rapidjson/document.h>
#include <zlib.h>
diff --git a/src/server/bnetserver/Services/AccountService.cpp b/src/server/bnetserver/Services/AccountService.cpp
index 60eb5ffec24..0e75de80a24 100644
--- a/src/server/bnetserver/Services/AccountService.cpp
+++ b/src/server/bnetserver/Services/AccountService.cpp
@@ -16,6 +16,7 @@
*/
#include "AccountService.h"
+#include "Session.h"
Battlenet::Services::Account::Account(Session* session) : AccountService(session)
{
diff --git a/src/server/bnetserver/Services/AuthenticationService.cpp b/src/server/bnetserver/Services/AuthenticationService.cpp
index 7dda9db6902..d157f42ca32 100644
--- a/src/server/bnetserver/Services/AuthenticationService.cpp
+++ b/src/server/bnetserver/Services/AuthenticationService.cpp
@@ -16,6 +16,7 @@
*/
#include "AuthenticationService.h"
+#include "Session.h"
Battlenet::Services::Authentication::Authentication(Session* session) : AuthenticationService(session)
{
diff --git a/src/server/bnetserver/Services/ConnectionService.cpp b/src/server/bnetserver/Services/ConnectionService.cpp
index fbb34a51985..16b278fed61 100644
--- a/src/server/bnetserver/Services/ConnectionService.cpp
+++ b/src/server/bnetserver/Services/ConnectionService.cpp
@@ -16,9 +16,9 @@
*/
#include "ConnectionService.h"
-#include "Duration.h"
-#include "Util.h"
#include "BattlenetRpcErrorCodes.h"
+#include "Session.h"
+#include "Util.h"
Battlenet::Services::Connection::Connection(Session* session) : ConnectionService(session)
{
diff --git a/src/server/bnetserver/Services/GameUtilitiesService.cpp b/src/server/bnetserver/Services/GameUtilitiesService.cpp
index ee76e8b76a0..225b7e47cc0 100644
--- a/src/server/bnetserver/Services/GameUtilitiesService.cpp
+++ b/src/server/bnetserver/Services/GameUtilitiesService.cpp
@@ -16,6 +16,7 @@
*/
#include "GameUtilitiesService.h"
+#include "Session.h"
Battlenet::Services::GameUtilities::GameUtilities(Session* session) : GameUtilitiesService(session)
{
diff --git a/src/server/bnetserver/Services/Service.cpp b/src/server/bnetserver/Services/Service.cpp
new file mode 100644
index 00000000000..f34ce74c39b
--- /dev/null
+++ b/src/server/bnetserver/Services/Service.cpp
@@ -0,0 +1,44 @@
+/*
+ * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "Service.h"
+#include "Session.h"
+
+void Battlenet::ServiceBaseCaller::SendRequest(uint32 serviceHash, uint32 methodId, google::protobuf::Message const* request, std::function<void(MessageBuffer)>&& callback)
+{
+ _session->SendRequest(serviceHash, methodId, request, std::move(callback));
+}
+
+void Battlenet::ServiceBaseCaller::SendRequest(uint32 serviceHash, uint32 methodId, google::protobuf::Message const* request)
+{
+ _session->SendRequest(serviceHash, methodId, request);
+}
+
+void Battlenet::ServiceBaseCaller::SendResponse(uint32 /*serviceHash*/, uint32 /*methodId*/, uint32 token, uint32 status)
+{
+ _session->SendResponse(token, status);
+}
+
+void Battlenet::ServiceBaseCaller::SendResponse(uint32 /*serviceHash*/, uint32 /*methodId*/, uint32 token, google::protobuf::Message const* response)
+{
+ _session->SendResponse(token, response);
+}
+
+std::string Battlenet::ServiceBaseCaller::GetCallerInfo() const
+{
+ return _session->GetClientInfo();
+}
diff --git a/src/server/bnetserver/Services/Service.h b/src/server/bnetserver/Services/Service.h
index 9dcbb685a66..b4907c22bb2 100644
--- a/src/server/bnetserver/Services/Service.h
+++ b/src/server/bnetserver/Services/Service.h
@@ -15,31 +15,71 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef Service_h__
-#define Service_h__
+#ifndef TRINITYCORE_BNET_SERVICE_H
+#define TRINITYCORE_BNET_SERVICE_H
-#include "Session.h"
+#include "MessageBuffer.h"
+#include <functional>
+#include <string>
-namespace bgs { namespace protocol { } }
+namespace google::protobuf
+{
+class Message;
+}
+
+namespace bgs::protocol { }
using namespace bgs::protocol;
namespace Battlenet
{
+ class Session;
+
+ class ServiceBaseCaller
+ {
+ protected:
+ explicit ServiceBaseCaller(Session* session) : _session(session) { }
+
+ void SendRequest(uint32 serviceHash, uint32 methodId, google::protobuf::Message const* request, std::function<void(MessageBuffer)>&& callback);
+ void SendRequest(uint32 serviceHash, uint32 methodId, google::protobuf::Message const* request);
+ void SendResponse(uint32 serviceHash, uint32 methodId, uint32 token, uint32 status);
+ void SendResponse(uint32 serviceHash, uint32 methodId, uint32 token, google::protobuf::Message const* response);
+ std::string GetCallerInfo() const;
+
+ Session* _session;
+ };
+
template<class T>
- class Service : public T
+ class Service : public T, public ServiceBaseCaller
{
public:
- Service(Session* session) : T(true), _session(session) { }
+ explicit Service(Session* session) : T(true), ServiceBaseCaller(session) { }
protected:
- void SendRequest(uint32 serviceHash, uint32 methodId, google::protobuf::Message const* request, std::function<void(MessageBuffer)> callback) override { _session->SendRequest(serviceHash, methodId, request, std::move(callback)); }
- void SendRequest(uint32 serviceHash, uint32 methodId, google::protobuf::Message const* request) override { _session->SendRequest(serviceHash, methodId, request); }
- void SendResponse(uint32 /*serviceHash*/, uint32 /*methodId*/, uint32 token, uint32 status) override { _session->SendResponse(token, status); }
- void SendResponse(uint32 /*serviceHash*/, uint32 /*methodId*/, uint32 token, google::protobuf::Message const* response) override { _session->SendResponse(token, response); }
- std::string GetCallerInfo() const override { return _session->GetClientInfo(); }
+ void SendRequest(uint32 serviceHash, uint32 methodId, google::protobuf::Message const* request, std::function<void(MessageBuffer)> callback) override
+ {
+ ServiceBaseCaller::SendRequest(serviceHash, methodId, request, std::move(callback));
+ }
- Session* _session;
+ void SendRequest(uint32 serviceHash, uint32 methodId, google::protobuf::Message const* request) override
+ {
+ ServiceBaseCaller::SendRequest(serviceHash, methodId, request);
+ }
+
+ void SendResponse(uint32 serviceHash, uint32 methodId, uint32 token, uint32 status) override
+ {
+ ServiceBaseCaller::SendResponse(serviceHash, methodId, token, status);
+ }
+
+ void SendResponse(uint32 serviceHash, uint32 methodId, uint32 token, google::protobuf::Message const* response) override
+ {
+ ServiceBaseCaller::SendResponse(serviceHash, methodId, token, response);
+ }
+
+ std::string GetCallerInfo() const override
+ {
+ return ServiceBaseCaller::GetCallerInfo();
+ }
};
}
-#endif // Service_h__
+#endif // TRINITYCORE_BNET_SERVICE_H
diff --git a/src/server/bnetserver/Services/ServiceDispatcher.cpp b/src/server/bnetserver/Services/ServiceDispatcher.cpp
index dbef19a8b03..586d81b1dcb 100644
--- a/src/server/bnetserver/Services/ServiceDispatcher.cpp
+++ b/src/server/bnetserver/Services/ServiceDispatcher.cpp
@@ -16,6 +16,24 @@
*/
#include "ServiceDispatcher.h"
+#include "AccountService.h"
+#include "AuthenticationService.h"
+#include "ConnectionService.h"
+#include "GameUtilitiesService.h"
+#include "Log.h"
+#include "Session.h"
+#include "api/client/v1/block_list_listener.pb.h"
+#include "api/client/v1/block_list_service.pb.h"
+#include "api/client/v1/club_membership_service.pb.h"
+#include "api/client/v1/club_service.pb.h"
+#include "api/client/v2/notification_service.pb.h"
+#include "api/client/v2/report_service.pb.h"
+#include "api/client/v2/whisper_service.pb.h"
+#include "friends_service.pb.h"
+#include "notification_service.pb.h"
+#include "presence_service.pb.h"
+#include "report_service.pb.h"
+#include "resource_service.pb.h"
Battlenet::ServiceDispatcher::ServiceDispatcher()
{
diff --git a/src/server/bnetserver/Services/ServiceDispatcher.h b/src/server/bnetserver/Services/ServiceDispatcher.h
index d21bdb9e7ed..58f11b88f49 100644
--- a/src/server/bnetserver/Services/ServiceDispatcher.h
+++ b/src/server/bnetserver/Services/ServiceDispatcher.h
@@ -15,32 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef ServiceDispatcher_h__
-#define ServiceDispatcher_h__
+#ifndef TRINITYCORE_BNET_SERVICE_DISPATCHER_H
+#define TRINITYCORE_BNET_SERVICE_DISPATCHER_H
#include "MessageBuffer.h"
-#include "AccountService.h"
-#include "AuthenticationService.h"
-#include "api/client/v1/block_list_listener.pb.h"
-#include "api/client/v1/block_list_service.pb.h"
-#include "challenge_service.pb.h"
-#include "api/client/v1/club_listener.pb.h"
-#include "api/client/v1/club_membership_listener.pb.h"
-#include "api/client/v1/club_membership_service.pb.h"
-#include "api/client/v1/club_service.pb.h"
-#include "ConnectionService.h"
-#include "friends_service.pb.h"
-#include "GameUtilitiesService.h"
-#include "notification_service.pb.h"
-#include "api/client/v2/notification_listener.pb.h"
-#include "api/client/v2/notification_service.pb.h"
-#include "presence_listener.pb.h"
-#include "presence_service.pb.h"
-#include "report_service.pb.h"
-#include "api/client/v2/report_service.pb.h"
-#include "resource_service.pb.h"
-#include "api/client/v2/whisper_listener.pb.h"
-#include "api/client/v2/whisper_service.pb.h"
+#include <unordered_map>
namespace Battlenet
{
@@ -75,4 +54,4 @@ namespace Battlenet
#define sServiceDispatcher ServiceDispatcher::Instance()
-#endif // ServiceDispatcher_h__
+#endif // TRINITYCORE_BNET_SERVICE_DISPATCHER_H