TrinityCore
WorldserverServiceDispatcher.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
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
19
21{
22 AddService<WorldserverService<account::v1::AccountService>>();
23 AddService<WorldserverService<authentication::v1::AuthenticationService>>();
24 AddService<Services::ClubMembershipService>();
25 AddService<Services::ClubService>();
26 AddService<WorldserverService<connection::v1::ConnectionService>>();
27 AddService<WorldserverService<friends::v1::FriendsService>>();
28 AddService<Services::GameUtilitiesService>();
29 AddService<WorldserverService<presence::v1::PresenceService>>();
30 AddService<WorldserverService<report::v1::ReportService>>();
31 AddService<WorldserverService<report::v2::ReportService>>();
32 AddService<WorldserverService<resources::v1::ResourcesService>>();
33 AddService<WorldserverService<user_manager::v1::UserManagerService>>();
34}
35
37{
38 auto itr = _dispatchers.find(serviceHash);
39 if (itr != _dispatchers.end())
40 itr->second(session, token, methodId, std::move(buffer));
41 else
42 TC_LOG_DEBUG("session.rpc", "{} tried to call invalid service 0x{:X}", session->GetPlayerInfo(), serviceHash);
43}
44
46{
47 static WorldserverServiceDispatcher instance;
48 return instance;
49}
uint32_t uint32
Definition: Define.h:142
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:156
void Dispatch(WorldSession *session, uint32 serviceHash, uint32 token, uint32 methodId, MessageBuffer buffer)
static WorldserverServiceDispatcher & Instance()
Player session in the World.
Definition: WorldSession.h:963
std::string GetPlayerInfo() const