| OLD | NEW |
| 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/base/buffer.h" | 18 #include "webrtc/base/buffer.h" |
| 19 #include "webrtc/base/bufferqueue.h" | 19 #include "webrtc/base/bufferqueue.h" |
| 20 #include "webrtc/base/constructormagic.h" | 20 #include "webrtc/base/constructormagic.h" |
| 21 #include "webrtc/base/sslstreamadapter.h" | 21 #include "webrtc/base/sslstreamadapter.h" |
| 22 #include "webrtc/base/stream.h" | 22 #include "webrtc/base/stream.h" |
| 23 #include "webrtc/p2p/base/dtlstransportinternal.h" | 23 #include "webrtc/p2p/base/dtlstransportinternal.h" |
| 24 #include "webrtc/p2p/base/icetransportinternal.h" | 24 #include "webrtc/p2p/base/icetransportinternal.h" |
| 25 | 25 |
| 26 namespace rtc { | 26 namespace rtc { |
| 27 class PacketTransportInterface; | 27 class PacketTransportInternal; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace cricket { | 30 namespace cricket { |
| 31 | 31 |
| 32 // A bridge between a packet-oriented/transport-type interface on | 32 // A bridge between a packet-oriented/transport-type interface on |
| 33 // the bottom and a StreamInterface on the top. | 33 // the bottom and a StreamInterface on the top. |
| 34 class StreamInterfaceChannel : public rtc::StreamInterface { | 34 class StreamInterfaceChannel : public rtc::StreamInterface { |
| 35 public: | 35 public: |
| 36 explicit StreamInterfaceChannel(IceTransportInternal* ice_transport); | 36 explicit StreamInterfaceChannel(IceTransportInternal* ice_transport); |
| 37 | 37 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 std::string ToString() const { | 185 std::string ToString() const { |
| 186 const char RECEIVING_ABBREV[2] = {'_', 'R'}; | 186 const char RECEIVING_ABBREV[2] = {'_', 'R'}; |
| 187 const char WRITABLE_ABBREV[2] = {'_', 'W'}; | 187 const char WRITABLE_ABBREV[2] = {'_', 'W'}; |
| 188 std::stringstream ss; | 188 std::stringstream ss; |
| 189 ss << "DtlsTransport[" << transport_name_ << "|" << component_ << "|" | 189 ss << "DtlsTransport[" << transport_name_ << "|" << component_ << "|" |
| 190 << RECEIVING_ABBREV[receiving()] << WRITABLE_ABBREV[writable()] << "]"; | 190 << RECEIVING_ABBREV[receiving()] << WRITABLE_ABBREV[writable()] << "]"; |
| 191 return ss.str(); | 191 return ss.str(); |
| 192 } | 192 } |
| 193 | 193 |
| 194 private: | 194 private: |
| 195 void OnWritableState(rtc::PacketTransportInterface* transport); | 195 void OnWritableState(rtc::PacketTransportInternal* transport); |
| 196 void OnReadPacket(rtc::PacketTransportInterface* transport, | 196 void OnReadPacket(rtc::PacketTransportInternal* transport, |
| 197 const char* data, | 197 const char* data, |
| 198 size_t size, | 198 size_t size, |
| 199 const rtc::PacketTime& packet_time, | 199 const rtc::PacketTime& packet_time, |
| 200 int flags); | 200 int flags); |
| 201 void OnSentPacket(rtc::PacketTransportInterface* transport, | 201 void OnSentPacket(rtc::PacketTransportInternal* transport, |
| 202 const rtc::SentPacket& sent_packet); | 202 const rtc::SentPacket& sent_packet); |
| 203 void OnReadyToSend(rtc::PacketTransportInterface* transport); | 203 void OnReadyToSend(rtc::PacketTransportInternal* transport); |
| 204 void OnReceivingState(rtc::PacketTransportInterface* transport); | 204 void OnReceivingState(rtc::PacketTransportInternal* transport); |
| 205 void OnDtlsEvent(rtc::StreamInterface* stream_, int sig, int err); | 205 void OnDtlsEvent(rtc::StreamInterface* stream_, int sig, int err); |
| 206 bool SetupDtls(); | 206 bool SetupDtls(); |
| 207 void MaybeStartDtls(); | 207 void MaybeStartDtls(); |
| 208 bool HandleDtlsPacket(const char* data, size_t size); | 208 bool HandleDtlsPacket(const char* data, size_t size); |
| 209 void OnDtlsHandshakeError(rtc::SSLHandshakeError error); | 209 void OnDtlsHandshakeError(rtc::SSLHandshakeError error); |
| 210 | 210 |
| 211 void set_receiving(bool receiving); | 211 void set_receiving(bool receiving); |
| 212 void set_writable(bool writable); | 212 void set_writable(bool writable); |
| 213 // Sets the DTLS state, signaling if necessary. | 213 // Sets the DTLS state, signaling if necessary. |
| 214 void set_dtls_state(DtlsTransportState state); | 214 void set_dtls_state(DtlsTransportState state); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 237 | 237 |
| 238 bool receiving_ = false; | 238 bool receiving_ = false; |
| 239 bool writable_ = false; | 239 bool writable_ = false; |
| 240 | 240 |
| 241 RTC_DISALLOW_COPY_AND_ASSIGN(DtlsTransport); | 241 RTC_DISALLOW_COPY_AND_ASSIGN(DtlsTransport); |
| 242 }; | 242 }; |
| 243 | 243 |
| 244 } // namespace cricket | 244 } // namespace cricket |
| 245 | 245 |
| 246 #endif // WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_ | 246 #endif // WEBRTC_P2P_BASE_DTLSTRANSPORTCHANNEL_H_ |
| OLD | NEW |