LLDB  mainline
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
lldb_private::Socket Class Referenceabstract

#include <Socket.h>

Inheritance diagram for lldb_private::Socket:
Inheritance graph
[legend]
Collaboration diagram for lldb_private::Socket:
Collaboration graph
[legend]

Public Types

enum  SocketProtocol { ProtocolTcp, ProtocolUdp, ProtocolUnixDomain, ProtocolUnixAbstract }
 
- Public Types inherited from lldb_private::IOObject
enum  FDType { eFDTypeFile, eFDTypeSocket }
 
typedef int WaitableHandle
 

Public Member Functions

 ~Socket () override
 
virtual Status Connect (llvm::StringRef name)=0
 
virtual Status Listen (llvm::StringRef name, int backlog)=0
 
virtual Status Accept (Socket *&socket)=0
 
int GetOption (int level, int option_name, int &option_value)
 
int SetOption (int level, int option_name, int option_value)
 
NativeSocket GetNativeSocket () const
 
SocketProtocol GetSocketProtocol () const
 
Status Read (void *buf, size_t &num_bytes) override
 
Status Write (const void *buf, size_t &num_bytes) override
 
virtual Status PreDisconnect ()
 
Status Close () override
 
bool IsValid () const override
 
WaitableHandle GetWaitableHandle () override
 
virtual std::string GetRemoteConnectionURI () const
 
- Public Member Functions inherited from lldb_private::IOObject
 IOObject (FDType type)
 
virtual ~IOObject ()
 
FDType GetFdType () const
 

Static Public Member Functions

static llvm::Error Initialize ()
 
static void Terminate ()
 
static std::unique_ptr< SocketCreate (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, Predicate< uint16_t > *predicate, int backlog=5)
 
static llvm::Expected< std::unique_ptr< Socket > > TcpConnect (llvm::StringRef host_and_port, bool child_processes_inherit)
 
static llvm::Expected< std::unique_ptr< UDPSocket > > UdpConnect (llvm::StringRef host_and_port, bool child_processes_inherit)
 
static Status UnixDomainConnect (llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&socket)
 
static Status UnixDomainAccept (llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&socket)
 
static Status UnixAbstractConnect (llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&socket)
 
static Status UnixAbstractAccept (llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&socket)
 
static bool DecodeHostAndPort (llvm::StringRef host_and_port, std::string &host_str, std::string &port_str, int32_t &port, Status *error_ptr)
 

Static Public Attributes

static const NativeSocket kInvalidSocketValue = -1
 
- Static Public Attributes inherited from lldb_private::IOObject
static const WaitableHandle kInvalidHandleValue = -1
 

Protected Member Functions

 Socket (SocketProtocol protocol, bool should_close, bool m_child_process_inherit)
 
virtual size_t Send (const void *buf, const size_t num_bytes)
 

Static Protected Member Functions

static void SetLastError (Status &error)
 
static NativeSocket CreateSocket (const int domain, const int type, const int protocol, bool child_processes_inherit, Status &error)
 
static NativeSocket AcceptSocket (NativeSocket sockfd, struct sockaddr *addr, socklen_t *addrlen, bool child_processes_inherit, Status &error)
 

Protected Attributes

SocketProtocol m_protocol
 
NativeSocket m_socket
 
bool m_child_processes_inherit
 
bool m_should_close_fd
 
- Protected Attributes inherited from lldb_private::IOObject
FDType m_fd_type
 

Detailed Description

Definition at line 42 of file Socket.h.

Member Enumeration Documentation

◆ SocketProtocol

Enumerator
ProtocolTcp 
ProtocolUdp 
ProtocolUnixDomain 
ProtocolUnixAbstract 

Definition at line 44 of file Socket.h.

Constructor & Destructor Documentation

◆ ~Socket()

Socket::~Socket ( )
override

Definition at line 82 of file Socket.cpp.

References Close().

◆ Socket()

Socket::Socket ( SocketProtocol  protocol,
bool  should_close,
bool  m_child_process_inherit 
)
protected

Definition at line 75 of file Socket.cpp.

Member Function Documentation

◆ Accept()

virtual Status lldb_private::Socket::Accept ( Socket *&  socket)
pure virtual

◆ AcceptSocket()

static NativeSocket lldb_private::Socket::AcceptSocket ( NativeSocket  sockfd,
struct sockaddr *  addr,
socklen_t *  addrlen,
bool  child_processes_inherit,
Status error 
)
staticprotected

◆ Close()

Status lldb_private::Socket::Close ( )
overridevirtual

◆ Connect()

