blob: 457fb969cf34f817f2a7adf07bacab583764c7fb [file] [log] [blame]
Sebastian Janssone07864e2018-10-15 09:28:15 +02001/*
2 * Copyright 2018 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef RTC_BASE_NETWORK_SENT_PACKET_H_
12#define RTC_BASE_NETWORK_SENT_PACKET_H_
13
Yves Gerey988cc082018-10-23 12:03:01 +020014#include <stddef.h>
15#include <stdint.h>
Sebastian Janssone07864e2018-10-15 09:28:15 +020016
17#include "absl/types/optional.h"
Mirko Bonadei35214fc2019-09-23 14:54:28 +020018#include "rtc_base/system/rtc_export.h"
Sebastian Janssone07864e2018-10-15 09:28:15 +020019
20namespace rtc {
21
22enum class PacketType {
23 kUnknown,
24 kData,
25 kIceConnectivityCheck,
26 kIceConnectivityCheckResponse,
27 kStunMessage,
28 kTurnMessage,
29};
30
31enum class PacketInfoProtocolType {
32 kUnknown,
33 kUdp,
34 kTcp,
35 kSsltcp,
36 kTls,
37};
38
Mirko Bonadei35214fc2019-09-23 14:54:28 +020039struct RTC_EXPORT PacketInfo {
Sebastian Janssone07864e2018-10-15 09:28:15 +020040 PacketInfo();
41 PacketInfo(const PacketInfo& info);
42 ~PacketInfo();
43
44 bool included_in_feedback = false;
45 bool included_in_allocation = false;
46 PacketType packet_type = PacketType::kUnknown;
47 PacketInfoProtocolType protocol = PacketInfoProtocolType::kUnknown;
48 // A unique id assigned by the network manager, and absl::nullopt if not set.
49 absl::optional<uint16_t> network_id;
50 size_t packet_size_bytes = 0;
51 size_t turn_overhead_bytes = 0;
52 size_t ip_overhead_bytes = 0;
53};
54
Mirko Bonadei35214fc2019-09-23 14:54:28 +020055struct RTC_EXPORT SentPacket {
Sebastian Janssone07864e2018-10-15 09:28:15 +020056 SentPacket();
57 SentPacket(int64_t packet_id, int64_t send_time_ms);
58 SentPacket(int64_t packet_id,
59 int64_t send_time_ms,
60 const rtc::PacketInfo& info);
61
62 int64_t packet_id = -1;
63 int64_t send_time_ms = -1;
64 rtc::PacketInfo info;
65};
66
67} // namespace rtc
68
69#endif // RTC_BASE_NETWORK_SENT_PACKET_H_