Fix Congestion in Takion and add Test

This commit is contained in:
Florian Märkl 2020-11-18 11:55:26 +01:00
commit ef7a97f6ae
No known key found for this signature in database
GPG key ID: 125BC8A5A6A1E857
3 changed files with 67 additions and 19 deletions

View file

@ -58,8 +58,8 @@ typedef ChiakiErrorCode (*ChiakiTakionAVPacketParse)(ChiakiTakionAVPacket *packe
typedef struct chiaki_takion_congestion_packet_t
{
uint16_t word_0;
uint16_t word_1;
uint16_t word_2;
uint16_t received;
uint16_t lost;
} ChiakiTakionCongestionPacket;
@ -167,11 +167,14 @@ CHIAKI_EXPORT void chiaki_takion_close(ChiakiTakion *takion);
/**
* Must be called from within the Takion thread, i.e. inside the callback!
*/
static inline void chiaki_takion_set_crypt(ChiakiTakion *takion, ChiakiGKCrypt *gkcrypt_local, ChiakiGKCrypt *gkcrypt_remote) {
static inline void chiaki_takion_set_crypt(ChiakiTakion *takion, ChiakiGKCrypt *gkcrypt_local, ChiakiGKCrypt *gkcrypt_remote)
{
takion->gkcrypt_local = gkcrypt_local;
takion->gkcrypt_remote = gkcrypt_remote;
}
CHIAKI_EXPORT ChiakiErrorCode chiaki_takion_packet_mac(ChiakiGKCrypt *crypt, uint8_t *buf, size_t buf_size, uint64_t key_pos, uint8_t *mac_out, uint8_t *mac_old_out);
/**
* Get a new key pos and advance by data_size.
*
@ -230,6 +233,10 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_takion_v7_av_packet_format_header(uint8_t *
CHIAKI_EXPORT ChiakiErrorCode chiaki_takion_v7_av_packet_parse(ChiakiTakionAVPacket *packet, ChiakiKeyState *key_state, uint8_t *buf, size_t buf_size);
#define CHIAKI_TAKION_CONGESTION_PACKET_SIZE 0xf
CHIAKI_EXPORT void chiaki_takion_format_congestion(uint8_t *buf, ChiakiTakionCongestionPacket *packet, uint64_t key_pos);
#ifdef __cplusplus
}
#endif