/work/toxav/bwcontroller.h
Line | Count | Source |
1 | | /* SPDX-License-Identifier: GPL-3.0-or-later |
2 | | * Copyright © 2016-2026 The TokTok team. |
3 | | * Copyright © 2013-2015 Tox project. |
4 | | */ |
5 | | #ifndef C_TOXCORE_TOXAV_BWCONTROLLER_H |
6 | | #define C_TOXCORE_TOXAV_BWCONTROLLER_H |
7 | | |
8 | | #include <stddef.h> |
9 | | #include <stdint.h> |
10 | | |
11 | | #include "../toxcore/logger.h" |
12 | | #include "../toxcore/mono_time.h" |
13 | | |
14 | | #ifdef __cplusplus |
15 | | extern "C" { |
16 | | #endif |
17 | | |
18 | 18 | #define BWC_PACKET_ID 196 |
19 | | |
20 | | typedef struct BWController BWController; |
21 | | |
22 | | typedef void bwc_loss_report_cb(BWController *_Nonnull bwc, uint32_t friend_number, float loss, void *_Nullable user_data); |
23 | | |
24 | | typedef int bwc_send_packet_cb(void *_Nullable user_data, const uint8_t *_Nonnull data, uint16_t length); |
25 | | |
26 | | BWController *_Nullable bwc_new(const Logger *_Nonnull log, uint32_t friendnumber, |
27 | | bwc_loss_report_cb *_Nullable mcb, void *_Nullable mcb_user_data, |
28 | | bwc_send_packet_cb *_Nullable send_packet, void *_Nullable send_packet_user_data, |
29 | | Mono_Time *_Nonnull bwc_mono_time); |
30 | | |
31 | | void bwc_kill(BWController *_Nullable bwc); |
32 | | |
33 | | void bwc_add_lost(BWController *_Nullable bwc, uint32_t bytes_lost); |
34 | | void bwc_add_recv(BWController *_Nullable bwc, uint32_t recv_bytes); |
35 | | |
36 | | void bwc_handle_packet(BWController *_Nullable bwc, const uint8_t *_Nonnull data, size_t length); |
37 | | |
38 | | #ifdef __cplusplus |
39 | | } /* extern "C" */ |
40 | | #endif |
41 | | |
42 | | #endif /* C_TOXCORE_TOXAV_BWCONTROLLER_H */ |