llvm/lldb/source/Host/common/Socket.cpp

//===-- Socket.cpp --------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "lldb/Host/Socket.h"

#include "lldb/Host/Config.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/SocketAddress.h"
#include "lldb/Host/common/TCPSocket.h"
#include "lldb/Host/common/UDPSocket.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"

#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Errno.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/Regex.h"
#include "llvm/Support/WindowsError.h"

#if LLDB_ENABLE_POSIX
#include "lldb/Host/posix/DomainSocket.h"

#include <arpa/inet.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#endif

#ifdef __linux__
#include "lldb/Host/linux/AbstractSocket.h"
#endif

#ifdef __ANDROID__
#include <arpa/inet.h>
#include <asm-generic/errno-base.h>
#include <cerrno>
#include <fcntl.h>
#include <linux/tcp.h>
#include <sys/syscall.h>
#include <unistd.h>
#endif // __ANDROID__

usingnamespacelldb;
usingnamespacelldb_private;

#if defined(_WIN32)
typedef const char *set_socket_option_arg_type;
typedef char *get_socket_option_arg_type;
const NativeSocket Socket::kInvalidSocketValue = INVALID_SOCKET;
const shared_fd_t SharedSocket::kInvalidFD = LLDB_INVALID_PIPE;
#else  // #if defined(_WIN32)
set_socket_option_arg_type;
get_socket_option_arg_type;
const NativeSocket Socket::kInvalidSocketValue =;
const shared_fd_t SharedSocket::kInvalidFD =;
#endif // #if defined(_WIN32)

static bool IsInterrupted() {}

SharedSocket::SharedSocket(const Socket *socket, Status &error) {}

Status SharedSocket::CompleteSending(lldb::pid_t child_pid) {}

Status SharedSocket::GetNativeSocket(shared_fd_t fd, NativeSocket &socket) {}

struct SocketScheme {};

static SocketScheme socket_schemes[] =;

const char *
Socket::FindSchemeByProtocol(const Socket::SocketProtocol protocol) {}

bool Socket::FindProtocolByScheme(const char *scheme,
                                  Socket::SocketProtocol &protocol) {}

Socket::Socket(SocketProtocol protocol, bool should_close,
               bool child_processes_inherit)
    :{}

Socket::~Socket() {}

llvm::Error Socket::Initialize() {}

void Socket::Terminate() {}

std::unique_ptr<Socket> Socket::Create(const SocketProtocol protocol,
                                       bool child_processes_inherit,
                                       Status &error) {}

llvm::Expected<std::unique_ptr<Socket>>
Socket::TcpConnect(llvm::StringRef host_and_port,
                   bool child_processes_inherit) {}

llvm::Expected<std::unique_ptr<TCPSocket>>
Socket::TcpListen(llvm::StringRef host_and_port, bool child_processes_inherit,
                  int backlog) {}

llvm::Expected<std::unique_ptr<UDPSocket>>
Socket::UdpConnect(llvm::StringRef host_and_port,
                   bool child_processes_inherit) {}

llvm::Expected<Socket::HostAndPort> Socket::DecodeHostAndPort(llvm::StringRef host_and_port) {}

IOObject::WaitableHandle Socket::GetWaitableHandle() {}

Status Socket::Read(void *buf, size_t &num_bytes) {}

Status Socket::Write(const void *buf, size_t &num_bytes) {}

Status Socket::Close() {}

int Socket::GetOption(int level, int option_name, int &option_value) {}

int Socket::SetOption(int level, int option_name, int option_value) {}

size_t Socket::Send(const void *buf, const size_t num_bytes) {}

void Socket::SetLastError(Status &error) {}

NativeSocket Socket::CreateSocket(const int domain, const int type,
                                  const int protocol,
                                  bool child_processes_inherit, Status &error) {}

NativeSocket Socket::AcceptSocket(NativeSocket sockfd, struct sockaddr *addr,
                                  socklen_t *addrlen,
                                  bool child_processes_inherit, Status &error) {}

llvm::raw_ostream &lldb_private::operator<<(llvm::raw_ostream &OS,
                                            const Socket::HostAndPort &HP) {}