| 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/jingle_glue/chromium_socket_factory.h" | 5 #include "remoting/jingle_glue/chromium_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 "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "jingle/glue/utils.h" | 10 #include "jingle/glue/utils.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 UdpPacketSocket(); | 40 UdpPacketSocket(); |
| 41 virtual ~UdpPacketSocket(); | 41 virtual ~UdpPacketSocket(); |
| 42 | 42 |
| 43 bool Init(const talk_base::SocketAddress& local_address, | 43 bool Init(const talk_base::SocketAddress& local_address, |
| 44 int min_port, int max_port); | 44 int min_port, int max_port); |
| 45 | 45 |
| 46 // talk_base::AsyncPacketSocket interface. | 46 // talk_base::AsyncPacketSocket interface. |
| 47 virtual talk_base::SocketAddress GetLocalAddress() const OVERRIDE; | 47 virtual talk_base::SocketAddress GetLocalAddress() const OVERRIDE; |
| 48 virtual talk_base::SocketAddress GetRemoteAddress() const OVERRIDE; | 48 virtual talk_base::SocketAddress GetRemoteAddress() const OVERRIDE; |
| 49 virtual int Send(const void* data, size_t data_size, | 49 virtual int Send(const void* data, size_t data_size, |
| 50 talk_base::DiffServCodePoint dscp) OVERRIDE; | 50 const talk_base::PacketOptions& options) OVERRIDE; |
| 51 virtual int SendTo(const void* data, size_t data_size, | 51 virtual int SendTo(const void* data, size_t data_size, |
| 52 const talk_base::SocketAddress& address, | 52 const talk_base::SocketAddress& address, |
| 53 talk_base::DiffServCodePoint dscp) OVERRIDE; | 53 const talk_base::PacketOptions& options) OVERRIDE; |
| 54 virtual int Close() OVERRIDE; | 54 virtual int Close() OVERRIDE; |
| 55 virtual State GetState() const OVERRIDE; | 55 virtual State GetState() const OVERRIDE; |
| 56 virtual int GetOption(talk_base::Socket::Option option, int* value) OVERRIDE; | 56 virtual int GetOption(talk_base::Socket::Option option, int* value) OVERRIDE; |
| 57 virtual int SetOption(talk_base::Socket::Option option, int value) OVERRIDE; | 57 virtual int SetOption(talk_base::Socket::Option option, int value) OVERRIDE; |
| 58 virtual int GetError() const OVERRIDE; | 58 virtual int GetError() const OVERRIDE; |
| 59 virtual void SetError(int error) OVERRIDE; | 59 virtual void SetError(int error) OVERRIDE; |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 struct PendingPacket { | 62 struct PendingPacket { |
| 63 PendingPacket(const void* buffer, | 63 PendingPacket(const void* buffer, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 return local_address_; | 156 return local_address_; |
| 157 } | 157 } |
| 158 | 158 |
| 159 talk_base::SocketAddress UdpPacketSocket::GetRemoteAddress() const { | 159 talk_base::SocketAddress UdpPacketSocket::GetRemoteAddress() const { |
| 160 // UDP sockets are not connected - this method should never be called. | 160 // UDP sockets are not connected - this method should never be called. |
| 161 NOTREACHED(); | 161 NOTREACHED(); |
| 162 return talk_base::SocketAddress(); | 162 return talk_base::SocketAddress(); |
| 163 } | 163 } |
| 164 | 164 |
| 165 int UdpPacketSocket::Send(const void* data, size_t data_size, | 165 int UdpPacketSocket::Send(const void* data, size_t data_size, |
| 166 talk_base::DiffServCodePoint dscp) { | 166 const talk_base::PacketOptions& options) { |
| 167 // UDP sockets are not connected - this method should never be called. | 167 // UDP sockets are not connected - this method should never be called. |
| 168 NOTREACHED(); | 168 NOTREACHED(); |
| 169 return EWOULDBLOCK; | 169 return EWOULDBLOCK; |
| 170 } | 170 } |
| 171 | 171 |
| 172 int UdpPacketSocket::SendTo(const void* data, size_t data_size, | 172 int UdpPacketSocket::SendTo(const void* data, size_t data_size, |
| 173 const talk_base::SocketAddress& address, | 173 const talk_base::SocketAddress& address, |
| 174 talk_base::DiffServCodePoint dscp) { | 174 const talk_base::PacketOptions& options) { |
| 175 if (state_ != STATE_BOUND) { | 175 if (state_ != STATE_BOUND) { |
| 176 NOTREACHED(); | 176 NOTREACHED(); |
| 177 return EINVAL; | 177 return EINVAL; |
| 178 } | 178 } |
| 179 | 179 |
| 180 if (error_ != 0) { | 180 if (error_ != 0) { |
| 181 return error_; | 181 return error_; |
| 182 } | 182 } |
| 183 | 183 |
| 184 net::IPEndPoint endpoint; | 184 net::IPEndPoint endpoint; |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 NOTREACHED(); | 376 NOTREACHED(); |
| 377 return NULL; | 377 return NULL; |
| 378 } | 378 } |
| 379 | 379 |
| 380 talk_base::AsyncResolverInterface* | 380 talk_base::AsyncResolverInterface* |
| 381 ChromiumPacketSocketFactory::CreateAsyncResolver() { | 381 ChromiumPacketSocketFactory::CreateAsyncResolver() { |
| 382 return new talk_base::AsyncResolver(); | 382 return new talk_base::AsyncResolver(); |
| 383 } | 383 } |
| 384 | 384 |
| 385 } // namespace remoting | 385 } // namespace remoting |
| OLD | NEW |