blob: 5e834e02f58e68e836df042b52de4331e8e88a79 [file] [log] [blame]
mikescarlette7748672016-04-29 20:20:54 -07001/*
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>
kwibergbfefb032016-05-01 14:53:46 -070016#include <memory>
mikescarlette7748672016-04-29 20:20:54 -070017
deadbeef49f34fd2016-12-06 16:22:06 -080018#include "webrtc/p2p/base/jseptransport.h"
mikescarlette7748672016-04-29 20:20:54 -070019#include "webrtc/p2p/quic/quictransportchannel.h"
20
21namespace cricket {
22
23class P2PTransportChannel;
24class PortAllocator;
25
deadbeef49f34fd2016-12-06 16:22:06 -080026// 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.
mikescarlette7748672016-04-29 20:20:54 -070031class 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;
kwibergbfefb032016-05-01 14:53:46 -070063 std::unique_ptr<rtc::SSLFingerprint> remote_fingerprint_;
mikescarlette7748672016-04-29 20:20:54 -070064};
65
66} // namespace cricket
67
68#endif // WEBRTC_P2P_QUIC_QUICTRANSPORT_H_