aboutsummaryrefslogtreecommitdiff
path: root/src/server/shared/Packets
diff options
context:
space:
mode:
authorTreeston <treeston.mmoc@gmail.com>2020-07-26 01:53:34 +0200
committerGitHub <noreply@github.com>2020-07-26 01:53:34 +0200
commit210176fd915cf4ba16f428d3c1a249a71f4aa7a7 (patch)
tree6998a19da1330be8679fe3e760f858915494400b /src/server/shared/Packets
parentcdaf890af4b5bb7ce256752b49bba2c0f3ed9264 (diff)
Core/Authserver: Authserver cleanup (PR#25093)
- Fix a handful of 1/256 bugs with most significant byte zero in BigNumber - Get rid of (most of) the C-style arrays in authserver - CryptoRandom as a unified source for cryptographic randomness - Bring our other crypto APIs into 2020 - BigNumber usability improvements - Authserver is now actually readable as a result of all of the above
Diffstat (limited to 'src/server/shared/Packets')
-rw-r--r--src/server/shared/Packets/ByteBuffer.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h
index 549786f3aee..149545d10d6 100644
--- a/src/server/shared/Packets/ByteBuffer.h
+++ b/src/server/shared/Packets/ByteBuffer.h
@@ -20,6 +20,7 @@
#include "Define.h"
#include "ByteConverter.h"
+#include <array>
#include <string>
#include <vector>
#include <cstring>
@@ -351,6 +352,12 @@ class TC_SHARED_API ByteBuffer
_rpos += len;
}
+ template <size_t Size>
+ void read(std::array<uint8, Size>& arr)
+ {
+ read(arr.data(), Size);
+ }
+
void readPackGUID(uint64& guid)
{
if (rpos() + 1 > size())
@@ -438,6 +445,12 @@ class TC_SHARED_API ByteBuffer
append(buffer.contents(), buffer.wpos());
}
+ template <size_t Size>
+ void append(std::array<uint8, Size> const& arr)
+ {
+ append(arr.data(), Size);
+ }
+
// can be used in SMSG_MONSTER_MOVE opcode
void appendPackXYZ(float x, float y, float z)
{