| 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 14 matching lines...) Expand all Loading... |
| 25 // remoting/protocol/libjingle_transport_factory.cc | 25 // remoting/protocol/libjingle_transport_factory.cc |
| 26 enum IceProtocolType { | 26 enum IceProtocolType { |
| 27 ICEPROTO_RFC5245 // Standard RFC 5245 version of ICE. | 27 ICEPROTO_RFC5245 // Standard RFC 5245 version of ICE. |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 // Base class for real implementations of TransportChannel. This includes some | 30 // Base class for real implementations of TransportChannel. This includes some |
| 31 // methods called only by Transport, which do not need to be exposed to the | 31 // methods called only by Transport, which do not need to be exposed to the |
| 32 // client. | 32 // client. |
| 33 class TransportChannelImpl : public TransportChannel { | 33 class TransportChannelImpl : public TransportChannel { |
| 34 public: | 34 public: |
| 35 explicit TransportChannelImpl(const std::string& content_name, int component) | 35 explicit TransportChannelImpl(const std::string& transport_name, |
| 36 : TransportChannel(content_name, component) {} | 36 int component) |
| 37 : TransportChannel(transport_name, component) {} |
| 37 | 38 |
| 38 // Returns the transport that created this channel. | 39 // Returns the transport that created this channel. |
| 39 virtual Transport* GetTransport() = 0; | 40 virtual Transport* GetTransport() = 0; |
| 40 | 41 |
| 41 // For ICE channels. | 42 // For ICE channels. |
| 42 virtual IceRole GetIceRole() const = 0; | 43 virtual IceRole GetIceRole() const = 0; |
| 43 virtual void SetIceRole(IceRole role) = 0; | 44 virtual void SetIceRole(IceRole role) = 0; |
| 44 virtual void SetIceTiebreaker(uint64 tiebreaker) = 0; | 45 virtual void SetIceTiebreaker(uint64 tiebreaker) = 0; |
| 45 // TODO(pthatcher): Remove this once it's no longer called in | 46 // TODO(pthatcher): Remove this once it's no longer called in |
| 46 // remoting/protocol/libjingle_transport_factory.cc | 47 // remoting/protocol/libjingle_transport_factory.cc |
| 47 virtual void SetIceProtocolType(IceProtocolType type) {} | 48 virtual void SetIceProtocolType(IceProtocolType type) {} |
| 48 // SetIceCredentials only need to be implemented by the ICE | 49 // SetIceCredentials only need to be implemented by the ICE |
| 49 // transport channels. Non-ICE transport channels can just ignore. | 50 // transport channels. Non-ICE transport channels can just ignore. |
| 50 // The ufrag and pwd should be set before the Connect() is called. | 51 // The ufrag and pwd should be set before the Connect() is called. |
| 51 virtual void SetIceCredentials(const std::string& ice_ufrag, | 52 virtual void SetIceCredentials(const std::string& ice_ufrag, |
| 52 const std::string& ice_pwd) = 0; | 53 const std::string& ice_pwd) = 0; |
| 53 // SetRemoteIceCredentials only need to be implemented by the ICE | 54 // SetRemoteIceCredentials only need to be implemented by the ICE |
| 54 // transport channels. Non-ICE transport channels can just ignore. | 55 // transport channels. Non-ICE transport channels can just ignore. |
| 55 virtual void SetRemoteIceCredentials(const std::string& ice_ufrag, | 56 virtual void SetRemoteIceCredentials(const std::string& ice_ufrag, |
| 56 const std::string& ice_pwd) = 0; | 57 const std::string& ice_pwd) = 0; |
| 57 | 58 |
| 58 // SetRemoteIceMode must be implemented only by the ICE transport channels. | 59 // SetRemoteIceMode must be implemented only by the ICE transport channels. |
| 59 virtual void SetRemoteIceMode(IceMode mode) = 0; | 60 virtual void SetRemoteIceMode(IceMode mode) = 0; |
| 60 | 61 |
| 61 virtual void SetReceivingTimeout(int timeout_ms) = 0; | 62 virtual void SetReceivingTimeout(int timeout_ms) = 0; |
| 62 | 63 |
| 63 // Begins the process of attempting to make a connection to the other client. | 64 // Begins the process of attempting to make a connection to the other client. |
| 65 // This includes starting to gather candidates. |
| 64 virtual void Connect() = 0; | 66 virtual void Connect() = 0; |
| 65 | 67 |
| 66 // Allows an individual channel to request signaling and be notified when it | 68 sigslot::signal1<TransportChannelImpl*> SignalGatheringState; |
| 67 // is ready. This is useful if the individual named channels have need to | |
| 68 // send their own transport-info stanzas. | |
| 69 sigslot::signal1<TransportChannelImpl*> SignalRequestSignaling; | |
| 70 virtual void OnSignalingReady() = 0; | |
| 71 | 69 |
| 72 // Handles sending and receiving of candidates. The Transport | 70 // Handles sending and receiving of candidates. The Transport |
| 73 // receives the candidates and may forward them to the relevant | 71 // receives the candidates and may forward them to the relevant |
| 74 // channel. | 72 // channel. |
| 75 // | 73 // |
| 76 // Note: Since candidates are delivered asynchronously to the | 74 // Note: Since candidates are delivered asynchronously to the |
| 77 // channel, they cannot return an error if the message is invalid. | 75 // channel, they cannot return an error if the message is invalid. |
| 78 // It is assumed that the Transport will have checked validity | 76 // It is assumed that the Transport will have checked validity |
| 79 // before forwarding. | 77 // before forwarding. |
| 80 sigslot::signal2<TransportChannelImpl*, | 78 sigslot::signal2<TransportChannelImpl*, const Candidate&> |
| 81 const Candidate&> SignalCandidateReady; | 79 SignalCandidateGathered; |
| 82 virtual void OnCandidate(const Candidate& candidate) = 0; | 80 virtual void AddRemoteCandidate(const Candidate& candidate) = 0; |
| 81 |
| 82 virtual IceGatheringState gathering_state() const = 0; |
| 83 | 83 |
| 84 // DTLS methods | 84 // DTLS methods |
| 85 // Set DTLS local identity. The identity object is not copied, but the caller | 85 // Set DTLS local identity. The identity object is not copied, but the caller |
| 86 // retains ownership and must delete it after this TransportChannelImpl is | 86 // retains ownership and must delete it after this TransportChannelImpl is |
| 87 // destroyed. | 87 // destroyed. |
| 88 // TODO(bemasc): Fix the ownership semantics of this method. | 88 // TODO(bemasc): Fix the ownership semantics of this method. |
| 89 virtual bool SetLocalIdentity(rtc::SSLIdentity* identity) = 0; | 89 virtual bool SetLocalIdentity(rtc::SSLIdentity* identity) = 0; |
| 90 | 90 |
| 91 // Set DTLS Remote fingerprint. Must be after local identity set. | 91 // Set DTLS Remote fingerprint. Must be after local identity set. |
| 92 virtual bool SetRemoteFingerprint(const std::string& digest_alg, | 92 virtual bool SetRemoteFingerprint(const std::string& digest_alg, |
| 93 const uint8* digest, | 93 const uint8* digest, |
| 94 size_t digest_len) = 0; | 94 size_t digest_len) = 0; |
| 95 | 95 |
| 96 virtual bool SetSslRole(rtc::SSLRole role) = 0; | 96 virtual bool SetSslRole(rtc::SSLRole role) = 0; |
| 97 | 97 |
| 98 // TransportChannel is forwarding this signal from PortAllocatorSession. | |
| 99 sigslot::signal1<TransportChannelImpl*> SignalCandidatesAllocationDone; | |
| 100 | |
| 101 // Invoked when there is conflict in the ICE role between local and remote | 98 // Invoked when there is conflict in the ICE role between local and remote |
| 102 // agents. | 99 // agents. |
| 103 sigslot::signal1<TransportChannelImpl*> SignalRoleConflict; | 100 sigslot::signal1<TransportChannelImpl*> SignalRoleConflict; |
| 104 | 101 |
| 105 // Emitted whenever the number of connections available to the transport | 102 // Emitted whenever the number of connections available to the transport |
| 106 // channel decreases. | 103 // channel decreases. |
| 107 sigslot::signal1<TransportChannelImpl*> SignalConnectionRemoved; | 104 sigslot::signal1<TransportChannelImpl*> SignalConnectionRemoved; |
| 108 | 105 |
| 109 private: | 106 private: |
| 110 DISALLOW_COPY_AND_ASSIGN(TransportChannelImpl); | 107 DISALLOW_COPY_AND_ASSIGN(TransportChannelImpl); |
| 111 }; | 108 }; |
| 112 | 109 |
| 113 } // namespace cricket | 110 } // namespace cricket |
| 114 | 111 |
| 115 #endif // WEBRTC_P2P_BASE_TRANSPORTCHANNELIMPL_H_ | 112 #endif // WEBRTC_P2P_BASE_TRANSPORTCHANNELIMPL_H_ |
| OLD | NEW |