1 /* 2 * Copyright 2016 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 WEBRTC_P2P_QUIC_QUICTRANSPORT_H_ 12 #define WEBRTC_P2P_QUIC_QUICTRANSPORT_H_ 13 14 #include <string> 15 #include <map> 16 #include <memory> 17 18 #include "webrtc/p2p/base/jseptransport.h" 19 #include "webrtc/p2p/quic/quictransportchannel.h" 20 21 namespace cricket { 22 23 class P2PTransportChannel; 24 class PortAllocator; 25 26 // TODO(deadbeef): To get QUIC working with TransportController again, would 27 // need to merge this class with Transport (or make separate DTLS/QUIC 28 // subclasses). The only difference between the two (as of typing this) is that 29 // the QUIC channel *requires* a fingerprint, whereas the DTLS channel can 30 // operate in a passthrough mode when SDES is used. 31 class QuicTransport : public Transport { 32 public: 33 QuicTransport(const std::string& name, 34 PortAllocator* allocator, 35 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate); 36 37 ~QuicTransport() override; 38 39 // Transport overrides. 40 void SetLocalCertificate( 41 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) override; 42 bool GetLocalCertificate( 43 rtc::scoped_refptr<rtc::RTCCertificate>* certificate) override; SetSslMaxProtocolVersion(rtc::SSLProtocolVersion version)44 bool SetSslMaxProtocolVersion(rtc::SSLProtocolVersion version) override { 45 return true; // Not needed by QUIC 46 } 47 bool GetSslRole(rtc::SSLRole* ssl_role) const override; 48 49 protected: 50 // Transport overrides. 51 QuicTransportChannel* CreateTransportChannel(int component) override; 52 void DestroyTransportChannel(TransportChannelImpl* channel) override; 53 bool ApplyLocalTransportDescription(TransportChannelImpl* channel, 54 std::string* error_desc) override; 55 bool NegotiateTransportDescription(ContentAction action, 56 std::string* error_desc) override; 57 bool ApplyNegotiatedTransportDescription(TransportChannelImpl* channel, 58 std::string* error_desc) override; 59 60 private: 61 rtc::scoped_refptr<rtc::RTCCertificate> local_certificate_; 62 rtc::SSLRole local_role_ = rtc::SSL_CLIENT; 63 std::unique_ptr<rtc::SSLFingerprint> remote_fingerprint_; 64 }; 65 66 } // namespace cricket 67 68 #endif // WEBRTC_P2P_QUIC_QUICTRANSPORT_H_ 69