9#ifndef LLDB_HOST_SOCKET_H
10#define LLDB_HOST_SOCKET_H
106 virtual llvm::Expected<std::vector<MainLoopBase::ReadHandleUP>>
108 std::function<
void(std::unique_ptr<Socket> socket)> sock_cb) = 0;
117 static llvm::Expected<std::unique_ptr<TCPSocket>>
118 TcpListen(llvm::StringRef host_and_port,
int backlog = 5);
120 static llvm::Expected<std::unique_ptr<Socket>>
123 static llvm::Expected<std::unique_ptr<UDPSocket>>
128 int GetOption(
int level,
int option_name,
int &option_value) {
134 int SetOption(
int level,
int option_name,
int option_value) {
141 Status Read(
void *buf,
size_t &num_bytes)
override;
142 Status Write(
const void *buf,
size_t &num_bytes)
override;
149 static llvm::Expected<HostAndPort>
163 virtual size_t Send(
const void *buf,
const size_t num_bytes);
static llvm::raw_ostream & error(Stream &strm)
A posix-based implementation of Pipe, a class that abtracts unix style pipes.
static const shared_fd_t kInvalidFD
Status CompleteSending(lldb::pid_t child_pid)
shared_fd_t GetSendableFD()
static Status GetNativeSocket(shared_fd_t fd, NativeSocket &socket)
virtual Status Listen(llvm::StringRef name, int backlog)=0
static std::unique_ptr< Socket > Create(const SocketProtocol protocol, Status &error)
Status Read(void *buf, size_t &num_bytes) override
NativeSocket GetNativeSocket() const
virtual Status Connect(llvm::StringRef name)=0
static const NativeSocket kInvalidSocketValue
WaitableHandle GetWaitableHandle() override
virtual std::string GetRemoteConnectionURI() const
SocketProtocol m_protocol
virtual size_t Send(const void *buf, const size_t num_bytes)
static llvm::Expected< std::unique_ptr< UDPSocket > > UdpConnect(llvm::StringRef host_and_port)
virtual llvm::Expected< std::vector< MainLoopBase::ReadHandleUP > > Accept(MainLoopBase &loop, std::function< void(std::unique_ptr< Socket > socket)> sock_cb)=0
static NativeSocket CreateSocket(const int domain, const int type, const int protocol, Status &error)
static int GetOption(NativeSocket sockfd, int level, int option_name, int &option_value)
static llvm::Expected< HostAndPort > DecodeHostAndPort(llvm::StringRef host_and_port)
int GetOption(int level, int option_name, int &option_value)
static NativeSocket AcceptSocket(NativeSocket sockfd, struct sockaddr *addr, socklen_t *addrlen, Status &error)
virtual std::vector< std::string > GetListeningConnectionURI() const
SocketProtocol GetSocketProtocol() const
static bool FindProtocolByScheme(const char *scheme, SocketProtocol &protocol)
bool IsValid() const override
static Status GetLastError()
static llvm::Expected< std::unique_ptr< Socket > > TcpConnect(llvm::StringRef host_and_port)
static void SetLastError(Status &error)
static llvm::Error Initialize()
static int CloseSocket(NativeSocket sockfd)
static const char * FindSchemeByProtocol(const SocketProtocol protocol)
static int SetOption(NativeSocket sockfd, int level, int option_name, int option_value)
Status Write(const void *buf, size_t &num_bytes) override
static llvm::Expected< std::unique_ptr< TCPSocket > > TcpListen(llvm::StringRef host_and_port, int backlog=5)
int SetOption(int level, int option_name, int option_value)
A class that represents a running process on the host machine.
Stream & operator<<(Stream &s, const Mangled &obj)
bool operator==(const HostAndPort &R) const