| 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 11 matching lines...) Expand all Loading... |
| 22 namespace cricket { | 22 namespace cricket { |
| 23 | 23 |
| 24 class RelayEntry; | 24 class RelayEntry; |
| 25 class RelayConnection; | 25 class RelayConnection; |
| 26 | 26 |
| 27 // Communicates using an allocated port on the relay server. For each | 27 // Communicates using an allocated port on the relay server. For each |
| 28 // remote candidate that we try to send data to a RelayEntry instance | 28 // remote candidate that we try to send data to a RelayEntry instance |
| 29 // is created. The RelayEntry will try to reach the remote destination | 29 // is created. The RelayEntry will try to reach the remote destination |
| 30 // by connecting to all available server addresses in a pre defined | 30 // by connecting to all available server addresses in a pre defined |
| 31 // order with a small delay in between. When a connection is | 31 // order with a small delay in between. When a connection is |
| 32 // successful all other connection attemts are aborted. | 32 // successful all other connection attempts are aborted. |
| 33 class RelayPort : public Port { | 33 class RelayPort : public Port { |
| 34 public: | 34 public: |
| 35 typedef std::pair<rtc::Socket::Option, int> OptionValue; | 35 typedef std::pair<rtc::Socket::Option, int> OptionValue; |
| 36 | 36 |
| 37 // RelayPort doesn't yet do anything fancy in the ctor. | 37 // RelayPort doesn't yet do anything fancy in the ctor. |
| 38 static RelayPort* Create(rtc::Thread* thread, | 38 static RelayPort* Create(rtc::Thread* thread, |
| 39 rtc::PacketSocketFactory* factory, | 39 rtc::PacketSocketFactory* factory, |
| 40 rtc::Network* network, | 40 rtc::Network* network, |
| 41 const rtc::IPAddress& ip, | 41 const rtc::IPAddress& ip, |
| 42 uint16_t min_port, | 42 uint16_t min_port, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 const rtc::SocketAddress& addr, | 89 const rtc::SocketAddress& addr, |
| 90 const rtc::PacketOptions& options, | 90 const rtc::PacketOptions& options, |
| 91 bool payload); | 91 bool payload); |
| 92 | 92 |
| 93 // Dispatches the given packet to the port or connection as appropriate. | 93 // Dispatches the given packet to the port or connection as appropriate. |
| 94 void OnReadPacket(const char* data, size_t size, | 94 void OnReadPacket(const char* data, size_t size, |
| 95 const rtc::SocketAddress& remote_addr, | 95 const rtc::SocketAddress& remote_addr, |
| 96 ProtocolType proto, | 96 ProtocolType proto, |
| 97 const rtc::PacketTime& packet_time); | 97 const rtc::PacketTime& packet_time); |
| 98 | 98 |
| 99 // The OnSentPacket callback is left empty here since they are handled by |
| 100 // RelayEntry. |
| 101 void OnSentPacket(rtc::AsyncPacketSocket* socket, |
| 102 const rtc::SentPacket& sent_packet) override {} |
| 103 |
| 99 private: | 104 private: |
| 100 friend class RelayEntry; | 105 friend class RelayEntry; |
| 101 | 106 |
| 102 std::deque<ProtocolAddress> server_addr_; | 107 std::deque<ProtocolAddress> server_addr_; |
| 103 std::vector<ProtocolAddress> external_addr_; | 108 std::vector<ProtocolAddress> external_addr_; |
| 104 bool ready_; | 109 bool ready_; |
| 105 std::vector<RelayEntry*> entries_; | 110 std::vector<RelayEntry*> entries_; |
| 106 std::vector<OptionValue> options_; | 111 std::vector<OptionValue> options_; |
| 107 int error_; | 112 int error_; |
| 108 }; | 113 }; |
| 109 | 114 |
| 110 } // namespace cricket | 115 } // namespace cricket |
| 111 | 116 |
| 112 #endif // WEBRTC_P2P_BASE_RELAYPORT_H_ | 117 #endif // WEBRTC_P2P_BASE_RELAYPORT_H_ |
| OLD | NEW |