diff --git a/starboard/android/shared/BUILD.gn b/starboard/android/shared/BUILD.gn index deae45e95890..c3da5f596ee4 100644 --- a/starboard/android/shared/BUILD.gn +++ b/starboard/android/shared/BUILD.gn @@ -86,17 +86,12 @@ static_library("starboard_platform") { "//starboard/shared/posix/memory_free_aligned.cc", "//starboard/shared/posix/page_internal.cc", "//starboard/shared/posix/set_non_blocking_internal.cc", - "//starboard/shared/posix/socket_accept.cc", - "//starboard/shared/posix/socket_bind.cc", "//starboard/shared/posix/socket_connect.cc", "//starboard/shared/posix/socket_create.cc", "//starboard/shared/posix/socket_destroy.cc", "//starboard/shared/posix/socket_get_local_address.cc", "//starboard/shared/posix/socket_internal.cc", "//starboard/shared/posix/socket_is_ipv6_supported.cc", - "//starboard/shared/posix/socket_listen.cc", - "//starboard/shared/posix/socket_receive_from.cc", - "//starboard/shared/posix/socket_set_reuse_address.cc", "//starboard/shared/posix/storage_write_record.cc", "//starboard/shared/posix/system_break_into_debugger.cc", "//starboard/shared/posix/system_clear_last_error.cc", diff --git a/starboard/common/socket.cc b/starboard/common/socket.cc index f66ee82ea581..b987d781c921 100644 --- a/starboard/common/socket.cc +++ b/starboard/common/socket.cc @@ -75,37 +75,10 @@ SbSocketError Socket::Connect(const SbSocketAddress* address) { return SbSocketConnect(socket_, address); } -SbSocketError Socket::Bind(const SbSocketAddress* local_address) { - return SbSocketBind(socket_, local_address); -} - -SbSocketError Socket::Listen() { - return SbSocketListen(socket_); -} - -Socket* Socket::Accept() { - SbSocket accepted_socket = SbSocketAccept(socket_); - if (SbSocketIsValid(accepted_socket)) { - return new Socket(accepted_socket); - } - - return NULL; -} - -int Socket::ReceiveFrom(char* out_data, - int data_size, - SbSocketAddress* out_source) { - return SbSocketReceiveFrom(socket_, out_data, data_size, out_source); -} - bool Socket::GetLocalAddress(SbSocketAddress* out_address) { return SbSocketGetLocalAddress(socket_, out_address); } -bool Socket::SetReuseAddress(bool value) { - return SbSocketSetReuseAddress(socket_, value); -} - SbSocket Socket::socket() { return socket_; } diff --git a/starboard/elf_loader/exported_symbols.cc b/starboard/elf_loader/exported_symbols.cc index e0bea2524150..85d0000a8427 100644 --- a/starboard/elf_loader/exported_symbols.cc +++ b/starboard/elf_loader/exported_symbols.cc @@ -147,17 +147,12 @@ ExportedSymbols::ExportedSymbols() { REGISTER_SYMBOL(SbPlayerSetVolume); REGISTER_SYMBOL(SbPlayerWriteEndOfStream); REGISTER_SYMBOL(SbPlayerWriteSamples); - REGISTER_SYMBOL(SbSocketAccept); - REGISTER_SYMBOL(SbSocketBind); REGISTER_SYMBOL(SbSocketConnect); REGISTER_SYMBOL(SbSocketCreate); REGISTER_SYMBOL(SbSocketDestroy); REGISTER_SYMBOL(SbSocketGetInterfaceAddress); REGISTER_SYMBOL(SbSocketGetLocalAddress); REGISTER_SYMBOL(SbSocketIsIpv6Supported); - REGISTER_SYMBOL(SbSocketListen); - REGISTER_SYMBOL(SbSocketReceiveFrom); - REGISTER_SYMBOL(SbSocketSetReuseAddress); REGISTER_SYMBOL(SbSocketWaiterAdd); REGISTER_SYMBOL(SbSocketWaiterCreate); REGISTER_SYMBOL(SbSocketWaiterDestroy); diff --git a/starboard/linux/shared/BUILD.gn b/starboard/linux/shared/BUILD.gn index 8269277cf3b3..0fcbfe094e2c 100644 --- a/starboard/linux/shared/BUILD.gn +++ b/starboard/linux/shared/BUILD.gn @@ -156,17 +156,12 @@ static_library("starboard_platform_sources") { "//starboard/shared/posix/memory_mapped_file.h", "//starboard/shared/posix/page_internal.cc", "//starboard/shared/posix/set_non_blocking_internal.cc", - "//starboard/shared/posix/socket_accept.cc", - "//starboard/shared/posix/socket_bind.cc", "//starboard/shared/posix/socket_connect.cc", "//starboard/shared/posix/socket_create.cc", "//starboard/shared/posix/socket_destroy.cc", "//starboard/shared/posix/socket_get_local_address.cc", "//starboard/shared/posix/socket_internal.cc", "//starboard/shared/posix/socket_is_ipv6_supported.cc", - "//starboard/shared/posix/socket_listen.cc", - "//starboard/shared/posix/socket_receive_from.cc", - "//starboard/shared/posix/socket_set_reuse_address.cc", "//starboard/shared/posix/storage_write_record.cc", "//starboard/shared/posix/system_break_into_debugger.cc", "//starboard/shared/posix/system_clear_last_error.cc", diff --git a/starboard/raspi/shared/BUILD.gn b/starboard/raspi/shared/BUILD.gn index 4c42b771123a..c04dd20925e2 100644 --- a/starboard/raspi/shared/BUILD.gn +++ b/starboard/raspi/shared/BUILD.gn @@ -114,17 +114,12 @@ static_library("starboard_platform_sources") { "//starboard/shared/posix/memory_free_aligned.cc", "//starboard/shared/posix/page_internal.cc", "//starboard/shared/posix/set_non_blocking_internal.cc", - "//starboard/shared/posix/socket_accept.cc", - "//starboard/shared/posix/socket_bind.cc", "//starboard/shared/posix/socket_connect.cc", "//starboard/shared/posix/socket_create.cc", "//starboard/shared/posix/socket_destroy.cc", "//starboard/shared/posix/socket_get_local_address.cc", "//starboard/shared/posix/socket_internal.cc", "//starboard/shared/posix/socket_is_ipv6_supported.cc", - "//starboard/shared/posix/socket_listen.cc", - "//starboard/shared/posix/socket_receive_from.cc", - "//starboard/shared/posix/socket_set_reuse_address.cc", "//starboard/shared/posix/storage_write_record.cc", "//starboard/shared/posix/system_break_into_debugger.cc", "//starboard/shared/posix/system_clear_last_error.cc", diff --git a/starboard/shared/posix/socket_accept.cc b/starboard/shared/posix/socket_accept.cc deleted file mode 100644 index 685af660c044..000000000000 --- a/starboard/shared/posix/socket_accept.cc +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2015 The Cobalt Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "starboard/common/socket.h" - -#include -#include -#include -#include - -#include "starboard/common/log.h" -#include "starboard/shared/posix/handle_eintr.h" -#include "starboard/shared/posix/set_non_blocking_internal.h" -#include "starboard/shared/posix/socket_internal.h" - -namespace sbposix = starboard::shared::posix; - -SbSocket SbSocketAccept(SbSocket socket) { - if (!SbSocketIsValid(socket)) { - errno = EBADF; - return kSbSocketInvalid; - } - - SB_DCHECK(socket->socket_fd >= 0); - - int socket_fd = HANDLE_EINTR(accept(socket->socket_fd, NULL, NULL)); - if (socket_fd < 0) { - socket->error = sbposix::TranslateSocketErrno(errno); - return kSbSocketInvalid; - } - - // All Starboard sockets are non-blocking, so let's ensure it. - if (!sbposix::SetNonBlocking(socket_fd)) { - // Something went wrong, we'll clean up and return failure. - socket->error = sbposix::TranslateSocketErrno(errno); - HANDLE_EINTR(close(socket_fd)); - return kSbSocketInvalid; - } - - socket->error = kSbSocketOk; - - // Adopt the newly accepted socket. - return new SbSocketPrivate(socket->address_type, socket->protocol, socket_fd); -} diff --git a/starboard/shared/posix/socket_bind.cc b/starboard/shared/posix/socket_bind.cc deleted file mode 100644 index 01fbe9ea3ddf..000000000000 --- a/starboard/shared/posix/socket_bind.cc +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2015 The Cobalt Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "starboard/common/socket.h" - -#include -#include -#include - -#include "starboard/common/log.h" -#include "starboard/common/memory.h" -#include "starboard/shared/posix/handle_eintr.h" -#include "starboard/shared/posix/socket_internal.h" - -namespace sbposix = starboard::shared::posix; - -SbSocketError SbSocketBind(SbSocket socket, - const SbSocketAddress* local_address) { - if (!SbSocketIsValid(socket)) { - errno = EBADF; - SB_LOG(ERROR) << __FUNCTION__ << ": Invalid socket"; - return kSbSocketErrorFailed; - } - - sbposix::SockAddr sock_addr; - if (!sock_addr.FromSbSocketAddress(local_address)) { - SB_LOG(ERROR) << __FUNCTION__ << ": Invalid address"; - return (socket->error = sbposix::TranslateSocketErrno(EINVAL)); - } - - SB_DCHECK(socket->socket_fd >= 0); - if (local_address->type != socket->address_type) { - SB_LOG(ERROR) << __FUNCTION__ << ": Incompatible addresses: " - << "socket type = " << socket->address_type - << ", argument type = " << local_address->type; - return (socket->error = sbposix::TranslateSocketErrno(EAFNOSUPPORT)); - } - - // When binding to the IPV6 any address, ensure that the IPV6_V6ONLY flag is - // off to allow incoming IPV4 connections on the same socket. - // See https://www.ietf.org/rfc/rfc3493.txt for details. - if (local_address && (local_address->type == kSbSocketAddressTypeIpv6) && - starboard::common::MemoryIsZero(local_address->address, 16)) { - if (!sbposix::SetBooleanSocketOption(socket, IPPROTO_IPV6, IPV6_V6ONLY, - "IPV6_V6ONLY", false)) { - // Silently ignore errors, assume the default behavior is as expected. - socket->error = kSbSocketOk; - } - } - - int result = HANDLE_EINTR( - bind(socket->socket_fd, sock_addr.sockaddr(), sock_addr.length)); - if (result != 0) { - SB_LOG(ERROR) << __FUNCTION__ << ": Bind failed. errno=" << errno; - return (socket->error = sbposix::TranslateSocketErrno(errno)); - } - - return (socket->error = kSbSocketOk); -} diff --git a/starboard/shared/posix/socket_listen.cc b/starboard/shared/posix/socket_listen.cc deleted file mode 100644 index d1b5d3c86654..000000000000 --- a/starboard/shared/posix/socket_listen.cc +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2015 The Cobalt Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "starboard/common/socket.h" - -#include -#include -#include - -#include "starboard/common/log.h" -#include "starboard/shared/posix/socket_internal.h" - -namespace sbposix = starboard::shared::posix; - -SbSocketError SbSocketListen(SbSocket socket) { - if (!SbSocketIsValid(socket)) { - errno = EBADF; - return kSbSocketErrorFailed; - } - - SB_DCHECK(socket->socket_fd >= 0); - // We set the backlog to SOMAXCONN to ensure that it is above 1, and high - // enough that all tests are able to pass. Some tests will fail if backlog==1 - // because they expect to be able to successfully initiate multiple connects - // at once, and then after all connects have been initiated to subsequently - // initiate corresponding accepts. -#if defined(SOMAXCONN) - const int kMaxConn = SOMAXCONN; -#else - // Some posix platforms such as FreeBSD do not define SOMAXCONN. - // In this case, set the value to an arbitrary number large enough to - // satisfy most use-cases and tests, empirically we have found that 128 - // is sufficient. All implementations of listen() specify that a backlog - // parameter larger than the system max will be silently truncated to the - // system's max. - const int kMaxConn = 128; -#endif - int result = listen(socket->socket_fd, kMaxConn); - if (result != 0) { - return (socket->error = sbposix::TranslateSocketErrno(errno)); - } - - return (socket->error = kSbSocketOk); -} diff --git a/starboard/shared/posix/socket_receive_from.cc b/starboard/shared/posix/socket_receive_from.cc deleted file mode 100644 index 8c0b779b8f8e..000000000000 --- a/starboard/shared/posix/socket_receive_from.cc +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright 2015 The Cobalt Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "starboard/common/socket.h" - -#include -#include - -#include "starboard/common/log.h" -#include "starboard/shared/posix/handle_eintr.h" -#include "starboard/shared/posix/socket_internal.h" - -namespace sbposix = starboard::shared::posix; - -namespace { - -bool IsReportableErrno(int code) { - return (code != EAGAIN && code != EWOULDBLOCK && code != ECONNRESET); -} - -} // namespace - -int SbSocketReceiveFrom(SbSocket socket, - char* out_data, - int data_size, - SbSocketAddress* out_source) { - const int kRecvFlags = 0; - - if (!SbSocketIsValid(socket)) { - errno = EBADF; - return -1; - } - - SB_DCHECK(socket->socket_fd >= 0); - if (socket->protocol == kSbSocketProtocolTcp) { - if (out_source) { - sbposix::SockAddr sock_addr; - int result = getpeername(socket->socket_fd, sock_addr.sockaddr(), - &sock_addr.length); - if (result < 0) { - SB_LOG(ERROR) << __FUNCTION__ - << ": getpeername failed, errno = " << errno; - socket->error = sbposix::TranslateSocketErrno(errno); - return -1; - } - - if (!sock_addr.ToSbSocketAddress(out_source)) { - SB_LOG(FATAL) << __FUNCTION__ << ": Bad TCP source address."; - socket->error = kSbSocketErrorFailed; - return -1; - } - } - - ssize_t bytes_read = - recv(socket->socket_fd, out_data, data_size, kRecvFlags); - if (bytes_read >= 0) { - socket->error = kSbSocketOk; - return static_cast(bytes_read); - } - - if (IsReportableErrno(errno) && - socket->error != sbposix::TranslateSocketErrno(errno)) { - SB_LOG(ERROR) << "recv failed, errno = " << errno; - } - socket->error = sbposix::TranslateSocketErrno(errno); - return -1; - } else if (socket->protocol == kSbSocketProtocolUdp) { - sbposix::SockAddr sock_addr; - ssize_t bytes_read = - recvfrom(socket->socket_fd, out_data, data_size, kRecvFlags, - sock_addr.sockaddr(), &sock_addr.length); - - if (bytes_read >= 0) { - if (out_source) { - if (!sock_addr.ToSbSocketAddress(out_source)) { - SB_LOG(FATAL) << __FUNCTION__ << ": Bad UDP source address."; - socket->error = kSbSocketErrorFailed; - return -1; - } - } - - socket->error = kSbSocketOk; - return static_cast(bytes_read); - } - - if (errno != EAGAIN && errno != EWOULDBLOCK && - socket->error != sbposix::TranslateSocketErrno(errno)) { - SB_LOG(ERROR) << "recvfrom failed, errno = " << errno; - } - socket->error = sbposix::TranslateSocketErrno(errno); - return -1; - } - - SB_NOTREACHED() << "Unrecognized protocol: " << socket->protocol; - errno = EPROTONOSUPPORT; - return -1; -} diff --git a/starboard/shared/posix/socket_set_reuse_address.cc b/starboard/shared/posix/socket_set_reuse_address.cc deleted file mode 100644 index d142d46eee0a..000000000000 --- a/starboard/shared/posix/socket_set_reuse_address.cc +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015 The Cobalt Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "starboard/common/socket.h" - -#include - -#include "starboard/shared/posix/socket_internal.h" - -namespace sbposix = starboard::shared::posix; - -bool SbSocketSetReuseAddress(SbSocket socket, bool value) { - return sbposix::SetBooleanSocketOption(socket, SOL_SOCKET, SO_REUSEADDR, - "SO_REUSEADDR", value); -} diff --git a/starboard/shared/stub/socket_accept.cc b/starboard/shared/stub/socket_accept.cc deleted file mode 100644 index b03587f8f05a..000000000000 --- a/starboard/shared/stub/socket_accept.cc +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2016 The Cobalt Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "starboard/common/socket.h" - -SbSocket SbSocketAccept(SbSocket socket) { - return kSbSocketInvalid; -} diff --git a/starboard/shared/stub/socket_bind.cc b/starboard/shared/stub/socket_bind.cc deleted file mode 100644 index 69702d6804ed..000000000000 --- a/starboard/shared/stub/socket_bind.cc +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 The Cobalt Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "starboard/common/socket.h" - -SbSocketError SbSocketBind(SbSocket socket, - const SbSocketAddress* local_address) { - return kSbSocketErrorFailed; -} diff --git a/starboard/shared/stub/socket_listen.cc b/starboard/shared/stub/socket_listen.cc deleted file mode 100644 index b4b29d43e0c6..000000000000 --- a/starboard/shared/stub/socket_listen.cc +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2016 The Cobalt Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "starboard/common/socket.h" - -SbSocketError SbSocketListen(SbSocket socket) { - return kSbSocketErrorFailed; -} diff --git a/starboard/shared/stub/socket_receive_from.cc b/starboard/shared/stub/socket_receive_from.cc deleted file mode 100644 index b8d407dc1f30..000000000000 --- a/starboard/shared/stub/socket_receive_from.cc +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2016 The Cobalt Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "starboard/common/socket.h" - -int SbSocketReceiveFrom(SbSocket socket, - char* out_data, - int data_size, - SbSocketAddress* out_source) { - return -1; -} diff --git a/starboard/shared/stub/socket_set_reuse_address.cc b/starboard/shared/stub/socket_set_reuse_address.cc deleted file mode 100644 index aa1344911a74..000000000000 --- a/starboard/shared/stub/socket_set_reuse_address.cc +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2016 The Cobalt Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "starboard/common/socket.h" - -bool SbSocketSetReuseAddress(SbSocket socket, bool value) { - return false; -} diff --git a/starboard/socket.h b/starboard/socket.h index 0cb8e781905f..2e328e57ee28 100644 --- a/starboard/socket.h +++ b/starboard/socket.h @@ -172,41 +172,6 @@ SB_EXPORT bool SbSocketDestroy(SbSocket socket); SB_EXPORT SbSocketError SbSocketConnect(SbSocket socket, const SbSocketAddress* address); -// DEPRECATED with SB_API_VERSION 16 -// -// Binds |socket| to a specific local interface and port specified by -// |local_address|. This function sets and returns the socket error if it -// is unable to bind to |local_address|. -// -// |socket|: The SbSocket to be bound to the local interface. -// |local_address|: The local address to which the socket is to be bound. -// This value must not be |NULL|. -// - Setting the local address to port |0| (or not specifying a port) indicates -// that the function should choose a port for you. -// - Setting the IP address to |0.0.0.0| means that the socket should be bound -// to all interfaces. -SB_EXPORT SbSocketError SbSocketBind(SbSocket socket, - const SbSocketAddress* local_address); - -// DEPRECATED with SB_API_VERSION 16 -// -// Causes |socket| to listen on the local address that |socket| was previously -// bound to by SbSocketBind. This function sets and returns the socket error if -// it is unable to listen for some reason. (It returns |kSbSocketOk| if it -// creates the connection successfully.) -// -// |socket|: The SbSocket on which the function operates. -SB_EXPORT SbSocketError SbSocketListen(SbSocket socket); - -// DEPRECATED with SB_API_VERSION 16 -// -// Accepts a pending connection on |socket| and returns a new SbSocket -// representing that connection. This function sets the error on |socket| -// and returns |kSbSocketInvalid| if it is unable to accept a new connection. -// -// |socket|: The SbSocket that is accepting a pending connection. -SB_EXPORT SbSocket SbSocketAccept(SbSocket socket); - // DEPRECATED with SB_API_VERSION 16 // // Gets the address that this socket is bound to locally, if the socket is @@ -258,45 +223,6 @@ SB_EXPORT bool SbSocketGetInterfaceAddress( SbSocketAddress* out_source_address, SbSocketAddress* out_netmask); -// DEPRECATED with SB_API_VERSION 16 -// -// Reads up to |data_size| bytes from |socket| into |out_data| and places the -// source address of the packet in |out_source| if out_source is not NULL. -// Returns the number of bytes read, or a negative number if there is an error, -// in which case SbSocketGetLastError can provide the precise error encountered. -// -// Note that this function is NOT specified to make a best effort to read all -// data on all platforms, but it MAY still do so. It is specified to read -// however many bytes are available conveniently, meaning that it should avoid -// blocking until there is data. It can be run in a loop until -// SbSocketGetLastError returns |kSbSocketPending| to make it a best-effort -// read (but still only up to not blocking, unless you want to spin). -// -// The primary use of |out_source| is to receive datagram packets from -// multiple sources on a UDP server socket. TCP has two endpoints connected -// persistently, so the address is unnecessary, but allowed. -// -// |socket|: The SbSocket from which data is read. -// |out_data|: The data read from the socket. Must not be NULL. -// |data_size|: The number of bytes to read. -// |out_source|: The source address of the packet. -SB_EXPORT int SbSocketReceiveFrom(SbSocket socket, - char* out_data, - int data_size, - SbSocketAddress* out_source); - -// DEPRECATED with SB_API_VERSION 16 -// -// Sets the |SO_REUSEADDR|, or equivalent, option to |value| on |socket|. -// The return value indicates whether the option was actually set. -// -// This option allows a bound address to be reused if a socket isn't actively -// bound to it. -// -// |socket|: The SbSocket for which the option is set. -// |value|: The new value for the option. -SB_EXPORT bool SbSocketSetReuseAddress(SbSocket socket, bool value); - #ifdef __cplusplus } // extern "C" #endif diff --git a/starboard/stub/BUILD.gn b/starboard/stub/BUILD.gn index f012831ac95e..ccfb3c86b5b2 100644 --- a/starboard/stub/BUILD.gn +++ b/starboard/stub/BUILD.gn @@ -101,17 +101,12 @@ static_library("stub_sources") { "//starboard/shared/stub/player_set_volume.cc", "//starboard/shared/stub/player_write_end_of_stream.cc", "//starboard/shared/stub/player_write_samples.cc", - "//starboard/shared/stub/socket_accept.cc", - "//starboard/shared/stub/socket_bind.cc", "//starboard/shared/stub/socket_connect.cc", "//starboard/shared/stub/socket_create.cc", "//starboard/shared/stub/socket_destroy.cc", "//starboard/shared/stub/socket_get_interface_address.cc", "//starboard/shared/stub/socket_get_local_address.cc", "//starboard/shared/stub/socket_is_ipv6_supported.cc", - "//starboard/shared/stub/socket_listen.cc", - "//starboard/shared/stub/socket_receive_from.cc", - "//starboard/shared/stub/socket_set_reuse_address.cc", "//starboard/shared/stub/socket_waiter_add.cc", "//starboard/shared/stub/socket_waiter_create.cc", "//starboard/shared/stub/socket_waiter_destroy.cc",