OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 // Proxies calls between the client and the transport channel implementation. | 29 // Proxies calls between the client and the transport channel implementation. |
30 // This is needed because clients are allowed to create channels before the | 30 // This is needed because clients are allowed to create channels before the |
31 // network negotiation is complete. Hence, we create a proxy up front, and | 31 // network negotiation is complete. Hence, we create a proxy up front, and |
32 // when negotiation completes, connect the proxy to the implementaiton. | 32 // when negotiation completes, connect the proxy to the implementaiton. |
33 class TransportChannelProxy : public TransportChannel, | 33 class TransportChannelProxy : public TransportChannel, |
34 public rtc::MessageHandler { | 34 public rtc::MessageHandler { |
35 public: | 35 public: |
36 TransportChannelProxy(const std::string& content_name, | 36 TransportChannelProxy(const std::string& content_name, |
37 int component); | 37 int component); |
38 virtual ~TransportChannelProxy(); | 38 ~TransportChannelProxy() override; |
39 | 39 |
40 TransportChannelImpl* impl() { return impl_; } | 40 TransportChannelImpl* impl() { return impl_; } |
41 | 41 |
42 virtual TransportChannelState GetState() const; | 42 TransportChannelState GetState() const override; |
43 | 43 |
44 // Sets the implementation to which we will proxy. | 44 // Sets the implementation to which we will proxy. |
45 void SetImplementation(TransportChannelImpl* impl); | 45 void SetImplementation(TransportChannelImpl* impl); |
46 | 46 |
47 // Implementation of the TransportChannel interface. These simply forward to | 47 // Implementation of the TransportChannel interface. These simply forward to |
48 // the implementation. | 48 // the implementation. |
49 virtual int SendPacket(const char* data, size_t len, | 49 int SendPacket(const char* data, size_t len, |
50 const rtc::PacketOptions& options, | 50 const rtc::PacketOptions& options, |
51 int flags); | 51 int flags) override; |
52 virtual int SetOption(rtc::Socket::Option opt, int value); | 52 int SetOption(rtc::Socket::Option opt, int value) override; |
53 virtual bool GetOption(rtc::Socket::Option opt, int* value); | 53 bool GetOption(rtc::Socket::Option opt, int* value) override; |
54 virtual int GetError(); | 54 int GetError() override; |
55 virtual IceRole GetIceRole() const; | 55 virtual IceRole GetIceRole() const; |
56 virtual bool GetStats(ConnectionInfos* infos); | 56 bool GetStats(ConnectionInfos* infos) override; |
57 virtual bool IsDtlsActive() const; | 57 bool IsDtlsActive() const override; |
58 virtual bool GetSslRole(rtc::SSLRole* role) const; | 58 bool GetSslRole(rtc::SSLRole* role) const override; |
59 virtual bool SetSslRole(rtc::SSLRole role); | 59 virtual bool SetSslRole(rtc::SSLRole role); |
60 virtual bool SetSrtpCiphers(const std::vector<std::string>& ciphers); | 60 bool SetSrtpCiphers(const std::vector<std::string>& ciphers) override; |
61 virtual bool GetSrtpCipher(std::string* cipher); | 61 bool GetSrtpCipher(std::string* cipher) override; |
62 virtual bool GetSslCipher(std::string* cipher); | 62 bool GetSslCipher(std::string* cipher) override; |
63 virtual bool GetLocalIdentity(rtc::SSLIdentity** identity) const; | 63 rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate() const override; |
64 virtual bool GetRemoteCertificate(rtc::SSLCertificate** cert) const; | 64 bool GetRemoteSSLCertificate(rtc::SSLCertificate** cert) const override; |
65 virtual bool ExportKeyingMaterial(const std::string& label, | 65 bool ExportKeyingMaterial(const std::string& label, |
66 const uint8* context, | 66 const uint8* context, |
67 size_t context_len, | 67 size_t context_len, |
68 bool use_context, | 68 bool use_context, |
69 uint8* result, | 69 uint8* result, |
70 size_t result_len); | 70 size_t result_len) override; |
71 | 71 |
72 private: | 72 private: |
73 // Catch signals from the implementation channel. These just forward to the | 73 // Catch signals from the implementation channel. These just forward to the |
74 // client (after updating our state to match). | 74 // client (after updating our state to match). |
75 void OnReadableState(TransportChannel* channel); | 75 void OnReadableState(TransportChannel* channel); |
76 void OnWritableState(TransportChannel* channel); | 76 void OnWritableState(TransportChannel* channel); |
77 void OnReadPacket(TransportChannel* channel, const char* data, size_t size, | 77 void OnReadPacket(TransportChannel* channel, const char* data, size_t size, |
78 const rtc::PacketTime& packet_time, int flags); | 78 const rtc::PacketTime& packet_time, int flags); |
79 void OnReadyToSend(TransportChannel* channel); | 79 void OnReadyToSend(TransportChannel* channel); |
80 void OnRouteChange(TransportChannel* channel, const Candidate& candidate); | 80 void OnRouteChange(TransportChannel* channel, const Candidate& candidate); |
81 | 81 |
82 void OnMessage(rtc::Message* message); | 82 void OnMessage(rtc::Message* message); |
83 | 83 |
84 typedef std::pair<rtc::Socket::Option, int> OptionPair; | 84 typedef std::pair<rtc::Socket::Option, int> OptionPair; |
85 typedef std::vector<OptionPair> OptionList; | 85 typedef std::vector<OptionPair> OptionList; |
86 rtc::Thread* worker_thread_; | 86 rtc::Thread* worker_thread_; |
87 TransportChannelImpl* impl_; | 87 TransportChannelImpl* impl_; |
88 OptionList options_; | 88 OptionList options_; |
89 std::vector<std::string> pending_srtp_ciphers_; | 89 std::vector<std::string> pending_srtp_ciphers_; |
90 | 90 |
91 DISALLOW_COPY_AND_ASSIGN(TransportChannelProxy); | 91 DISALLOW_COPY_AND_ASSIGN(TransportChannelProxy); |
92 }; | 92 }; |
93 | 93 |
94 } // namespace cricket | 94 } // namespace cricket |
95 | 95 |
96 #endif // WEBRTC_P2P_BASE_TRANSPORTCHANNELPROXY_H_ | 96 #endif // WEBRTC_P2P_BASE_TRANSPORTCHANNELPROXY_H_ |
OLD | NEW |