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 23 matching lines...) Expand all Loading... |
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, | 43 virtual int Send(const void* data, size_t data_size, |
44 talk_base::DiffServCodePoint dscp) OVERRIDE; | 44 const talk_base::PacketOptions& options) OVERRIDE; |
45 virtual int SendTo(const void* data, | 45 virtual int SendTo(const void* data, |
46 size_t data_size, | 46 size_t data_size, |
47 const talk_base::SocketAddress& address, | 47 const talk_base::SocketAddress& address, |
48 talk_base::DiffServCodePoint dscp) OVERRIDE; | 48 const talk_base::PacketOptions& options) OVERRIDE; |
49 virtual int Close() OVERRIDE; | 49 virtual int Close() OVERRIDE; |
50 virtual State GetState() const OVERRIDE; | 50 virtual State GetState() const OVERRIDE; |
51 virtual int GetOption(talk_base::Socket::Option opt, int* value) OVERRIDE; | 51 virtual int GetOption(talk_base::Socket::Option opt, int* value) OVERRIDE; |
52 virtual int SetOption(talk_base::Socket::Option opt, int value) OVERRIDE; | 52 virtual int SetOption(talk_base::Socket::Option opt, int value) OVERRIDE; |
53 virtual int GetError() const OVERRIDE; | 53 virtual int GetError() const OVERRIDE; |
54 virtual void SetError(int error) OVERRIDE; | 54 virtual void SetError(int error) OVERRIDE; |
55 | 55 |
56 private: | 56 private: |
57 struct PendingPacket { | 57 struct PendingPacket { |
58 PendingPacket(const void* buffer, | 58 PendingPacket(const void* buffer, |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 return local_address_; | 186 return local_address_; |
187 } | 187 } |
188 | 188 |
189 talk_base::SocketAddress UdpPacketSocket::GetRemoteAddress() const { | 189 talk_base::SocketAddress UdpPacketSocket::GetRemoteAddress() const { |
190 // UDP sockets are not connected - this method should never be called. | 190 // UDP sockets are not connected - this method should never be called. |
191 NOTREACHED(); | 191 NOTREACHED(); |
192 return talk_base::SocketAddress(); | 192 return talk_base::SocketAddress(); |
193 } | 193 } |
194 | 194 |
195 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) { | 196 const talk_base::PacketOptions& options) { |
197 // UDP sockets are not connected - this method should never be called. | 197 // UDP sockets are not connected - this method should never be called. |
198 NOTREACHED(); | 198 NOTREACHED(); |
199 return EWOULDBLOCK; | 199 return EWOULDBLOCK; |
200 } | 200 } |
201 | 201 |
202 int UdpPacketSocket::SendTo(const void* data, | 202 int UdpPacketSocket::SendTo(const void* data, |
203 size_t data_size, | 203 size_t data_size, |
204 const talk_base::SocketAddress& address, | 204 const talk_base::SocketAddress& address, |
205 talk_base::DiffServCodePoint dscp) { | 205 const talk_base::PacketOptions& options) { |
206 if (state_ != STATE_BOUND) { | 206 if (state_ != STATE_BOUND) { |
207 // TODO(sergeyu): StunPort may try to send stun request before we | 207 // TODO(sergeyu): StunPort may try to send stun request before we |
208 // are bound. Fix that problem and change this to DCHECK. | 208 // are bound. Fix that problem and change this to DCHECK. |
209 return EINVAL; | 209 return EINVAL; |
210 } | 210 } |
211 | 211 |
212 if (error_ != 0) { | 212 if (error_ != 0) { |
213 return error_; | 213 return error_; |
214 } | 214 } |
215 | 215 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 return NULL; | 376 return NULL; |
377 } | 377 } |
378 | 378 |
379 talk_base::AsyncResolverInterface* | 379 talk_base::AsyncResolverInterface* |
380 PepperPacketSocketFactory::CreateAsyncResolver() { | 380 PepperPacketSocketFactory::CreateAsyncResolver() { |
381 NOTREACHED(); | 381 NOTREACHED(); |
382 return NULL; | 382 return NULL; |
383 } | 383 } |
384 | 384 |
385 } // namespace remoting | 385 } // namespace remoting |
OLD | NEW |