aboutsummaryrefslogtreecommitdiff
path: root/src/server/shared/Packets/ByteBuffer.h
diff options
context:
space:
mode:
authorTreeston <treeston.mmoc@gmail.com>2020-07-26 01:53:34 +0200
committerShauren <shauren.trinity@gmail.com>2020-08-03 19:39:00 +0200
commite9392ad28767626e519c463e2110184d71ba8426 (patch)
treeda391d7daf1ede4ef73883b5053520e160dc4ec4 /src/server/shared/Packets/ByteBuffer.h
parentcaa1e1171a1ea4e2db754cfb52b3be795385d544 (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 (cherry picked from commit 210176fd915cf4ba16f428d3c1a249a71f4aa7a7)
Diffstat (limited to 'src/server/shared/Packets/ByteBuffer.h')
-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 296da13dafe..13d77b41c14 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>
@@ -472,6 +473,12 @@ class TC_SHARED_API ByteBuffer
_rpos += len;
}
+ template <size_t Size>
+ void read(std::array<uint8, Size>& arr)
+ {
+ read(arr.data(), Size);
+ }
+
void ReadPackedUInt64(uint64& guid)
{
guid = 0;
@@ -564,6 +571,12 @@ class TC_SHARED_API ByteBuffer
append(buffer.contents(), buffer.size());
}
+ 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)
{