Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/client/plugin/pepper_packet_socket_factory.h" | 5 #include "remoting/client/plugin/pepper_packet_socket_factory.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
| 10 #include "ppapi/cpp/net_address.h" | 10 #include "ppapi/cpp/net_address.h" |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 | 33 |
| 34 // |min_port| and |max_port| are set to zero if the port number | 34 // |min_port| and |max_port| are set to zero if the port number |
| 35 // should be assigned by the OS. | 35 // should be assigned by the OS. |
| 36 bool Init(const talk_base::SocketAddress& local_address, | 36 bool Init(const talk_base::SocketAddress& local_address, |
| 37 int min_port, | 37 int min_port, |
| 38 int max_port); | 38 int max_port); |
| 39 | 39 |
| 40 // talk_base::AsyncPacketSocket interface. | 40 // talk_base::AsyncPacketSocket interface. |
| 41 virtual talk_base::SocketAddress GetLocalAddress() const OVERRIDE; | 41 virtual talk_base::SocketAddress GetLocalAddress() const OVERRIDE; |
| 42 virtual talk_base::SocketAddress GetRemoteAddress() const OVERRIDE; | 42 virtual talk_base::SocketAddress GetRemoteAddress() const OVERRIDE; |
| 43 virtual int Send(const void* data, size_t data_size) OVERRIDE; | 43 virtual int Send(const void* data, size_t data_size, |
| 44 talk_base::DiffServCodePoint dscp) OVERRIDE; | |
| 44 virtual int SendTo(const void* data, | 45 virtual int SendTo(const void* data, |
| 45 size_t data_size, | 46 size_t data_size, |
| 46 const talk_base::SocketAddress& address) OVERRIDE; | 47 const talk_base::SocketAddress& address, |
| 48 talk_base::DiffServCodePoint dscp) OVERRIDE; | |
| 47 virtual int Close() OVERRIDE; | 49 virtual int Close() OVERRIDE; |
| 48 virtual State GetState() const OVERRIDE; | 50 virtual State GetState() const OVERRIDE; |
| 49 virtual int GetOption(talk_base::Socket::Option opt, int* value) OVERRIDE; | 51 virtual int GetOption(talk_base::Socket::Option opt, int* value) OVERRIDE; |
| 50 virtual int SetOption(talk_base::Socket::Option opt, int value) OVERRIDE; | 52 virtual int SetOption(talk_base::Socket::Option opt, int value) OVERRIDE; |
| 51 virtual int GetError() const OVERRIDE; | 53 virtual int GetError() const OVERRIDE; |
| 52 virtual void SetError(int error) OVERRIDE; | 54 virtual void SetError(int error) OVERRIDE; |
| 53 | 55 |
| 54 private: | 56 private: |
| 55 struct PendingPacket { | 57 struct PendingPacket { |
| 56 PendingPacket(const void* buffer, | 58 PendingPacket(const void* buffer, |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 DCHECK_EQ(state_, STATE_BOUND); | 185 DCHECK_EQ(state_, STATE_BOUND); |
| 184 return local_address_; | 186 return local_address_; |
| 185 } | 187 } |
| 186 | 188 |
| 187 talk_base::SocketAddress UdpPacketSocket::GetRemoteAddress() const { | 189 talk_base::SocketAddress UdpPacketSocket::GetRemoteAddress() const { |
| 188 // UDP sockets are not connected - this method should never be called. | 190 // UDP sockets are not connected - this method should never be called. |
| 189 NOTREACHED(); | 191 NOTREACHED(); |
| 190 return talk_base::SocketAddress(); | 192 return talk_base::SocketAddress(); |
| 191 } | 193 } |
| 192 | 194 |
| 193 int UdpPacketSocket::Send(const void* data, size_t data_size) { | 195 int UdpPacketSocket::Send(const void* data, size_t data_size, |
| 196 talk_base::DiffServCodePoint dscp) { | |
| 194 // UDP sockets are not connected - this method should never be called. | 197 // UDP sockets are not connected - this method should never be called. |
| 195 NOTREACHED(); | 198 NOTREACHED(); |
| 196 return EWOULDBLOCK; | 199 return EWOULDBLOCK; |
| 197 } | 200 } |
| 198 | 201 |
| 199 int UdpPacketSocket::SendTo(const void* data, | 202 int UdpPacketSocket::SendTo(const void* data, |
| 200 size_t data_size, | 203 size_t data_size, |
| 201 const talk_base::SocketAddress& address) { | 204 const talk_base::SocketAddress& address, |
| 205 talk_base::DiffServCodePoint /*dscp*/) { | |
|
Sergey Ulanov
2013/09/23 22:32:36
same here
Mallinath (Gone from Chromium)
2013/09/23 22:38:14
Done.
| |
| 202 if (state_ != STATE_BOUND) { | 206 if (state_ != STATE_BOUND) { |
| 203 // TODO(sergeyu): StunPort may try to send stun request before we | 207 // TODO(sergeyu): StunPort may try to send stun request before we |
| 204 // are bound. Fix that problem and change this to DCHECK. | 208 // are bound. Fix that problem and change this to DCHECK. |
| 205 return EINVAL; | 209 return EINVAL; |
| 206 } | 210 } |
| 207 | 211 |
| 208 if (error_ != 0) { | 212 if (error_ != 0) { |
| 209 return error_; | 213 return error_; |
| 210 } | 214 } |
| 211 | 215 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 365 const talk_base::SocketAddress& remote_address, | 369 const talk_base::SocketAddress& remote_address, |
| 366 const talk_base::ProxyInfo& proxy_info, | 370 const talk_base::ProxyInfo& proxy_info, |
| 367 const std::string& user_agent, | 371 const std::string& user_agent, |
| 368 int opts) { | 372 int opts) { |
| 369 // We don't use TCP sockets for remoting connections. | 373 // We don't use TCP sockets for remoting connections. |
| 370 NOTREACHED(); | 374 NOTREACHED(); |
| 371 return NULL; | 375 return NULL; |
| 372 } | 376 } |
| 373 | 377 |
| 374 } // namespace remoting | 378 } // namespace remoting |
| OLD | NEW |