Sebastian Jansson | e07864e | 2018-10-15 09:28:15 +0200 | [diff] [blame] | 1 | /* |
| 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 Gerey | 988cc08 | 2018-10-23 12:03:01 +0200 | [diff] [blame] | 14 | #include <stddef.h> |
| 15 | #include <stdint.h> |
Sebastian Jansson | e07864e | 2018-10-15 09:28:15 +0200 | [diff] [blame] | 16 | |
| 17 | #include "absl/types/optional.h" |
| 18 | |
| 19 | namespace rtc { |
| 20 | |
| 21 | enum class PacketType { |
| 22 | kUnknown, |
| 23 | kData, |
| 24 | kIceConnectivityCheck, |
| 25 | kIceConnectivityCheckResponse, |
| 26 | kStunMessage, |
| 27 | kTurnMessage, |
| 28 | }; |
| 29 | |
| 30 | enum class PacketInfoProtocolType { |
| 31 | kUnknown, |
| 32 | kUdp, |
| 33 | kTcp, |
| 34 | kSsltcp, |
| 35 | kTls, |
| 36 | }; |
| 37 | |
| 38 | struct PacketInfo { |
| 39 | PacketInfo(); |
| 40 | PacketInfo(const PacketInfo& info); |
| 41 | ~PacketInfo(); |
| 42 | |
| 43 | bool included_in_feedback = false; |
| 44 | bool included_in_allocation = false; |
| 45 | PacketType packet_type = PacketType::kUnknown; |
| 46 | PacketInfoProtocolType protocol = PacketInfoProtocolType::kUnknown; |
| 47 | // A unique id assigned by the network manager, and absl::nullopt if not set. |
| 48 | absl::optional<uint16_t> network_id; |
| 49 | size_t packet_size_bytes = 0; |
| 50 | size_t turn_overhead_bytes = 0; |
| 51 | size_t ip_overhead_bytes = 0; |
| 52 | }; |
| 53 | |
| 54 | struct SentPacket { |
| 55 | SentPacket(); |
| 56 | SentPacket(int64_t packet_id, int64_t send_time_ms); |
| 57 | SentPacket(int64_t packet_id, |
| 58 | int64_t send_time_ms, |
| 59 | const rtc::PacketInfo& info); |
| 60 | |
| 61 | int64_t packet_id = -1; |
| 62 | int64_t send_time_ms = -1; |
| 63 | rtc::PacketInfo info; |
| 64 | }; |
| 65 | |
| 66 | } // namespace rtc |
| 67 | |
| 68 | #endif // RTC_BASE_NETWORK_SENT_PACKET_H_ |