summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/rtc_base/async_packet_socket.h
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/libwebrtc/rtc_base/async_packet_socket.h')
-rw-r--r--third_party/libwebrtc/rtc_base/async_packet_socket.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/third_party/libwebrtc/rtc_base/async_packet_socket.h b/third_party/libwebrtc/rtc_base/async_packet_socket.h
index 0d3ceb94e7..768fcd446b 100644
--- a/third_party/libwebrtc/rtc_base/async_packet_socket.h
+++ b/third_party/libwebrtc/rtc_base/async_packet_socket.h
@@ -11,11 +11,13 @@
#ifndef RTC_BASE_ASYNC_PACKET_SOCKET_H_
#define RTC_BASE_ASYNC_PACKET_SOCKET_H_
+#include <cstdint>
#include <vector>
#include "api/sequence_checker.h"
#include "rtc_base/callback_list.h"
#include "rtc_base/dscp.h"
+#include "rtc_base/network/received_packet.h"
#include "rtc_base/network/sent_packet.h"
#include "rtc_base/socket.h"
#include "rtc_base/system/no_unique_address.h"
@@ -115,8 +117,14 @@ class RTC_EXPORT AsyncPacketSocket : public sigslot::has_slots<> {
std::function<void(AsyncPacketSocket*, int)> callback);
void UnsubscribeCloseEvent(const void* removal_tag);
+ void RegisterReceivedPacketCallback(
+ absl::AnyInvocable<void(AsyncPacketSocket*, const rtc::ReceivedPacket&)>
+ received_packet_callback);
+ void DeregisterReceivedPacketCallback();
+
// Emitted each time a packet is read. Used only for UDP and
// connected TCP sockets.
+ // TODO(bugs.webrtc.org:15368): Deprecate and remove.
sigslot::signal5<AsyncPacketSocket*,
const char*,
size_t,
@@ -155,12 +163,26 @@ class RTC_EXPORT AsyncPacketSocket : public sigslot::has_slots<> {
on_close_.Send(this, err);
}
+ // TODO(bugs.webrtc.org:15368): Deprecate and remove.
+ void NotifyPacketReceived(AsyncPacketSocket*,
+ const char* data,
+ size_t size,
+ const SocketAddress& address,
+ const int64_t& packet_time_us) {
+ NotifyPacketReceived(
+ ReceivedPacket::CreateFromLegacy(data, size, packet_time_us, address));
+ }
+
+ void NotifyPacketReceived(const rtc::ReceivedPacket& packet);
+
RTC_NO_UNIQUE_ADDRESS webrtc::SequenceChecker network_checker_{
webrtc::SequenceChecker::kDetached};
private:
webrtc::CallbackList<AsyncPacketSocket*, int> on_close_
RTC_GUARDED_BY(&network_checker_);
+ absl::AnyInvocable<void(AsyncPacketSocket*, const rtc::ReceivedPacket&)>
+ received_packet_callback_ RTC_GUARDED_BY(&network_checker_);
};
// Listen socket, producing an AsyncPacketSocket when a peer connects.