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

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

Issue 2025573002: Use continual gathering to restore backup connections (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: . Created 4 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2012 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 virtual Connection* CreateConnection( 71 virtual Connection* CreateConnection(
72 const Candidate& remote_candidate, CandidateOrigin origin) = 0; 72 const Candidate& remote_candidate, CandidateOrigin origin) = 0;
73 73
74 // Functions on the underlying socket(s). 74 // Functions on the underlying socket(s).
75 virtual int SetOption(rtc::Socket::Option opt, int value) = 0; 75 virtual int SetOption(rtc::Socket::Option opt, int value) = 0;
76 virtual int GetOption(rtc::Socket::Option opt, int* value) = 0; 76 virtual int GetOption(rtc::Socket::Option opt, int* value) = 0;
77 virtual int GetError() = 0; 77 virtual int GetError() = 0;
78 78
79 virtual const std::vector<Candidate>& Candidates() const = 0; 79 virtual const std::vector<Candidate>& Candidates() const = 0;
80 80
81 // A port is closed when it is not actively used. A closed port will not be
82 // used to create connections except when it receives stun requests from
83 // unknown addresses, although the connections on it may still be used.
84 virtual void Close() = 0;
85
81 // Sends the given packet to the given address, provided that the address is 86 // Sends the given packet to the given address, provided that the address is
82 // that of a connection or an address that has sent to us already. 87 // that of a connection or an address that has sent to us already.
83 virtual int SendTo(const void* data, size_t size, 88 virtual int SendTo(const void* data, size_t size,
84 const rtc::SocketAddress& addr, 89 const rtc::SocketAddress& addr,
85 const rtc::PacketOptions& options, bool payload) = 0; 90 const rtc::PacketOptions& options, bool payload) = 0;
86 91
87 // Indicates that we received a successful STUN binding request from an 92 // Indicates that we received a successful STUN binding request from an
88 // address that doesn't correspond to any current connection. To turn this 93 // address that doesn't correspond to any current connection. To turn this
89 // into a real connection, call CreateConnection. 94 // into a real connection, call CreateConnection.
90 sigslot::signal6<PortInterface*, const rtc::SocketAddress&, 95 sigslot::signal6<PortInterface*, const rtc::SocketAddress&,
91 ProtocolType, IceMessage*, const std::string&, 96 ProtocolType, IceMessage*, const std::string&,
92 bool> SignalUnknownAddress; 97 bool> SignalUnknownAddress;
93 98
94 // Sends a response message (normal or error) to the given request. One of 99 // Sends a response message (normal or error) to the given request. One of
95 // these methods should be called as a response to SignalUnknownAddress. 100 // these methods should be called as a response to SignalUnknownAddress.
96 // NOTE: You MUST call CreateConnection BEFORE SendBindingResponse. 101 // NOTE: You MUST call CreateConnection BEFORE SendBindingResponse.
97 virtual void SendBindingResponse(StunMessage* request, 102 virtual void SendBindingResponse(StunMessage* request,
98 const rtc::SocketAddress& addr) = 0; 103 const rtc::SocketAddress& addr) = 0;
99 virtual void SendBindingErrorResponse( 104 virtual void SendBindingErrorResponse(
100 StunMessage* request, const rtc::SocketAddress& addr, 105 StunMessage* request, const rtc::SocketAddress& addr,
101 int error_code, const std::string& reason) = 0; 106 int error_code, const std::string& reason) = 0;
102 107
103 // Signaled when this port decides to delete itself because it no longer has 108 // Signaled when this port decides to delete itself because it no longer has
104 // any usefulness. 109 // any usefulness.
105 sigslot::signal1<PortInterface*> SignalDestroyed; 110 sigslot::signal1<PortInterface*> SignalDestroyed;
106 111
107 // Signaled when the network used by this port becomes inactive. 112 // A closed port will not be used to create new connections except when
108 sigslot::signal1<PortInterface*> SignalNetworkInactive; 113 // receiving stun ping from unknown address.
114 sigslot::signal1<PortInterface*> SignalClosed;
109 115
110 // Signaled when Port discovers ice role conflict with the peer. 116 // Signaled when Port discovers ice role conflict with the peer.
111 sigslot::signal1<PortInterface*> SignalRoleConflict; 117 sigslot::signal1<PortInterface*> SignalRoleConflict;
112 118
113 // Normally, packets arrive through a connection (or they result signaling of 119 // Normally, packets arrive through a connection (or they result signaling of
114 // unknown address). Calling this method turns off delivery of packets 120 // unknown address). Calling this method turns off delivery of packets
115 // through their respective connection and instead delivers every packet 121 // through their respective connection and instead delivers every packet
116 // through this port. 122 // through this port.
117 virtual void EnablePortPackets() = 0; 123 virtual void EnablePortPackets() = 0;
118 sigslot::signal4<PortInterface*, const char*, size_t, 124 sigslot::signal4<PortInterface*, const char*, size_t,
119 const rtc::SocketAddress&> SignalReadPacket; 125 const rtc::SocketAddress&> SignalReadPacket;
120 126
121 // Emitted each time a packet is sent on this port. 127 // Emitted each time a packet is sent on this port.
122 sigslot::signal1<const rtc::SentPacket&> SignalSentPacket; 128 sigslot::signal1<const rtc::SentPacket&> SignalSentPacket;
123 129
124 virtual std::string ToString() const = 0; 130 virtual std::string ToString() const = 0;
125 131
132 virtual void FailAndDestroyConnections() = 0;
133
126 protected: 134 protected:
127 PortInterface() {} 135 PortInterface() {}
128 }; 136 };
129 137
130 } // namespace cricket 138 } // namespace cricket
131 139
132 #endif // WEBRTC_P2P_BASE_PORTINTERFACE_H_ 140 #endif // WEBRTC_P2P_BASE_PORTINTERFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698