TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
WorldserverService.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef WorldserverService_h__
19 #define WorldserverService_h__
20 
21 #include "WorldSession.h"
22 #include "account_service.pb.h"
24 #include "challenge_service.pb.h"
25 #include "channel_service.pb.h"
26 #include "connection_service.pb.h"
27 #include "friends_service.pb.h"
29 #include "presence_service.pb.h"
30 #include "report_service.pb.h"
31 #include "resource_service.pb.h"
33 
34 namespace bgs { namespace protocol { } }
35 using namespace bgs::protocol;
36 
37 namespace Battlenet
38 {
39  template<class T>
40  class WorldserverService : public T
41  {
42  public:
43  WorldserverService(WorldSession* session) : T(false), _session(session) { }
44 
45  protected:
46  void SendRequest(uint32 serviceHash, uint32 methodId, google::protobuf::Message const* request, std::function<void(MessageBuffer)> callback) override { _session->SendBattlenetRequest(serviceHash, methodId, request, std::move(callback)); }
47  void SendRequest(uint32 serviceHash, uint32 methodId, google::protobuf::Message const* request) override { _session->SendBattlenetRequest(serviceHash, methodId, request); }
48  void SendResponse(uint32 serviceHash, uint32 methodId, uint32 token, uint32 status) override { _session->SendBattlenetResponse(serviceHash, methodId, token, status); }
49  void SendResponse(uint32 serviceHash, uint32 methodId, uint32 token, google::protobuf::Message const* response) override { _session->SendBattlenetResponse(serviceHash, methodId, token, response); }
50  std::string GetCallerInfo() const override { return _session->GetPlayerInfo(); }
51 
53  };
54 
55  class GameUtilitiesService : public WorldserverService<game_utilities::v1::GameUtilitiesService>
56  {
58 
59  public:
61 
62  uint32 HandleProcessClientRequest(game_utilities::v1::ClientRequest const* request, game_utilities::v1::ClientResponse* response) override;
63  uint32 HandleGetAllValuesForAttribute(game_utilities::v1::GetAllValuesForAttributeRequest const* request, game_utilities::v1::GetAllValuesForAttributeResponse* response) override;
64 
65  private:
66  uint32 HandleRealmListRequest(std::unordered_map<std::string, Variant const*> params, game_utilities::v1::ClientResponse* response);
67  uint32 HandleRealmJoinRequest(std::unordered_map<std::string, Variant const*> params, game_utilities::v1::ClientResponse* response);
68  };
69 }
70 
71 #endif // WorldserverService_h__
void SendResponse(uint32 serviceHash, uint32 methodId, uint32 token, uint32 status) override
Definition: WorldserverService.h:48
Definition: game_utilities_service.pb.h:1143
Definition: Session.h:36
Definition: method_options.pb.h:28
std::string GetCallerInfo() const override
Definition: WorldserverService.h:50
#define false
Definition: CascPort.h:18
void SendRequest(uint32 serviceHash, uint32 methodId, google::protobuf::Message const *request, std::function< void(MessageBuffer)> callback) override
Definition: WorldserverService.h:46
WorldserverService< game_utilities::v1::GameUtilitiesService > BaseService
Definition: WorldserverService.h:57
Definition: WorldserverService.h:55
Definition: game_utilities_service.pb.h:64
Definition: message.h:165
Definition: Session.h:38
void SendResponse(uint32 serviceHash, uint32 methodId, uint32 token, google::protobuf::Message const *response) override
Definition: WorldserverService.h:49
WorldSession * _session
Definition: WorldserverService.h:52
uint32_t uint32
Definition: Define.h:150
Definition: game_utilities_service.pb.h:204
WorldserverService(WorldSession *session)
Definition: WorldserverService.h:43
void SendRequest(uint32 serviceHash, uint32 methodId, google::protobuf::Message const *request) override
Definition: WorldserverService.h:47
Definition: WorldserverService.h:40
Player session in the World.
Definition: WorldSession.h:882
std::set< uint32 > params[2]
Definition: DisableMgr.cpp:45
Definition: MessageBuffer.h:24