TrinityCore
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
BattlenetPackets.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
18#include "BattlenetPackets.h"
19#include "PacketOperators.h"
20#include "PacketUtilities.h"
21
23{
25{
26 data << uint64(method.Type);
27 data << uint64(method.ObjectId);
28 data << uint32(method.Token);
29 return data;
30}
31
33{
34 data >> method.Type;
35 data >> method.ObjectId;
36 data >> method.Token;
37 return data;
38}
39
41{
43 _worldPacket << Size<uint32>(Data);
45
46 return &_worldPacket;
47}
48
50{
53 _worldPacket << Size<uint32>(Data);
55
56 return &_worldPacket;
57}
58
60{
61 _worldPacket << Bits<2>(State);
62 _worldPacket << Bits<1>(SuppressNotification);
64
65 return &_worldPacket;
66}
67
69{
71 _worldPacket << Bits<1>(Allow);
72 _worldPacket << Size<uint32>(Ticket);
74
75 return &_worldPacket;
76}
77
79{
80 uint32 protoSize;
81
83 _worldPacket >> protoSize;
84
85 if (protoSize > 0xFFFF)
86 OnInvalidArraySize(protoSize, 0xFFFF);
87
88 if (protoSize)
89 {
90 Data.Resize(protoSize);
91 _worldPacket.read(Data.GetWritePointer(), Data.GetRemainingSpace());
92 Data.WriteCompleted(protoSize);
93 }
94}
95
97{
99 _worldPacket.read(Secret.data(), Secret.size());
100}
101}
uint64_t uint64
Definition: Define.h:147
uint32_t uint32
Definition: Define.h:148
void append(T value)
Definition: ByteBuffer.h:130
void FlushBits()
Definition: ByteBuffer.h:141
WorldPacket const * Write() override
WorldPacket const * Write() override
BattlenetRpcErrorCode BnetStatus
WorldPacket const * Write() override
WorldPacket _worldPacket
Definition: Packet.h:43
ByteBuffer & operator>>(ByteBuffer &data, MethodCall &method)
ByteBuffer & operator<<(ByteBuffer &data, MethodCall const &method)
void OnInvalidArraySize(std::size_t requestedSize, std::size_t sizeLimit)