mikescarlett | e774867 | 2016-04-29 20:20:54 -0700 | [diff] [blame] | 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> |
kwiberg | bfefb03 | 2016-05-01 14:53:46 -0700 | [diff] [blame] | 16 | #include <memory> |
mikescarlett | e774867 | 2016-04-29 20:20:54 -0700 | [diff] [blame] | 17 | |
deadbeef | 49f34fd | 2016-12-06 16:22:06 -0800 | [diff] [blame] | 18 | #include "webrtc/p2p/base/jseptransport.h" |
mikescarlett | e774867 | 2016-04-29 20:20:54 -0700 | [diff] [blame] | 19 | #include "webrtc/p2p/quic/quictransportchannel.h" |
| 20 | |
| 21 | namespace cricket { |
| 22 | |
| 23 | class P2PTransportChannel; |
| 24 | class PortAllocator; |
| 25 | |
deadbeef | 49f34fd | 2016-12-06 16:22:06 -0800 | [diff] [blame] | 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. |
mikescarlett | e774867 | 2016-04-29 20:20:54 -0700 | [diff] [blame] | 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; |
| 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; |
kwiberg | bfefb03 | 2016-05-01 14:53:46 -0700 | [diff] [blame] | 63 | std::unique_ptr<rtc::SSLFingerprint> remote_fingerprint_; |
mikescarlett | e774867 | 2016-04-29 20:20:54 -0700 | [diff] [blame] | 64 | }; |
| 65 | |
| 66 | } // namespace cricket |
| 67 | |
| 68 | #endif // WEBRTC_P2P_QUIC_QUICTRANSPORT_H_ |