blob: 029febab2d7880c8a47b69488e6fff73e1db987b [file] [log] [blame]
Steve Anton2d8609c2018-01-24 00:38:461/*
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
Steve Anton10542f22019-01-11 17:11:0011#ifndef PC_PEER_CONNECTION_INTERNAL_H_
12#define PC_PEER_CONNECTION_INTERNAL_H_
Steve Anton2d8609c2018-01-24 00:38:4613
14#include <map>
15#include <memory>
Steve Anton5dfde182018-02-06 18:34:4016#include <set>
Steve Anton2d8609c2018-01-24 00:38:4617#include <string>
18#include <vector>
19
Steve Anton10542f22019-01-11 17:11:0020#include "api/peer_connection_interface.h"
Niels Möller8366e172018-02-14 11:20:1321#include "call/call.h"
Taylor Brandstetter3a034e12020-07-09 22:32:3422#include "pc/rtp_data_channel.h"
Steve Anton10542f22019-01-11 17:11:0023#include "pc/rtp_transceiver.h"
Taylor Brandstetter3a034e12020-07-09 22:32:3424#include "pc/sctp_data_channel.h"
Steve Anton2d8609c2018-01-24 00:38:4625
26namespace webrtc {
27
Steve Anton2d8609c2018-01-24 00:38:4628// Internal interface for extra PeerConnection methods.
29class PeerConnectionInternal : public PeerConnectionInterface {
30 public:
31 virtual rtc::Thread* network_thread() const = 0;
32 virtual rtc::Thread* worker_thread() const = 0;
Steve Anton2d8609c2018-01-24 00:38:4633
34 // The SDP session ID as defined by RFC 3264.
Steve Antonbe5e2082018-01-24 23:29:1735 virtual std::string session_id() const = 0;
Steve Anton2d8609c2018-01-24 00:38:4636
37 // Returns true if we were the initial offerer.
38 virtual bool initial_offerer() const = 0;
39
Steve Anton2d8609c2018-01-24 00:38:4640 virtual std::vector<
41 rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>>
Steve Antonb8867112018-02-13 18:07:5442 GetTransceiversInternal() const = 0;
Steve Anton2d8609c2018-01-24 00:38:4643
Taylor Brandstetter3a034e12020-07-09 22:32:3444 virtual sigslot::signal1<RtpDataChannel*>& SignalRtpDataChannelCreated() = 0;
45 virtual sigslot::signal1<SctpDataChannel*>&
46 SignalSctpDataChannelCreated() = 0;
Steve Anton2d8609c2018-01-24 00:38:4647
48 // Only valid when using deprecated RTP data channels.
49 virtual cricket::RtpDataChannel* rtp_data_channel() const = 0;
50
Tomas Gunnarsson2e94de52020-06-16 14:54:1051 // Call on the network thread to fetch stats for all the data channels.
52 // TODO(tommi): Make pure virtual after downstream updates.
Taylor Brandstetter3a034e12020-07-09 22:32:3453 virtual std::vector<DataChannelStats> GetDataChannelStats() const {
Tomas Gunnarsson2e94de52020-06-16 14:54:1054 return {};
55 }
Steve Anton2d8609c2018-01-24 00:38:4656
Danil Chapovalov66cadcc2018-06-19 14:47:4357 virtual absl::optional<std::string> sctp_transport_name() const = 0;
Steve Anton2d8609c2018-01-24 00:38:4658
Qingsi Wang72a43a12018-02-21 00:03:1859 virtual cricket::CandidateStatsList GetPooledCandidateStats() const = 0;
60
Steve Anton5dfde182018-02-06 18:34:4061 // Returns a map from MID to transport name for all active media sections.
62 virtual std::map<std::string, std::string> GetTransportNamesByMid() const = 0;
63
64 // Returns a map from transport name to transport stats for all given
65 // transport names.
66 virtual std::map<std::string, cricket::TransportStats>
67 GetTransportStatsByNames(const std::set<std::string>& transport_names) = 0;
Steve Anton2d8609c2018-01-24 00:38:4668
69 virtual Call::Stats GetCallStats() = 0;
70
71 virtual bool GetLocalCertificate(
72 const std::string& transport_name,
73 rtc::scoped_refptr<rtc::RTCCertificate>* certificate) = 0;
Taylor Brandstetterc3928662018-02-23 21:04:5174 virtual std::unique_ptr<rtc::SSLCertChain> GetRemoteSSLCertChain(
Steve Anton2d8609c2018-01-24 00:38:4675 const std::string& transport_name) = 0;
76
77 // Returns true if there was an ICE restart initiated by the remote offer.
78 virtual bool IceRestartPending(const std::string& content_name) const = 0;
79
80 // Returns true if the ICE restart flag above was set, and no ICE restart has
81 // occurred yet for this transport (by applying a local description with
82 // changed ufrag/password). If the transport has been deleted as a result of
83 // bundling, returns false.
84 virtual bool NeedsIceRestart(const std::string& content_name) const = 0;
85
86 // Get SSL role for an arbitrary m= section (handles bundling correctly).
87 virtual bool GetSslRole(const std::string& content_name,
88 rtc::SSLRole* role) = 0;
89};
90
91} // namespace webrtc
92
Steve Anton10542f22019-01-11 17:11:0093#endif // PC_PEER_CONNECTION_INTERNAL_H_