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