diff options
Diffstat (limited to 'remoting/protocol/chromium_socket_factory.cc')
-rw-r--r-- | remoting/protocol/chromium_socket_factory.cc | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/remoting/protocol/chromium_socket_factory.cc b/remoting/protocol/chromium_socket_factory.cc index a424adf..57fb33b 100644 --- a/remoting/protocol/chromium_socket_factory.cc +++ b/remoting/protocol/chromium_socket_factory.cc @@ -13,8 +13,8 @@ #include "net/base/net_errors.h" #include "net/udp/udp_server_socket.h" #include "remoting/protocol/socket_util.h" -#include "third_party/libjingle/source/talk/base/asyncpacketsocket.h" -#include "third_party/libjingle/source/talk/base/nethelpers.h" +#include "third_party/webrtc/base/asyncpacketsocket.h" +#include "third_party/webrtc/base/nethelpers.h" namespace remoting { namespace protocol { @@ -30,26 +30,26 @@ const int kReceiveBufferSize = 65536; // reached under normal conditions. const int kMaxSendBufferSize = 256 * 1024; -class UdpPacketSocket : public talk_base::AsyncPacketSocket { +class UdpPacketSocket : public rtc::AsyncPacketSocket { public: UdpPacketSocket(); virtual ~UdpPacketSocket(); - bool Init(const talk_base::SocketAddress& local_address, + bool Init(const rtc::SocketAddress& local_address, int min_port, int max_port); - // talk_base::AsyncPacketSocket interface. - virtual talk_base::SocketAddress GetLocalAddress() const OVERRIDE; - virtual talk_base::SocketAddress GetRemoteAddress() const OVERRIDE; + // rtc::AsyncPacketSocket interface. + virtual rtc::SocketAddress GetLocalAddress() const OVERRIDE; + virtual rtc::SocketAddress GetRemoteAddress() const OVERRIDE; virtual int Send(const void* data, size_t data_size, - const talk_base::PacketOptions& options) OVERRIDE; + const rtc::PacketOptions& options) OVERRIDE; virtual int SendTo(const void* data, size_t data_size, - const talk_base::SocketAddress& address, - const talk_base::PacketOptions& options) OVERRIDE; + const rtc::SocketAddress& address, + const rtc::PacketOptions& options) OVERRIDE; virtual int Close() OVERRIDE; virtual State GetState() const OVERRIDE; - virtual int GetOption(talk_base::Socket::Option option, int* value) OVERRIDE; - virtual int SetOption(talk_base::Socket::Option option, int value) OVERRIDE; + virtual int GetOption(rtc::Socket::Option option, int* value) OVERRIDE; + virtual int SetOption(rtc::Socket::Option option, int value) OVERRIDE; virtual int GetError() const OVERRIDE; virtual void SetError(int error) OVERRIDE; @@ -78,7 +78,7 @@ class UdpPacketSocket : public talk_base::AsyncPacketSocket { State state_; int error_; - talk_base::SocketAddress local_address_; + rtc::SocketAddress local_address_; // Receive buffer and address are populated by asynchronous reads. scoped_refptr<net::IOBuffer> receive_buffer_; @@ -112,7 +112,7 @@ UdpPacketSocket::~UdpPacketSocket() { Close(); } -bool UdpPacketSocket::Init(const talk_base::SocketAddress& local_address, +bool UdpPacketSocket::Init(const rtc::SocketAddress& local_address, int min_port, int max_port) { net::IPEndPoint local_endpoint; if (!jingle_glue::SocketAddressToIPEndPoint( @@ -148,27 +148,27 @@ bool UdpPacketSocket::Init(const talk_base::SocketAddress& local_address, return true; } -talk_base::SocketAddress UdpPacketSocket::GetLocalAddress() const { +rtc::SocketAddress UdpPacketSocket::GetLocalAddress() const { DCHECK_EQ(state_, STATE_BOUND); return local_address_; } -talk_base::SocketAddress UdpPacketSocket::GetRemoteAddress() const { +rtc::SocketAddress UdpPacketSocket::GetRemoteAddress() const { // UDP sockets are not connected - this method should never be called. NOTREACHED(); - return talk_base::SocketAddress(); + return rtc::SocketAddress(); } int UdpPacketSocket::Send(const void* data, size_t data_size, - const talk_base::PacketOptions& options) { + const rtc::PacketOptions& options) { // UDP sockets are not connected - this method should never be called. NOTREACHED(); return EWOULDBLOCK; } int UdpPacketSocket::SendTo(const void* data, size_t data_size, - const talk_base::SocketAddress& address, - const talk_base::PacketOptions& options) { + const rtc::SocketAddress& address, + const rtc::PacketOptions& options) { if (state_ != STATE_BOUND) { NOTREACHED(); return EINVAL; @@ -200,51 +200,51 @@ int UdpPacketSocket::Close() { return 0; } -talk_base::AsyncPacketSocket::State UdpPacketSocket::GetState() const { +rtc::AsyncPacketSocket::State UdpPacketSocket::GetState() const { return state_; } -int UdpPacketSocket::GetOption(talk_base::Socket::Option option, int* value) { +int UdpPacketSocket::GetOption(rtc::Socket::Option option, int* value) { // This method is never called by libjingle. NOTIMPLEMENTED(); return -1; } -int UdpPacketSocket::SetOption(talk_base::Socket::Option option, int value) { +int UdpPacketSocket::SetOption(rtc::Socket::Option option, int value) { if (state_ != STATE_BOUND) { NOTREACHED(); return EINVAL; } switch (option) { - case talk_base::Socket::OPT_DONTFRAGMENT: + case rtc::Socket::OPT_DONTFRAGMENT: NOTIMPLEMENTED(); return -1; - case talk_base::Socket::OPT_RCVBUF: { + case rtc::Socket::OPT_RCVBUF: { int net_error = socket_->SetReceiveBufferSize(value); return (net_error == net::OK) ? 0 : -1; } - case talk_base::Socket::OPT_SNDBUF: { + case rtc::Socket::OPT_SNDBUF: { int net_error = socket_->SetSendBufferSize(value); return (net_error == net::OK) ? 0 : -1; } - case talk_base::Socket::OPT_NODELAY: + case rtc::Socket::OPT_NODELAY: // OPT_NODELAY is only for TCP sockets. NOTREACHED(); return -1; - case talk_base::Socket::OPT_IPV6_V6ONLY: + case rtc::Socket::OPT_IPV6_V6ONLY: NOTIMPLEMENTED(); return -1; - case talk_base::Socket::OPT_DSCP: + case rtc::Socket::OPT_DSCP: NOTIMPLEMENTED(); return -1; - case talk_base::Socket::OPT_RTP_SENDTIME_EXTN_ID: + case rtc::Socket::OPT_RTP_SENDTIME_EXTN_ID: NOTIMPLEMENTED(); return -1; } @@ -336,14 +336,14 @@ void UdpPacketSocket::HandleReadResult(int result) { } if (result > 0) { - talk_base::SocketAddress address; + rtc::SocketAddress address; if (!jingle_glue::IPEndPointToSocketAddress(receive_address_, &address)) { NOTREACHED(); LOG(ERROR) << "Failed to convert address received from RecvFrom()."; return; } SignalReadPacket(this, receive_buffer_->data(), result, address, - talk_base::CreatePacketTime(0)); + rtc::CreatePacketTime(0)); } else { LOG(ERROR) << "Received error when reading from UDP socket: " << result; } @@ -357,8 +357,8 @@ ChromiumPacketSocketFactory::ChromiumPacketSocketFactory() { ChromiumPacketSocketFactory::~ChromiumPacketSocketFactory() { } -talk_base::AsyncPacketSocket* ChromiumPacketSocketFactory::CreateUdpSocket( - const talk_base::SocketAddress& local_address, +rtc::AsyncPacketSocket* ChromiumPacketSocketFactory::CreateUdpSocket( + const rtc::SocketAddress& local_address, int min_port, int max_port) { scoped_ptr<UdpPacketSocket> result(new UdpPacketSocket()); if (!result->Init(local_address, min_port, max_port)) @@ -366,9 +366,9 @@ talk_base::AsyncPacketSocket* ChromiumPacketSocketFactory::CreateUdpSocket( return result.release(); } -talk_base::AsyncPacketSocket* +rtc::AsyncPacketSocket* ChromiumPacketSocketFactory::CreateServerTcpSocket( - const talk_base::SocketAddress& local_address, + const rtc::SocketAddress& local_address, int min_port, int max_port, int opts) { // We don't use TCP sockets for remoting connections. @@ -376,11 +376,11 @@ ChromiumPacketSocketFactory::CreateServerTcpSocket( return NULL; } -talk_base::AsyncPacketSocket* +rtc::AsyncPacketSocket* ChromiumPacketSocketFactory::CreateClientTcpSocket( - const talk_base::SocketAddress& local_address, - const talk_base::SocketAddress& remote_address, - const talk_base::ProxyInfo& proxy_info, + const rtc::SocketAddress& local_address, + const rtc::SocketAddress& remote_address, + const rtc::ProxyInfo& proxy_info, const std::string& user_agent, int opts) { // We don't use TCP sockets for remoting connections. @@ -388,9 +388,9 @@ ChromiumPacketSocketFactory::CreateClientTcpSocket( return NULL; } -talk_base::AsyncResolverInterface* +rtc::AsyncResolverInterface* ChromiumPacketSocketFactory::CreateAsyncResolver() { - return new talk_base::AsyncResolver(); + return new rtc::AsyncResolver(); } } // namespace protocol |