sent_packet.h 1.7 KB

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