9#ifndef LLDB_HOST_SOCKET_H
10#define LLDB_HOST_SOCKET_H
71 bool child_processes_inherit,
81 static llvm::Expected<std::unique_ptr<TCPSocket>>
82 TcpListen(llvm::StringRef host_and_port,
bool child_processes_inherit,
85 static llvm::Expected<std::unique_ptr<Socket>>
86 TcpConnect(llvm::StringRef host_and_port,
bool child_processes_inherit);
88 static llvm::Expected<std::unique_ptr<UDPSocket>>
89 UdpConnect(llvm::StringRef host_and_port,
bool child_processes_inherit);
91 int GetOption(
int level,
int option_name,
int &option_value);
92 int SetOption(
int level,
int option_name,
int option_value);
97 Status Read(
void *buf,
size_t &num_bytes)
override;
98 Status Write(
const void *buf,
size_t &num_bytes)
override;
105 static llvm::Expected<HostAndPort>
113 bool m_child_process_inherit);
115 virtual size_t Send(
const void *buf,
const size_t num_bytes);
static llvm::raw_ostream & error(Stream &strm)
virtual Status Listen(llvm::StringRef name, int backlog)=0
Status Read(void *buf, size_t &num_bytes) override
NativeSocket GetNativeSocket() const
static llvm::Expected< std::unique_ptr< UDPSocket > > UdpConnect(llvm::StringRef host_and_port, bool child_processes_inherit)
virtual Status Connect(llvm::StringRef name)=0
static const NativeSocket kInvalidSocketValue
WaitableHandle GetWaitableHandle() override
virtual std::string GetRemoteConnectionURI() const
static NativeSocket CreateSocket(const int domain, const int type, const int protocol, bool child_processes_inherit, Status &error)
SocketProtocol m_protocol
virtual size_t Send(const void *buf, const size_t num_bytes)
int SetOption(int level, int option_name, int option_value)
bool m_child_processes_inherit
static llvm::Expected< HostAndPort > DecodeHostAndPort(llvm::StringRef host_and_port)
int GetOption(int level, int option_name, int &option_value)
SocketProtocol GetSocketProtocol() const
static bool FindProtocolByScheme(const char *scheme, SocketProtocol &protocol)
static NativeSocket AcceptSocket(NativeSocket sockfd, struct sockaddr *addr, socklen_t *addrlen, bool child_processes_inherit, Status &error)
bool IsValid() const override
static void SetLastError(Status &error)
static llvm::Error Initialize()
static const char * FindSchemeByProtocol(const SocketProtocol protocol)
static llvm::Expected< std::unique_ptr< Socket > > TcpConnect(llvm::StringRef host_and_port, bool child_processes_inherit)
Status Write(const void *buf, size_t &num_bytes) override
virtual Status Accept(Socket *&socket)=0
static std::unique_ptr< Socket > Create(const SocketProtocol protocol, bool child_processes_inherit, Status &error)
static llvm::Expected< std::unique_ptr< TCPSocket > > TcpListen(llvm::StringRef host_and_port, bool child_processes_inherit, int backlog=5)
A class that represents a running process on the host machine.
Stream & operator<<(Stream &s, const Mangled &obj)
bool operator==(const HostAndPort &R) const