wip more refactoring

This commit is contained in:
2022-10-03 01:15:49 +02:00
parent 9a8bfe36f8
commit 5d6a5d8c01
7 changed files with 252 additions and 109 deletions

View File

@@ -1,5 +1,9 @@
#include <tox/tox.h>
#include "ngc_ext_common.h"
#include "ngc_hs1.h"
#include "ngc_ft1.h"
//#include <cstdint>
//#include <cassert>
//#include <new>
@@ -71,7 +75,6 @@ enum _PacketType : uint8_t {
INVALID = 0u,
//TODO: make it possible to go further back
// request last (few) message_ids for a peer
// - peer_key bytes (peer key we want to know ids for)
// - 1 byte (uint8_t count ids, atleast 1)
@@ -148,3 +151,21 @@ static const char* _pkgid2str(_PacketType type) {
#undef _EXT_CASE
}
using handle_group_custom_packet_cb = void(*)(
Tox* tox,
NGC_EXT_CTX* ngc_ext_ctx,
uint32_t group_number,
uint32_t peer_number,
const uint8_t *data,
size_t length
);
struct NGC_EXT_CTX {
std::array<handle_group_custom_packet_cb, 256> callbacks;
NGC_HS1* ngc_hs1_ctx = nullptr;
NGC_FT1* ngc_ft1_ctx = nullptr;
};