• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <stddef.h>
15 #include <stdint.h>
16 
17 #include "absl/types/optional.h"
18 #include "rtc_base/system/rtc_export.h"
19 
20 namespace rtc {
21 
22 enum class PacketType {
23   kUnknown,
24   kData,
25   kIceConnectivityCheck,
26   kIceConnectivityCheckResponse,
27   kStunMessage,
28   kTurnMessage,
29 };
30 
31 enum class PacketInfoProtocolType {
32   kUnknown,
33   kUdp,
34   kTcp,
35   kSsltcp,
36   kTls,
37 };
38 
39 struct RTC_EXPORT PacketInfo {
40   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 
55 struct RTC_EXPORT SentPacket {
56   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_
70