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