| 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 20 matching lines...) Expand all Loading... |
| 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 attempts 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, | |
| 42 uint16_t min_port, | 41 uint16_t min_port, |
| 43 uint16_t max_port, | 42 uint16_t max_port, |
| 44 const std::string& username, | 43 const std::string& username, |
| 45 const std::string& password) { | 44 const std::string& password) { |
| 46 return new RelayPort(thread, factory, network, ip, min_port, max_port, | 45 return new RelayPort(thread, factory, network, min_port, max_port, username, |
| 47 username, password); | 46 password); |
| 48 } | 47 } |
| 49 ~RelayPort() override; | 48 ~RelayPort() override; |
| 50 | 49 |
| 51 void AddServerAddress(const ProtocolAddress& addr); | 50 void AddServerAddress(const ProtocolAddress& addr); |
| 52 void AddExternalAddress(const ProtocolAddress& addr); | 51 void AddExternalAddress(const ProtocolAddress& addr); |
| 53 | 52 |
| 54 const std::vector<OptionValue>& options() const { return options_; } | 53 const std::vector<OptionValue>& options() const { return options_; } |
| 55 bool HasMagicCookie(const char* data, size_t size); | 54 bool HasMagicCookie(const char* data, size_t size); |
| 56 | 55 |
| 57 void PrepareAddress() override; | 56 void PrepareAddress() override; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 75 } | 74 } |
| 76 | 75 |
| 77 // Used for testing. | 76 // Used for testing. |
| 78 sigslot::signal1<const ProtocolAddress*> SignalConnectFailure; | 77 sigslot::signal1<const ProtocolAddress*> SignalConnectFailure; |
| 79 sigslot::signal1<const ProtocolAddress*> SignalSoftTimeout; | 78 sigslot::signal1<const ProtocolAddress*> SignalSoftTimeout; |
| 80 | 79 |
| 81 protected: | 80 protected: |
| 82 RelayPort(rtc::Thread* thread, | 81 RelayPort(rtc::Thread* thread, |
| 83 rtc::PacketSocketFactory* factory, | 82 rtc::PacketSocketFactory* factory, |
| 84 rtc::Network*, | 83 rtc::Network*, |
| 85 const rtc::IPAddress& ip, | |
| 86 uint16_t min_port, | 84 uint16_t min_port, |
| 87 uint16_t max_port, | 85 uint16_t max_port, |
| 88 const std::string& username, | 86 const std::string& username, |
| 89 const std::string& password); | 87 const std::string& password); |
| 90 bool Init(); | 88 bool Init(); |
| 91 | 89 |
| 92 void SetReady(); | 90 void SetReady(); |
| 93 | 91 |
| 94 int SendTo(const void* data, | 92 int SendTo(const void* data, |
| 95 size_t size, | 93 size_t size, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 115 std::vector<ProtocolAddress> external_addr_; | 113 std::vector<ProtocolAddress> external_addr_; |
| 116 bool ready_; | 114 bool ready_; |
| 117 std::vector<RelayEntry*> entries_; | 115 std::vector<RelayEntry*> entries_; |
| 118 std::vector<OptionValue> options_; | 116 std::vector<OptionValue> options_; |
| 119 int error_; | 117 int error_; |
| 120 }; | 118 }; |
| 121 | 119 |
| 122 } // namespace cricket | 120 } // namespace cricket |
| 123 | 121 |
| 124 #endif // WEBRTC_P2P_BASE_RELAYPORT_H_ | 122 #endif // WEBRTC_P2P_BASE_RELAYPORT_H_ |
| OLD | NEW |