#include "services/network/tcp_bound_socket.h"
#include <optional>
#include <utility>
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/notreached.h"
#include "base/numerics/safe_conversions.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
#include "net/log/net_log.h"
#include "net/socket/tcp_client_socket.h"
#include "net/socket/tcp_server_socket.h"
#include "net/socket/tcp_socket.h"
#include "services/network/socket_factory.h"
#include "services/network/tcp_connected_socket.h"
namespace network {
TCPBoundSocket::TCPBoundSocket(
SocketFactory* socket_factory,
net::NetLog* net_log,
const net::NetworkTrafficAnnotationTag& traffic_annotation)
: … { … }
TCPBoundSocket::~TCPBoundSocket() = default;
int TCPBoundSocket::Bind(const net::IPEndPoint& local_addr,
net::IPEndPoint* local_addr_out) { … }
void TCPBoundSocket::Listen(
uint32_t backlog,
mojo::PendingReceiver<mojom::TCPServerSocket> receiver,
ListenCallback callback) { … }
void TCPBoundSocket::Connect(
const net::AddressList& remote_addr_list,
mojom::TCPConnectedSocketOptionsPtr tcp_connected_socket_options,
mojo::PendingReceiver<mojom::TCPConnectedSocket> receiver,
mojo::PendingRemote<mojom::SocketObserver> observer,
ConnectCallback callback) { … }
void TCPBoundSocket::OnConnectComplete(
int result,
const std::optional<net::IPEndPoint>& local_addr,
const std::optional<net::IPEndPoint>& peer_addr,
mojo::ScopedDataPipeConsumerHandle receive_stream,
mojo::ScopedDataPipeProducerHandle send_stream) { … }
int TCPBoundSocket::ListenInternal(int backlog) { … }
}