Some minor updates
This commit is contained in:
parent
9f03f33a23
commit
f127894110
@ -3,6 +3,23 @@
|
|||||||
#include <any>
|
#include <any>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
|
#define DEFINE_CONVERTER_ENUM(class, size_type) \
|
||||||
|
namespace ts { \
|
||||||
|
template <> \
|
||||||
|
struct converter<class> { \
|
||||||
|
static constexpr bool supported{true}; \
|
||||||
|
static constexpr bool references{false}; \
|
||||||
|
\
|
||||||
|
static constexpr std::string(*to_string)(const std::any&) = [](const std::any& val) { \
|
||||||
|
return std::to_string(std::any_cast<class>(val)); \
|
||||||
|
}; \
|
||||||
|
static constexpr class(*from_string_view)(const std::string_view&) = [](const std::string_view& val) { \
|
||||||
|
return ((class(*)(const std::string_view&)) ts::converter<size_type>::from_string_view)(val); \
|
||||||
|
}; \
|
||||||
|
}; \
|
||||||
|
}
|
||||||
|
|
||||||
namespace ts {
|
namespace ts {
|
||||||
typedef long double long_double;
|
typedef long double long_double;
|
||||||
@ -68,27 +85,21 @@ namespace ts {
|
|||||||
template <int length>
|
template <int length>
|
||||||
struct converter<char[length]> {
|
struct converter<char[length]> {
|
||||||
using type = char[length];
|
using type = char[length];
|
||||||
static constexpr bool supported = true;
|
static constexpr bool supported{true};
|
||||||
|
|
||||||
static constexpr std::string(*to_string)(const std::any&) = [](const std::any& value) { return std::string(std::any_cast<const char*>(value), length - 1); };
|
static constexpr std::string(*to_string)(const std::any&) = [](const std::any& value) { return std::string(std::any_cast<const char*>(value), length - 1); };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* We're not enabling this since we don't transport the unit
|
||||||
|
template <typename Rep, typename Period>
|
||||||
|
struct converter<std::chrono::duration<Rep, Period>> {
|
||||||
|
using type = std::chrono::duration<Rep, Period>;
|
||||||
|
static constexpr bool supported{true};
|
||||||
|
|
||||||
|
static constexpr std::string(*to_string)(const std::any&) = [](const std::any& value) { return std::to_string(std::any_cast<type>(value)); };
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
#undef CONVERTER_PRIMITIVE
|
#undef CONVERTER_PRIMITIVE
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DEFINE_CONVERTER_ENUM(class, size_type) \
|
|
||||||
namespace ts { \
|
|
||||||
template <> \
|
|
||||||
struct converter<class> { \
|
|
||||||
static constexpr bool supported{true}; \
|
|
||||||
static constexpr bool references{false}; \
|
|
||||||
\
|
|
||||||
static constexpr std::string(*to_string)(const std::any&) = [](const std::any& val) { \
|
|
||||||
return std::to_string(std::any_cast<class>(val)); \
|
|
||||||
}; \
|
|
||||||
static constexpr class(*from_string_view)(const std::string_view&) = [](const std::string_view& val) { \
|
|
||||||
return ((class(*)(const std::string_view&)) ts::converter<size_type>::from_string_view)(val); \
|
|
||||||
}; \
|
|
||||||
}; \
|
|
||||||
}
|
|
||||||
/* DO NOT REMOVE ME (NL warning) */
|
/* DO NOT REMOVE ME (NL warning) */
|
@ -84,7 +84,7 @@ namespace ts {
|
|||||||
/**
|
/**
|
||||||
* Helper class for tasks which could be executed multiple times.
|
* Helper class for tasks which could be executed multiple times.
|
||||||
* It will avoid execution stacking while the task is executing.
|
* It will avoid execution stacking while the task is executing.
|
||||||
* The task will never be executed twice only sequential.
|
* The task will never be executed twice, only sequential.
|
||||||
* Note: If the `multi_shot_task` handle gets deleted no enqueued tasks will be executed.
|
* Note: If the `multi_shot_task` handle gets deleted no enqueued tasks will be executed.
|
||||||
*/
|
*/
|
||||||
struct multi_shot_task {
|
struct multi_shot_task {
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include "./Packet.h"
|
#include "./Packet.h"
|
||||||
|
|
||||||
#define DEBUG_ACKNOWLEDGE
|
|
||||||
namespace ts::connection {
|
namespace ts::connection {
|
||||||
class AcknowledgeManager {
|
class AcknowledgeManager {
|
||||||
public:
|
public:
|
||||||
|
@ -16,11 +16,9 @@ namespace ts::connection {
|
|||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
//TeamSpeak old
|
|
||||||
bool setupSharedSecret(const std::string& /* alpha */, const std::string& /* beta */, ecc_key* /* remote_public_key */, ecc_key* /* own_private_key */, std::string &/* error */);
|
bool setupSharedSecret(const std::string& /* alpha */, const std::string& /* beta */, ecc_key* /* remote_public_key */, ecc_key* /* own_private_key */, std::string &/* error */);
|
||||||
bool setupSharedSecret(const std::string& /* alpha */, const std::string& /* beta */, const std::string& /* shared_key */, std::string &/* error */);
|
bool setupSharedSecret(const std::string& /* alpha */, const std::string& /* beta */, const std::string& /* shared_key */, std::string &/* error */);
|
||||||
|
|
||||||
//TeamSpeak new
|
|
||||||
bool setupSharedSecretNew(const std::string& alpha, const std::string& beta, const char privateKey[32], const char publicKey[32]);
|
bool setupSharedSecretNew(const std::string& alpha, const std::string& beta, const char privateKey[32], const char publicKey[32]);
|
||||||
|
|
||||||
bool encrypt(
|
bool encrypt(
|
||||||
|
@ -19,9 +19,6 @@ namespace ts::protocol {
|
|||||||
ACK = 0x06,
|
ACK = 0x06,
|
||||||
ACK_LOW = 0x07,
|
ACK_LOW = 0x07,
|
||||||
INIT1 = 0x08,
|
INIT1 = 0x08,
|
||||||
|
|
||||||
PACKET_MAX = INIT1,
|
|
||||||
UNDEFINED = 0xFF
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PacketIdManager {
|
class PacketIdManager {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user