Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 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 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 11 | #ifndef PC_PEER_CONNECTION_INTERNAL_H_ |
| 12 | #define PC_PEER_CONNECTION_INTERNAL_H_ |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 13 | |
| 14 | #include <map> |
| 15 | #include <memory> |
Steve Anton | 5dfde18 | 2018-02-06 10:34:40 -0800 | [diff] [blame] | 16 | #include <set> |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 17 | #include <string> |
| 18 | #include <vector> |
| 19 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 20 | #include "api/peer_connection_interface.h" |
Niels Möller | 8366e17 | 2018-02-14 12:20:13 +0100 | [diff] [blame] | 21 | #include "call/call.h" |
Taylor Brandstetter | 3a034e1 | 2020-07-09 15:32:34 -0700 | [diff] [blame^] | 22 | #include "pc/rtp_data_channel.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 23 | #include "pc/rtp_transceiver.h" |
Taylor Brandstetter | 3a034e1 | 2020-07-09 15:32:34 -0700 | [diff] [blame^] | 24 | #include "pc/sctp_data_channel.h" |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 25 | |
| 26 | namespace webrtc { |
| 27 | |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 28 | // Internal interface for extra PeerConnection methods. |
| 29 | class PeerConnectionInternal : public PeerConnectionInterface { |
| 30 | public: |
| 31 | virtual rtc::Thread* network_thread() const = 0; |
| 32 | virtual rtc::Thread* worker_thread() const = 0; |
| 33 | virtual rtc::Thread* signaling_thread() const = 0; |
| 34 | |
| 35 | // The SDP session ID as defined by RFC 3264. |
Steve Anton | be5e208 | 2018-01-24 15:29:17 -0800 | [diff] [blame] | 36 | virtual std::string session_id() const = 0; |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 37 | |
| 38 | // Returns true if we were the initial offerer. |
| 39 | virtual bool initial_offerer() const = 0; |
| 40 | |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 41 | virtual std::vector< |
| 42 | rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>> |
Steve Anton | b886711 | 2018-02-13 10:07:54 -0800 | [diff] [blame] | 43 | GetTransceiversInternal() const = 0; |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 44 | |
Taylor Brandstetter | 3a034e1 | 2020-07-09 15:32:34 -0700 | [diff] [blame^] | 45 | virtual sigslot::signal1<RtpDataChannel*>& SignalRtpDataChannelCreated() = 0; |
| 46 | virtual sigslot::signal1<SctpDataChannel*>& |
| 47 | SignalSctpDataChannelCreated() = 0; |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 48 | |
| 49 | // Only valid when using deprecated RTP data channels. |
| 50 | virtual cricket::RtpDataChannel* rtp_data_channel() const = 0; |
| 51 | |
Tomas Gunnarsson | 2e94de5 | 2020-06-16 16:54:10 +0200 | [diff] [blame] | 52 | // Call on the network thread to fetch stats for all the data channels. |
| 53 | // TODO(tommi): Make pure virtual after downstream updates. |
Taylor Brandstetter | 3a034e1 | 2020-07-09 15:32:34 -0700 | [diff] [blame^] | 54 | virtual std::vector<DataChannelStats> GetDataChannelStats() const { |
Tomas Gunnarsson | 2e94de5 | 2020-06-16 16:54:10 +0200 | [diff] [blame] | 55 | return {}; |
| 56 | } |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 57 | |
Danil Chapovalov | 66cadcc | 2018-06-19 16:47:43 +0200 | [diff] [blame] | 58 | virtual absl::optional<std::string> sctp_transport_name() const = 0; |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 59 | |
Qingsi Wang | 72a43a1 | 2018-02-20 16:03:18 -0800 | [diff] [blame] | 60 | virtual cricket::CandidateStatsList GetPooledCandidateStats() const = 0; |
| 61 | |
Steve Anton | 5dfde18 | 2018-02-06 10:34:40 -0800 | [diff] [blame] | 62 | // Returns a map from MID to transport name for all active media sections. |
| 63 | virtual std::map<std::string, std::string> GetTransportNamesByMid() const = 0; |
| 64 | |
| 65 | // Returns a map from transport name to transport stats for all given |
| 66 | // transport names. |
| 67 | virtual std::map<std::string, cricket::TransportStats> |
| 68 | GetTransportStatsByNames(const std::set<std::string>& transport_names) = 0; |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 69 | |
| 70 | virtual Call::Stats GetCallStats() = 0; |
| 71 | |
| 72 | virtual bool GetLocalCertificate( |
| 73 | const std::string& transport_name, |
| 74 | rtc::scoped_refptr<rtc::RTCCertificate>* certificate) = 0; |
Taylor Brandstetter | c392866 | 2018-02-23 13:04:51 -0800 | [diff] [blame] | 75 | virtual std::unique_ptr<rtc::SSLCertChain> GetRemoteSSLCertChain( |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 76 | const std::string& transport_name) = 0; |
| 77 | |
| 78 | // Returns true if there was an ICE restart initiated by the remote offer. |
| 79 | virtual bool IceRestartPending(const std::string& content_name) const = 0; |
| 80 | |
| 81 | // Returns true if the ICE restart flag above was set, and no ICE restart has |
| 82 | // occurred yet for this transport (by applying a local description with |
| 83 | // changed ufrag/password). If the transport has been deleted as a result of |
| 84 | // bundling, returns false. |
| 85 | virtual bool NeedsIceRestart(const std::string& content_name) const = 0; |
| 86 | |
| 87 | // Get SSL role for an arbitrary m= section (handles bundling correctly). |
| 88 | virtual bool GetSslRole(const std::string& content_name, |
| 89 | rtc::SSLRole* role) = 0; |
| 90 | }; |
| 91 | |
| 92 | } // namespace webrtc |
| 93 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 94 | #endif // PC_PEER_CONNECTION_INTERNAL_H_ |