mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00
Moves rtc::SentPacket to separate target.
This means that users of the struct no longer has to include socket.h. Bug: webrtc:9586 Change-Id: I09d77d0b4c3a359d2ae4587a48dfc7540a8969e4 Reviewed-on: https://webrtc-review.googlesource.com/c/105105 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Reviewed-by: Björn Terelius <terelius@webrtc.org> Commit-Queue: Sebastian Jansson <srte@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25168}
This commit is contained in:
parent
76ad154eef
commit
e07864ea6e
6 changed files with 115 additions and 58 deletions
|
@ -697,6 +697,7 @@ rtc_static_library("rtc_base") {
|
|||
":stringutils",
|
||||
"..:webrtc_common",
|
||||
"../api:array_view",
|
||||
"network:sent_packet",
|
||||
"third_party/base64",
|
||||
"third_party/sigslot",
|
||||
"//third_party/abseil-cpp/absl/memory",
|
||||
|
|
19
rtc_base/network/BUILD.gn
Normal file
19
rtc_base/network/BUILD.gn
Normal file
|
@ -0,0 +1,19 @@
|
|||
# Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style license
|
||||
# that can be found in the LICENSE file in the root of the source
|
||||
# tree. An additional intellectual property rights grant can be found
|
||||
# in the file PATENTS. All contributing project authors may
|
||||
# be found in the AUTHORS file in the root of the source tree.
|
||||
|
||||
import("../../webrtc.gni")
|
||||
|
||||
rtc_source_set("sent_packet") {
|
||||
sources = [
|
||||
"sent_packet.cc",
|
||||
"sent_packet.h",
|
||||
]
|
||||
deps = [
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
27
rtc_base/network/sent_packet.cc
Normal file
27
rtc_base/network/sent_packet.cc
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright 2018 The WebRTC Project Authors. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "rtc_base/network/sent_packet.h"
|
||||
|
||||
namespace rtc {
|
||||
|
||||
PacketInfo::PacketInfo() = default;
|
||||
PacketInfo::PacketInfo(const PacketInfo& info) = default;
|
||||
PacketInfo::~PacketInfo() = default;
|
||||
|
||||
SentPacket::SentPacket() = default;
|
||||
SentPacket::SentPacket(int64_t packet_id, int64_t send_time_ms)
|
||||
: packet_id(packet_id), send_time_ms(send_time_ms) {}
|
||||
SentPacket::SentPacket(int64_t packet_id,
|
||||
int64_t send_time_ms,
|
||||
const rtc::PacketInfo& info)
|
||||
: packet_id(packet_id), send_time_ms(send_time_ms), info(info) {}
|
||||
|
||||
} // namespace rtc
|
67
rtc_base/network/sent_packet.h
Normal file
67
rtc_base/network/sent_packet.h
Normal file
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* Copyright 2018 The WebRTC Project Authors. All rights reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef RTC_BASE_NETWORK_SENT_PACKET_H_
|
||||
#define RTC_BASE_NETWORK_SENT_PACKET_H_
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
|
||||
namespace rtc {
|
||||
|
||||
enum class PacketType {
|
||||
kUnknown,
|
||||
kData,
|
||||
kIceConnectivityCheck,
|
||||
kIceConnectivityCheckResponse,
|
||||
kStunMessage,
|
||||
kTurnMessage,
|
||||
};
|
||||
|
||||
enum class PacketInfoProtocolType {
|
||||
kUnknown,
|
||||
kUdp,
|
||||
kTcp,
|
||||
kSsltcp,
|
||||
kTls,
|
||||
};
|
||||
|
||||
struct PacketInfo {
|
||||
PacketInfo();
|
||||
PacketInfo(const PacketInfo& info);
|
||||
~PacketInfo();
|
||||
|
||||
bool included_in_feedback = false;
|
||||
bool included_in_allocation = false;
|
||||
PacketType packet_type = PacketType::kUnknown;
|
||||
PacketInfoProtocolType protocol = PacketInfoProtocolType::kUnknown;
|
||||
// A unique id assigned by the network manager, and absl::nullopt if not set.
|
||||
absl::optional<uint16_t> network_id;
|
||||
size_t packet_size_bytes = 0;
|
||||
size_t turn_overhead_bytes = 0;
|
||||
size_t ip_overhead_bytes = 0;
|
||||
};
|
||||
|
||||
struct SentPacket {
|
||||
SentPacket();
|
||||
SentPacket(int64_t packet_id, int64_t send_time_ms);
|
||||
SentPacket(int64_t packet_id,
|
||||
int64_t send_time_ms,
|
||||
const rtc::PacketInfo& info);
|
||||
|
||||
int64_t packet_id = -1;
|
||||
int64_t send_time_ms = -1;
|
||||
rtc::PacketInfo info;
|
||||
};
|
||||
|
||||
} // namespace rtc
|
||||
|
||||
#endif // RTC_BASE_NETWORK_SENT_PACKET_H_
|
|
@ -12,16 +12,4 @@
|
|||
|
||||
namespace rtc {
|
||||
|
||||
PacketInfo::PacketInfo() = default;
|
||||
PacketInfo::PacketInfo(const PacketInfo& info) = default;
|
||||
PacketInfo::~PacketInfo() = default;
|
||||
|
||||
SentPacket::SentPacket() = default;
|
||||
SentPacket::SentPacket(int64_t packet_id, int64_t send_time_ms)
|
||||
: packet_id(packet_id), send_time_ms(send_time_ms) {}
|
||||
SentPacket::SentPacket(int64_t packet_id,
|
||||
int64_t send_time_ms,
|
||||
const rtc::PacketInfo& info)
|
||||
: packet_id(packet_id), send_time_ms(send_time_ms), info(info) {}
|
||||
|
||||
} // namespace rtc
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
#include "rtc_base/win32.h"
|
||||
#endif
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "rtc_base/constructormagic.h"
|
||||
#include "rtc_base/network/sent_packet.h"
|
||||
#include "rtc_base/socketaddress.h"
|
||||
|
||||
// Rather than converting errors into a private namespace,
|
||||
|
@ -123,51 +123,6 @@ inline bool IsBlockingError(int e) {
|
|||
return (e == EWOULDBLOCK) || (e == EAGAIN) || (e == EINPROGRESS);
|
||||
}
|
||||
|
||||
enum class PacketType {
|
||||
kUnknown,
|
||||
kData,
|
||||
kIceConnectivityCheck,
|
||||
kIceConnectivityCheckResponse,
|
||||
kStunMessage,
|
||||
kTurnMessage,
|
||||
};
|
||||
|
||||
enum class PacketInfoProtocolType {
|
||||
kUnknown,
|
||||
kUdp,
|
||||
kTcp,
|
||||
kSsltcp,
|
||||
kTls,
|
||||
};
|
||||
|
||||
struct PacketInfo {
|
||||
PacketInfo();
|
||||
PacketInfo(const PacketInfo& info);
|
||||
~PacketInfo();
|
||||
|
||||
bool included_in_feedback = false;
|
||||
bool included_in_allocation = false;
|
||||
PacketType packet_type = PacketType::kUnknown;
|
||||
PacketInfoProtocolType protocol = PacketInfoProtocolType::kUnknown;
|
||||
// A unique id assigned by the network manager, and absl::nullopt if not set.
|
||||
absl::optional<uint16_t> network_id;
|
||||
size_t packet_size_bytes = 0;
|
||||
size_t turn_overhead_bytes = 0;
|
||||
size_t ip_overhead_bytes = 0;
|
||||
};
|
||||
|
||||
struct SentPacket {
|
||||
SentPacket();
|
||||
SentPacket(int64_t packet_id, int64_t send_time_ms);
|
||||
SentPacket(int64_t packet_id,
|
||||
int64_t send_time_ms,
|
||||
const rtc::PacketInfo& info);
|
||||
|
||||
int64_t packet_id = -1;
|
||||
int64_t send_time_ms = -1;
|
||||
rtc::PacketInfo info;
|
||||
};
|
||||
|
||||
// General interface for the socket implementations of various networks. The
|
||||
// methods match those of normal UNIX sockets very closely.
|
||||
class Socket {
|
||||
|
|
Loading…
Reference in a new issue