Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Side by Side Diff: webrtc/p2p/base/dtlstransportchannel.h

Issue 2416023002: Introduce rtc::PacketTransportInterface and let cricket::TransportChannel inherit. (Closed)
Patch Set: Rebase. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/p2p/base/dtlstransportchannel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2011 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
11 #ifndef WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_ 11 #ifndef WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_
12 #define WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_ 12 #define WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_
13 13
14 #include <memory> 14 #include <memory>
15 #include <string> 15 #include <string>
16 #include <vector> 16 #include <vector>
17 17
18 #include "webrtc/p2p/base/transportchannelimpl.h" 18 #include "webrtc/p2p/base/transportchannelimpl.h"
19 #include "webrtc/base/buffer.h" 19 #include "webrtc/base/buffer.h"
20 #include "webrtc/base/bufferqueue.h" 20 #include "webrtc/base/bufferqueue.h"
21 #include "webrtc/base/constructormagic.h" 21 #include "webrtc/base/constructormagic.h"
22 #include "webrtc/base/sslstreamadapter.h" 22 #include "webrtc/base/sslstreamadapter.h"
23 #include "webrtc/base/stream.h" 23 #include "webrtc/base/stream.h"
24 24
25 namespace rtc {
26 class PacketTransportInterface;
27 }
28
25 namespace cricket { 29 namespace cricket {
26 30
27 // A bridge between a packet-oriented/channel-type interface on 31 // A bridge between a packet-oriented/channel-type interface on
28 // the bottom and a StreamInterface on the top. 32 // the bottom and a StreamInterface on the top.
29 class StreamInterfaceChannel : public rtc::StreamInterface { 33 class StreamInterfaceChannel : public rtc::StreamInterface {
30 public: 34 public:
31 explicit StreamInterfaceChannel(TransportChannel* channel); 35 explicit StreamInterfaceChannel(TransportChannel* channel);
32 36
33 // Push in a packet; this gets pulled out from Read(). 37 // Push in a packet; this gets pulled out from Read().
34 bool OnPacketReceived(const char* data, size_t size); 38 bool OnPacketReceived(const char* data, size_t size);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 200
197 // Needed by DtlsTransport. 201 // Needed by DtlsTransport.
198 TransportChannelImpl* channel() { return channel_; } 202 TransportChannelImpl* channel() { return channel_; }
199 203
200 // For informational purposes. Tells if the DTLS handshake has finished. 204 // For informational purposes. Tells if the DTLS handshake has finished.
201 // This may be true even if writable() is false, if the remote fingerprint 205 // This may be true even if writable() is false, if the remote fingerprint
202 // has not yet been verified. 206 // has not yet been verified.
203 bool IsDtlsConnected(); 207 bool IsDtlsConnected();
204 208
205 private: 209 private:
206 void OnWritableState(TransportChannel* channel); 210 void OnWritableState(rtc::PacketTransportInterface* transport);
207 void OnReadPacket(TransportChannel* channel, const char* data, size_t size, 211 void OnReadPacket(rtc::PacketTransportInterface* transport,
208 const rtc::PacketTime& packet_time, int flags); 212 const char* data,
209 void OnSentPacket(TransportChannel* channel, 213 size_t size,
214 const rtc::PacketTime& packet_time,
215 int flags);
216 void OnSentPacket(rtc::PacketTransportInterface* transport,
210 const rtc::SentPacket& sent_packet); 217 const rtc::SentPacket& sent_packet);
211 void OnReadyToSend(TransportChannel* channel); 218 void OnReadyToSend(rtc::PacketTransportInterface* transport);
212 void OnReceivingState(TransportChannel* channel); 219 void OnReceivingState(TransportChannel* channel);
213 void OnDtlsEvent(rtc::StreamInterface* stream_, int sig, int err); 220 void OnDtlsEvent(rtc::StreamInterface* stream_, int sig, int err);
214 bool SetupDtls(); 221 bool SetupDtls();
215 void MaybeStartDtls(); 222 void MaybeStartDtls();
216 bool HandleDtlsPacket(const char* data, size_t size); 223 bool HandleDtlsPacket(const char* data, size_t size);
217 void OnGatheringState(TransportChannelImpl* channel); 224 void OnGatheringState(TransportChannelImpl* channel);
218 void OnCandidateGathered(TransportChannelImpl* channel, const Candidate& c); 225 void OnCandidateGathered(TransportChannelImpl* channel, const Candidate& c);
219 void OnCandidatesRemoved(TransportChannelImpl* channel, 226 void OnCandidatesRemoved(TransportChannelImpl* channel,
220 const Candidates& candidates); 227 const Candidates& candidates);
221 void OnRoleConflict(TransportChannelImpl* channel); 228 void OnRoleConflict(TransportChannelImpl* channel);
(...skipping 24 matching lines...) Expand all
246 // transport channel became writable, or before a remote fingerprint was 253 // transport channel became writable, or before a remote fingerprint was
247 // received. 254 // received.
248 rtc::Buffer cached_client_hello_; 255 rtc::Buffer cached_client_hello_;
249 256
250 RTC_DISALLOW_COPY_AND_ASSIGN(DtlsTransportChannelWrapper); 257 RTC_DISALLOW_COPY_AND_ASSIGN(DtlsTransportChannelWrapper);
251 }; 258 };
252 259
253 } // namespace cricket 260 } // namespace cricket
254 261
255 #endif // WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_ 262 #endif // WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/p2p/base/dtlstransportchannel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698