virtual Status lldb_private::Socket::Connect ( llvm::StringRef  name)
pure virtual

◆ Create()

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

◆ CreateSocket()

static NativeSocket lldb_private::Socket::CreateSocket ( const int  domain,
const int  type,
const int  protocol,
bool  child_processes_inherit,
Status error 
)
staticprotected

◆ DecodeHostAndPort()

bool Socket::DecodeHostAndPort ( llvm::StringRef  host_and_port,
std::string host_str,
std::string port_str,
int32_t &  port,
Status error_ptr 
)
static

◆ GetNativeSocket()

NativeSocket lldb_private::Socket::GetNativeSocket ( ) const
inline

◆ GetOption()

int lldb_private::Socket::GetOption ( int  level,
int  option_name,
int &  option_value 
)

◆ GetRemoteConnectionURI()

virtual std::string lldb_private::Socket::GetRemoteConnectionURI ( ) const
inlinevirtual

◆ GetSocketProtocol()

SocketProtocol lldb_private::Socket::GetSocketProtocol ( ) const
inline

Definition at line 95 of file Socket.h.

References m_protocol.

◆ GetWaitableHandle()

WaitableHandle lldb_private::Socket::GetWaitableHandle ( )
overridevirtual

◆ Initialize()

llvm::Error Socket::Initialize ( )
static

Definition at line 84 of file Socket.cpp.

Referenced by lldb_private::SystemInitializerCommon::Initialize().

◆ IsValid()

bool lldb_private::Socket::IsValid ( ) const
inlineoverridevirtual

Implements lldb_private::IOObject.

Definition at line 103 of file Socket.h.

References kInvalidSocketValue, and m_socket.

◆ Listen()

virtual Status lldb_private::Socket::Listen ( llvm::StringRef  name,
int  backlog 
)
pure virtual

◆ PreDisconnect()

virtual Status lldb_private::Socket::PreDisconnect ( )
virtual

◆ Read()

Status lldb_private::Socket::Read ( void *  buf,
size_t &  num_bytes 
)
overridevirtual

◆ Send()

virtual size_t lldb_private::Socket::Send ( const void *  buf,
const size_t  num_bytes 
)
protectedvirtual

Reimplemented in lldb_private::UDPSocket.

◆ SetLastError()

static void lldb_private::Socket::SetLastError ( Status error)
staticprotected

◆ SetOption()

int lldb_private::Socket::SetOption ( int  level,
int  option_name,
int  option_value 
)

◆ TcpConnect()

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

◆ TcpListen()

llvm::Expected< std::unique_ptr< TCPSocket > > Socket::TcpListen ( llvm::StringRef  host_and_port,
bool  child_processes_inherit,
Predicate< uint16_t > *  predicate,
int  backlog = 5 
)
static

◆ Terminate()

void Socket::Terminate ( )
static

Definition at line 103 of file Socket.cpp.

Referenced by lldb_private::SystemInitializerCommon::Terminate().

◆ UdpConnect()

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

◆ UnixAbstractAccept()

Status Socket::UnixAbstractAccept ( llvm::StringRef  host_and_port,
bool  child_processes_inherit,
Socket *&  socket 
)
static

Definition at line 258 of file Socket.cpp.

References Create(), error(), and ProtocolUnixAbstract.

◆ UnixAbstractConnect()

Status Socket::UnixAbstractConnect ( llvm::StringRef  host_and_port,
bool  child_processes_inherit,
Socket *&  socket 
)
static

◆ UnixDomainAccept()

Status Socket::UnixDomainAccept ( llvm::StringRef  host_and_port,
bool  child_processes_inherit,
Socket *&  socket 
)
static

◆ UnixDomainConnect()

Status Socket::UnixDomainConnect ( llvm::StringRef  host_and_port,
bool  child_processes_inherit,
Socket *&  socket 
)
static

◆ Write()

Status lldb_private::Socket::Write ( const void *  buf,
size_t &  num_bytes 
)
overridevirtual

Member Data Documentation

◆ kInvalidSocketValue

const NativeSocket Socket::kInvalidSocketValue = -1
static

◆ m_child_processes_inherit

bool lldb_private::Socket::m_child_processes_inherit
protected

◆ m_protocol

SocketProtocol lldb_private::Socket::m_protocol
protected

Definition at line 127 of file Socket.h.

Referenced by GetSocketProtocol().

◆ m_should_close_fd

bool lldb_private::Socket::m_should_close_fd
protected

Definition at line 130 of file Socket.h.

◆ m_socket

NativeSocket lldb_private::Socket::m_socket
protected

The documentation for this class was generated from the following files: