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 | |
| 11 | #ifndef PC_PEERCONNECTIONINTERNAL_H_ |
| 12 | #define PC_PEERCONNECTIONINTERNAL_H_ |
| 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 | |
| 20 | #include "api/peerconnectioninterface.h" |
Niels Möller | 8366e17 | 2018-02-14 12:20:13 +0100 | [diff] [blame] | 21 | #include "call/call.h" |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 22 | #include "pc/datachannel.h" |
| 23 | #include "pc/rtptransceiver.h" |
| 24 | |
| 25 | namespace webrtc { |
| 26 | |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 27 | // Internal interface for extra PeerConnection methods. |
| 28 | class PeerConnectionInternal : public PeerConnectionInterface { |
| 29 | public: |
| 30 | virtual rtc::Thread* network_thread() const = 0; |
| 31 | virtual rtc::Thread* worker_thread() const = 0; |
| 32 | virtual rtc::Thread* signaling_thread() const = 0; |
| 33 | |
| 34 | // The SDP session ID as defined by RFC 3264. |
Steve Anton | be5e208 | 2018-01-24 15:29:17 -0800 | [diff] [blame] | 35 | virtual std::string session_id() const = 0; |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 36 | |
| 37 | // Returns true if we were the initial offerer. |
| 38 | virtual bool initial_offerer() const = 0; |
| 39 | |
Steve Anton | b886711 | 2018-02-13 10:07:54 -0800 | [diff] [blame] | 40 | // TODO(steveanton): Remove these and replace with GetTransceiversInternal. |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 41 | virtual cricket::VoiceChannel* voice_channel() const = 0; |
| 42 | virtual cricket::VideoChannel* video_channel() const = 0; |
| 43 | |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 44 | virtual std::vector< |
| 45 | rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>> |
Steve Anton | b886711 | 2018-02-13 10:07:54 -0800 | [diff] [blame] | 46 | GetTransceiversInternal() const = 0; |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 47 | |
| 48 | // Get the id used as a media stream track's "id" field from ssrc. |
| 49 | virtual bool GetLocalTrackIdBySsrc(uint32_t ssrc, std::string* track_id) = 0; |
| 50 | virtual bool GetRemoteTrackIdBySsrc(uint32_t ssrc, std::string* track_id) = 0; |
| 51 | |
| 52 | virtual sigslot::signal1<DataChannel*>& SignalDataChannelCreated() = 0; |
| 53 | |
| 54 | // Only valid when using deprecated RTP data channels. |
| 55 | virtual cricket::RtpDataChannel* rtp_data_channel() const = 0; |
| 56 | |
Steve Anton | be5e208 | 2018-01-24 15:29:17 -0800 | [diff] [blame] | 57 | virtual std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels() |
| 58 | const = 0; |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 59 | |
| 60 | virtual rtc::Optional<std::string> sctp_content_name() const = 0; |
| 61 | virtual rtc::Optional<std::string> sctp_transport_name() const = 0; |
| 62 | |
Steve Anton | 5dfde18 | 2018-02-06 10:34:40 -0800 | [diff] [blame] | 63 | // Returns a map from MID to transport name for all active media sections. |
| 64 | virtual std::map<std::string, std::string> GetTransportNamesByMid() const = 0; |
| 65 | |
| 66 | // Returns a map from transport name to transport stats for all given |
| 67 | // transport names. |
| 68 | virtual std::map<std::string, cricket::TransportStats> |
| 69 | GetTransportStatsByNames(const std::set<std::string>& transport_names) = 0; |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 70 | |
| 71 | virtual Call::Stats GetCallStats() = 0; |
| 72 | |
| 73 | virtual bool GetLocalCertificate( |
| 74 | const std::string& transport_name, |
| 75 | rtc::scoped_refptr<rtc::RTCCertificate>* certificate) = 0; |
| 76 | virtual std::unique_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate( |
| 77 | const std::string& transport_name) = 0; |
| 78 | |
| 79 | // Returns true if there was an ICE restart initiated by the remote offer. |
| 80 | virtual bool IceRestartPending(const std::string& content_name) const = 0; |
| 81 | |
| 82 | // Returns true if the ICE restart flag above was set, and no ICE restart has |
| 83 | // occurred yet for this transport (by applying a local description with |
| 84 | // changed ufrag/password). If the transport has been deleted as a result of |
| 85 | // bundling, returns false. |
| 86 | virtual bool NeedsIceRestart(const std::string& content_name) const = 0; |
| 87 | |
| 88 | // Get SSL role for an arbitrary m= section (handles bundling correctly). |
| 89 | virtual bool GetSslRole(const std::string& content_name, |
| 90 | rtc::SSLRole* role) = 0; |
| 91 | }; |
| 92 | |
| 93 | } // namespace webrtc |
| 94 | |
| 95 | #endif // PC_PEERCONNECTIONINTERNAL_H_ |