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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 virtual ~UDPPort(); | 74 virtual ~UDPPort(); |
75 | 75 |
76 rtc::SocketAddress GetLocalAddress() const { | 76 rtc::SocketAddress GetLocalAddress() const { |
77 return socket_->GetLocalAddress(); | 77 return socket_->GetLocalAddress(); |
78 } | 78 } |
79 | 79 |
80 const ServerAddresses& server_addresses() const { | 80 const ServerAddresses& server_addresses() const { |
81 return server_addresses_; | 81 return server_addresses_; |
82 } | 82 } |
83 void set_server_addresses(const ServerAddresses& addresses) { | 83 void |
| 84 set_server_addresses(const ServerAddresses& addresses) { |
84 server_addresses_ = addresses; | 85 server_addresses_ = addresses; |
85 } | 86 } |
86 | 87 |
87 virtual void PrepareAddress(); | 88 virtual void PrepareAddress(); |
88 | 89 |
89 virtual Connection* CreateConnection(const Candidate& address, | 90 virtual Connection* CreateConnection(const Candidate& address, |
90 CandidateOrigin origin); | 91 CandidateOrigin origin); |
91 virtual int SetOption(rtc::Socket::Option opt, int value); | 92 virtual int SetOption(rtc::Socket::Option opt, int value); |
92 virtual int GetOption(rtc::Socket::Option opt, int* value); | 93 virtual int GetOption(rtc::Socket::Option opt, int* value); |
93 virtual int GetError(); | 94 virtual int GetError(); |
94 | 95 |
95 virtual bool HandleIncomingPacket( | 96 virtual bool HandleIncomingPacket( |
96 rtc::AsyncPacketSocket* socket, const char* data, size_t size, | 97 rtc::AsyncPacketSocket* socket, const char* data, size_t size, |
97 const rtc::SocketAddress& remote_addr, | 98 const rtc::SocketAddress& remote_addr, |
98 const rtc::PacketTime& packet_time) { | 99 const rtc::PacketTime& packet_time) { |
99 // All packets given to UDP port will be consumed. | 100 // All packets given to UDP port will be consumed. |
100 OnReadPacket(socket, data, size, remote_addr, packet_time); | 101 OnReadPacket(socket, data, size, remote_addr, packet_time); |
101 return true; | 102 return true; |
102 } | 103 } |
103 virtual bool SupportsProtocol(const std::string& protocol) const { | 104 virtual bool SupportsProtocol(const std::string& protocol) const { |
104 return protocol == UDP_PROTOCOL_NAME; | 105 return protocol == UDP_PROTOCOL_NAME; |
105 } | 106 } |
106 | 107 |
107 virtual ProtocolType GetProtocol() const { return PROTO_UDP; } | |
108 | |
109 void set_stun_keepalive_delay(int delay) { | 108 void set_stun_keepalive_delay(int delay) { |
110 stun_keepalive_delay_ = delay; | 109 stun_keepalive_delay_ = delay; |
111 } | 110 } |
112 int stun_keepalive_delay() const { | 111 int stun_keepalive_delay() const { |
113 return stun_keepalive_delay_; | 112 return stun_keepalive_delay_; |
114 } | 113 } |
115 | 114 |
116 // Visible for testing. | 115 // Visible for testing. |
117 int stun_keepalive_lifetime() const { return stun_keepalive_lifetime_; } | 116 int stun_keepalive_lifetime() const { return stun_keepalive_lifetime_; } |
118 void set_stun_keepalive_lifetime(int lifetime) { | 117 void set_stun_keepalive_lifetime(int lifetime) { |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 false) { | 305 false) { |
307 // UDPPort will set these to local udp, updating these to STUN. | 306 // UDPPort will set these to local udp, updating these to STUN. |
308 set_type(STUN_PORT_TYPE); | 307 set_type(STUN_PORT_TYPE); |
309 set_server_addresses(servers); | 308 set_server_addresses(servers); |
310 } | 309 } |
311 }; | 310 }; |
312 | 311 |
313 } // namespace cricket | 312 } // namespace cricket |
314 | 313 |
315 #endif // WEBRTC_P2P_BASE_STUNPORT_H_ | 314 #endif // WEBRTC_P2P_BASE_STUNPORT_H_ |
OLD | NEW |