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 17 matching lines...) Expand all Loading... |
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 attemts 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( | 38 static RelayPort* Create(rtc::Thread* thread, |
39 rtc::Thread* thread, | 39 rtc::PacketSocketFactory* factory, |
40 rtc::PacketSocketFactory* factory, | 40 rtc::Network* network, |
41 rtc::Network* network, | 41 const rtc::IPAddress& ip, |
42 const rtc::IPAddress& ip, | 42 uint16_t min_port, |
43 uint16 min_port, | 43 uint16_t max_port, |
44 uint16 max_port, | 44 const std::string& username, |
45 const std::string& username, | 45 const std::string& password) { |
46 const std::string& password) { | |
47 return new RelayPort(thread, factory, network, ip, min_port, max_port, | 46 return new RelayPort(thread, factory, network, ip, min_port, max_port, |
48 username, password); | 47 username, password); |
49 } | 48 } |
50 virtual ~RelayPort(); | 49 virtual ~RelayPort(); |
51 | 50 |
52 void AddServerAddress(const ProtocolAddress& addr); | 51 void AddServerAddress(const ProtocolAddress& addr); |
53 void AddExternalAddress(const ProtocolAddress& addr); | 52 void AddExternalAddress(const ProtocolAddress& addr); |
54 | 53 |
55 const std::vector<OptionValue>& options() const { return options_; } | 54 const std::vector<OptionValue>& options() const { return options_; } |
56 bool HasMagicCookie(const char* data, size_t size); | 55 bool HasMagicCookie(const char* data, size_t size); |
(...skipping 10 matching lines...) Expand all Loading... |
67 | 66 |
68 // Used for testing. | 67 // Used for testing. |
69 sigslot::signal1<const ProtocolAddress*> SignalConnectFailure; | 68 sigslot::signal1<const ProtocolAddress*> SignalConnectFailure; |
70 sigslot::signal1<const ProtocolAddress*> SignalSoftTimeout; | 69 sigslot::signal1<const ProtocolAddress*> SignalSoftTimeout; |
71 | 70 |
72 protected: | 71 protected: |
73 RelayPort(rtc::Thread* thread, | 72 RelayPort(rtc::Thread* thread, |
74 rtc::PacketSocketFactory* factory, | 73 rtc::PacketSocketFactory* factory, |
75 rtc::Network*, | 74 rtc::Network*, |
76 const rtc::IPAddress& ip, | 75 const rtc::IPAddress& ip, |
77 uint16 min_port, | 76 uint16_t min_port, |
78 uint16 max_port, | 77 uint16_t max_port, |
79 const std::string& username, | 78 const std::string& username, |
80 const std::string& password); | 79 const std::string& password); |
81 bool Init(); | 80 bool Init(); |
82 | 81 |
83 void SetReady(); | 82 void SetReady(); |
84 | 83 |
85 virtual int SendTo(const void* data, size_t size, | 84 virtual int SendTo(const void* data, size_t size, |
86 const rtc::SocketAddress& addr, | 85 const rtc::SocketAddress& addr, |
87 const rtc::PacketOptions& options, | 86 const rtc::PacketOptions& options, |
88 bool payload); | 87 bool payload); |
(...skipping 11 matching lines...) Expand all Loading... |
100 std::vector<ProtocolAddress> external_addr_; | 99 std::vector<ProtocolAddress> external_addr_; |
101 bool ready_; | 100 bool ready_; |
102 std::vector<RelayEntry*> entries_; | 101 std::vector<RelayEntry*> entries_; |
103 std::vector<OptionValue> options_; | 102 std::vector<OptionValue> options_; |
104 int error_; | 103 int error_; |
105 }; | 104 }; |
106 | 105 |
107 } // namespace cricket | 106 } // namespace cricket |
108 | 107 |
109 #endif // WEBRTC_P2P_BASE_RELAYPORT_H_ | 108 #endif // WEBRTC_P2P_BASE_RELAYPORT_H_ |
OLD | NEW |