accept init ack, send sequenced, handle data ack
still need handle data and send ack
This commit is contained in:
29
ngc_hs1.cpp
29
ngc_hs1.cpp
@@ -96,6 +96,16 @@ void _handle_HS1_ft_recv_data(
|
||||
const uint8_t* data, size_t data_size
|
||||
);
|
||||
|
||||
void _handle_HS1_ft_send_data(
|
||||
Tox *tox, NGC_EXT_CTX* ngc_ext_ctx,
|
||||
|
||||
uint32_t group_number,
|
||||
uint32_t peer_number,
|
||||
uint8_t transfer_id,
|
||||
|
||||
size_t data_offset, uint8_t* data, size_t data_size
|
||||
);
|
||||
|
||||
bool NGC_HS1_init(NGC_EXT_CTX* ngc_ext_ctx, const struct NGC_HS1_options* options) {
|
||||
ngc_ext_ctx->ngc_hs1_ctx = new NGC_HS1;
|
||||
ngc_ext_ctx->ngc_hs1_ctx->options = *options;
|
||||
@@ -106,7 +116,7 @@ bool NGC_HS1_init(NGC_EXT_CTX* ngc_ext_ctx, const struct NGC_HS1_options* option
|
||||
NGC_FT1_register_callback_recv_request(ngc_ext_ctx, NGC_FT1_file_kind::NGC_HS1_MESSAGE_BY_ID, _handle_HS1_ft_recv_request);
|
||||
NGC_FT1_register_callback_recv_init(ngc_ext_ctx, NGC_FT1_file_kind::NGC_HS1_MESSAGE_BY_ID, _handle_HS1_ft_recv_init);
|
||||
NGC_FT1_register_callback_recv_data(ngc_ext_ctx, NGC_FT1_file_kind::NGC_HS1_MESSAGE_BY_ID, _handle_HS1_ft_recv_data);
|
||||
//NGC_FT1_register_callback_send_data(ngc_ext_ctx, NGC_FT1_file_kind::NGC_HS1_MESSAGE_BY_ID, _handle_HS1_ft_init_message);
|
||||
NGC_FT1_register_callback_send_data(ngc_ext_ctx, NGC_FT1_file_kind::NGC_HS1_MESSAGE_BY_ID, _handle_HS1_ft_send_data);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -144,7 +154,7 @@ static void _iterate_group(Tox *tox, NGC_EXT_CTX* ngc_ext_ctx, uint32_t group_nu
|
||||
if (peer.time_since_last_request_sent > ngc_hs1_ctx->options.query_interval_per_peer) {
|
||||
peer.time_since_last_request_sent = 0.f;
|
||||
|
||||
fprintf(stderr, "HS: requesting ids for %X%X%X%X\n", peer_key.data.data()[0], peer_key.data.data()[1], peer_key.data.data()[2], peer_key.data.data()[3]);
|
||||
//fprintf(stderr, "HS: requesting ids for %X%X%X%X\n", peer_key.data.data()[0], peer_key.data.data()[1], peer_key.data.data()[2], peer_key.data.data()[3]);
|
||||
|
||||
// TODO: other way around?
|
||||
// ask everyone if they have newer stuff for this peer
|
||||
@@ -430,7 +440,7 @@ bool _handle_HS1_ft_recv_init(
|
||||
const uint8_t transfer_id,
|
||||
const size_t file_size
|
||||
) {
|
||||
fprintf(stderr, "HS: -------hs handle ft init\n");
|
||||
//fprintf(stderr, "HS: -------hs handle ft init\n");
|
||||
|
||||
// peer id and msg id from file id
|
||||
// TODO: replace, remote crash
|
||||
@@ -513,6 +523,17 @@ void _handle_HS1_ft_recv_data(
|
||||
// TODO: data done?
|
||||
}
|
||||
|
||||
void _handle_HS1_ft_send_data(
|
||||
Tox *tox, NGC_EXT_CTX* ngc_ext_ctx,
|
||||
|
||||
uint32_t group_number,
|
||||
uint32_t peer_number,
|
||||
uint8_t transfer_id,
|
||||
|
||||
size_t data_offset, uint8_t* data, size_t data_size
|
||||
) {
|
||||
}
|
||||
|
||||
#define _HS1_HAVE(x, error) if ((length - curser) < (x)) { error; }
|
||||
|
||||
void _handle_HS1_REQUEST_LAST_IDS(
|
||||
@@ -537,7 +558,7 @@ void _handle_HS1_REQUEST_LAST_IDS(
|
||||
_HS1_HAVE(1, fprintf(stderr, "HS: packet too small, missing count\n"); return)
|
||||
uint8_t last_msg_id_count = data[curser++];
|
||||
|
||||
fprintf(stderr, "HS: got request for last %u ids\n", last_msg_id_count);
|
||||
//fprintf(stderr, "HS: got request for last %u ids\n", last_msg_id_count);
|
||||
|
||||
// get group id
|
||||
_GroupKey g_id{};
|
||||
|
||||
Reference in New Issue
Block a user