LLDB mainline
|
#include <Socket.h>
Classes | |
struct | HostAndPort |
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 |
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 () |
virtual Status | Read (void *buf, size_t &num_bytes)=0 |
virtual Status | Write (const void *buf, size_t &num_bytes)=0 |
virtual bool | IsValid () const =0 |
virtual Status | Close ()=0 |
FDType | GetFdType () const |
virtual WaitableHandle | GetWaitableHandle ()=0 |
Static Public Member Functions | |
static llvm::Error | Initialize () |
static void | Terminate () |
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) |
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 llvm::Expected< HostAndPort > | DecodeHostAndPort (llvm::StringRef host_and_port) |
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 |
|
override |
Definition at line 80 of file Socket.cpp.
References Close().
|
protected |
Definition at line 73 of file Socket.cpp.
Implemented in lldb_private::TCPSocket, lldb_private::UDPSocket, and lldb_private::DomainSocket.
|
staticprotected |
Definition at line 337 of file Socket.cpp.
References error(), kInvalidSocketValue, and SetLastError().
Referenced by lldb_private::DomainSocket::Accept().
|
overridevirtual |
Implements lldb_private::IOObject.
Definition at line 271 of file Socket.cpp.
References lldb_private::Connection, error(), lldb_private::GetLog(), IsValid(), kInvalidSocketValue, LLDB_LOGF, m_should_close_fd, m_socket, and SetLastError().
Referenced by lldb_private::TCPSocket::Connect(), lldb_private::TCPSocket::CreateSocket(), and ~Socket().
|
pure virtual |
Implemented in lldb_private::TCPSocket, lldb_private::UDPSocket, and lldb_private::DomainSocket.
|
static |
Definition at line 106 of file Socket.cpp.
References error(), ProtocolTcp, ProtocolUdp, ProtocolUnixAbstract, and ProtocolUnixDomain.
Referenced by lldb_private::ConnectionFileDescriptor::AcceptSocket(), lldb_private::ConnectionFileDescriptor::ConnectSocket(), and TcpConnect().
|
staticprotected |
Definition at line 321 of file Socket.cpp.
References error(), kInvalidSocketValue, and SetLastError().
Referenced by lldb_private::DomainSocket::Connect(), lldb_private::UDPSocket::Connect(), lldb_private::TCPSocket::CreateSocket(), lldb_private::TCPSocket::Listen(), and lldb_private::DomainSocket::Listen().
|
static |
Definition at line 188 of file Socket.cpp.
References lldb_private::Socket::HostAndPort::hostname, and lldb_private::Socket::HostAndPort::port.
Referenced by lldb_private::TCPSocket::Connect(), lldb_private::UDPSocket::Connect(), lldb_private::TCPSocket::Listen(), and lldb_private::process_gdb_remote::LLGSArgToURL().
|
inline |
Definition at line 90 of file Socket.h.
References m_socket.
Referenced by lldb_private::DomainSocket::Accept(), lldb_private::TCPSocket::Connect(), lldb_private::DomainSocket::Connect(), and lldb_private::DomainSocket::Listen().
int Socket::GetOption | ( | int | level, |
int | option_name, | ||
int & | option_value | ||
) |
Definition at line 294 of file Socket.cpp.
References m_socket.
|
inlinevirtual |
Reimplemented in lldb_private::TCPSocket, lldb_private::UDPSocket, and lldb_private::DomainSocket.
Definition at line 105 of file Socket.h.
Referenced by lldb_private::ConnectionFileDescriptor::InitializeSocket().
|
inline |
Definition at line 91 of file Socket.h.
References m_protocol.
|
overridevirtual |
|
static |
Definition at line 82 of file Socket.cpp.
Referenced by lldb_private::SystemInitializerCommon::Initialize().
|
inlineoverridevirtual |
Implements lldb_private::IOObject.
Definition at line 98 of file Socket.h.
References kInvalidSocketValue, and m_socket.
Referenced by Close().
|
pure virtual |
Implemented in lldb_private::TCPSocket, lldb_private::UDPSocket, and lldb_private::DomainSocket.
|
overridevirtual |
Implements lldb_private::IOObject.
Definition at line 216 of file Socket.cpp.
References lldb_private::Communication, error(), lldb_private::GetLog(), IsInterrupted(), LLDB_LOGF, m_socket, and SetLastError().
|
protectedvirtual |
Reimplemented in lldb_private::UDPSocket.
Definition at line 309 of file Socket.cpp.
References m_socket.
Referenced by Write().
|
staticprotected |
Definition at line 313 of file Socket.cpp.
References lldb::eErrorTypeWin32, and error().
Referenced by AcceptSocket(), Close(), lldb_private::DomainSocket::Connect(), CreateSocket(), lldb_private::DomainSocket::Listen(), Read(), and Write().
int Socket::SetOption | ( | int | level, |
int | option_name, | ||
int | option_value | ||
) |
Definition at line 302 of file Socket.cpp.
References m_socket.
Referenced by lldb_private::TCPSocket::SetOptionNoDelay(), and lldb_private::TCPSocket::SetOptionReuseAddress().
|
static |
Definition at line 148 of file Socket.cpp.
References lldb_private::Connection, Create(), error(), lldb_private::GetLog(), LLDB_LOG, and ProtocolTcp.
|
static |
Definition at line 167 of file Socket.cpp.
References lldb_private::Connection, error(), lldb_private::GetLog(), and LLDB_LOG.
|
static |
Definition at line 100 of file Socket.cpp.
Referenced by lldb_private::SystemInitializerCommon::Terminate().
|
static |
Definition at line 183 of file Socket.cpp.
References lldb_private::UDPSocket::Connect().
Referenced by lldb_private::ConnectionFileDescriptor::ConnectUDP().
|
overridevirtual |
Implements lldb_private::IOObject.
Definition at line 243 of file Socket.cpp.
References lldb_private::Communication, error(), lldb_private::GetLog(), IsInterrupted(), LLDB_LOGF, m_socket, Send(), and SetLastError().
|
static |
Definition at line 59 of file Socket.h.
Referenced by lldb_private::TCPSocket::Accept(), AcceptSocket(), Close(), CreateSocket(), lldb_private::TCPSocket::GetLocalIPAddress(), lldb_private::TCPSocket::GetLocalPortNumber(), lldb_private::TCPSocket::GetRemoteConnectionURI(), lldb_private::UDPSocket::GetRemoteConnectionURI(), lldb_private::TCPSocket::GetRemoteIPAddress(), lldb_private::TCPSocket::GetRemotePortNumber(), lldb_private::DomainSocket::GetSocketName(), lldb_private::TCPSocket::IsValid(), and IsValid().
|
protected |
Definition at line 123 of file Socket.h.
Referenced by lldb_private::TCPSocket::Accept(), lldb_private::DomainSocket::Accept(), lldb_private::DomainSocket::Connect(), lldb_private::TCPSocket::CreateSocket(), lldb_private::TCPSocket::Listen(), and lldb_private::DomainSocket::Listen().
|
protected |
Definition at line 121 of file Socket.h.
Referenced by GetSocketProtocol().
|
protected |
|
protected |
Definition at line 122 of file Socket.h.
Referenced by Close(), lldb_private::DomainSocket::Connect(), lldb_private::TCPSocket::CreateSocket(), lldb_private::DomainSocket::DomainSocket(), lldb_private::TCPSocket::GetLocalIPAddress(), lldb_private::TCPSocket::GetLocalPortNumber(), GetNativeSocket(), GetOption(), lldb_private::TCPSocket::GetRemoteConnectionURI(), lldb_private::UDPSocket::GetRemoteConnectionURI(), lldb_private::TCPSocket::GetRemoteIPAddress(), lldb_private::TCPSocket::GetRemotePortNumber(), lldb_private::DomainSocket::GetSocketName(), GetWaitableHandle(), lldb_private::TCPSocket::IsValid(), IsValid(), lldb_private::DomainSocket::Listen(), Read(), Send(), lldb_private::UDPSocket::Send(), SetOption(), lldb_private::TCPSocket::TCPSocket(), lldb_private::UDPSocket::UDPSocket(), and Write().