File: bwcontroller.h

package info (click to toggle)
libtoxcore 0.2.22-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,992 kB
  • sloc: ansic: 70,235; cpp: 14,770; sh: 1,576; python: 649; makefile: 255; perl: 39
file content (42 lines) | stat: -rw-r--r-- 1,396 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* SPDX-License-Identifier: GPL-3.0-or-later
 * Copyright © 2016-2026 The TokTok team.
 * Copyright © 2013-2015 Tox project.
 */
#ifndef C_TOXCORE_TOXAV_BWCONTROLLER_H
#define C_TOXCORE_TOXAV_BWCONTROLLER_H

#include <stddef.h>
#include <stdint.h>

#include "../toxcore/logger.h"
#include "../toxcore/mono_time.h"

#ifdef __cplusplus
extern "C" {
#endif

#define BWC_PACKET_ID 196

typedef struct BWController BWController;

typedef void bwc_loss_report_cb(BWController *_Nonnull bwc, uint32_t friend_number, float loss, void *_Nullable user_data);

typedef int bwc_send_packet_cb(void *_Nullable user_data, const uint8_t *_Nonnull data, uint16_t length);

BWController *_Nullable bwc_new(const Logger *_Nonnull log, uint32_t friendnumber,
                                bwc_loss_report_cb *_Nullable mcb, void *_Nullable mcb_user_data,
                                bwc_send_packet_cb *_Nullable send_packet, void *_Nullable send_packet_user_data,
                                Mono_Time *_Nonnull bwc_mono_time);

void bwc_kill(BWController *_Nullable bwc);

void bwc_add_lost(BWController *_Nullable bwc, uint32_t bytes_lost);
void bwc_add_recv(BWController *_Nullable bwc, uint32_t recv_bytes);

void bwc_handle_packet(BWController *_Nullable bwc, const uint8_t *_Nonnull data, size_t length);

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* C_TOXCORE_TOXAV_BWCONTROLLER_H */