LLDB  mainline
TCPSocket.h
Go to the documentation of this file.
1 //===-- TCPSocket.h ---------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_HOST_COMMON_TCPSOCKET_H
10 #define LLDB_HOST_COMMON_TCPSOCKET_H
11 
12 #include "lldb/Host/Socket.h"
14 #include <map>
15 
16 namespace lldb_private {
17 class TCPSocket : public Socket {
18 public:
19  TCPSocket(bool should_close, bool child_processes_inherit);
20  TCPSocket(NativeSocket socket, bool should_close,
21  bool child_processes_inherit);
22  ~TCPSocket() override;
23 
24  // returns port number or 0 if error
26 
27  // returns ip address string or empty string if error
29 
30  // must be connected
31  // returns port number or 0 if error
33 
34  // must be connected
35  // returns ip address string or empty string if error
37 
38  int SetOptionNoDelay();
40 
41  Status Connect(llvm::StringRef name) override;
42  Status Listen(llvm::StringRef name, int backlog) override;
43  Status Accept(Socket *&conn_socket) override;
44 
45  Status CreateSocket(int domain);
46 
47  bool IsValid() const override;
48 
49  std::string GetRemoteConnectionURI() const override;
50 
51 private:
52  TCPSocket(NativeSocket socket, const TCPSocket &listen_socket);
53 
54  void CloseListenSockets();
55 
56  std::map<int, SocketAddress> m_listen_sockets;
57 };
58 }
59 
60 #endif // LLDB_HOST_COMMON_TCPSOCKET_H
lldb_private::TCPSocket::Connect
Status Connect(llvm::StringRef name) override
Definition: TCPSocket.cpp:149
lldb_private::TCPSocket::CloseListenSockets
void CloseListenSockets()
Definition: TCPSocket.cpp:248
lldb_private::TCPSocket::Accept
Status Accept(Socket *&conn_socket) override
Definition: TCPSocket.cpp:254
lldb_private::Socket
Definition: Socket.h:42
lldb_private::TCPSocket::m_listen_sockets
std::map< int, SocketAddress > m_listen_sockets
Definition: TCPSocket.h:56
lldb_private::TCPSocket::IsValid
bool IsValid() const override
Definition: TCPSocket.cpp:75
lldb_private::TCPSocket::SetOptionReuseAddress
int SetOptionReuseAddress()
Definition: TCPSocket.cpp:318
lldb_private::TCPSocket::TCPSocket
TCPSocket(bool should_close, bool child_processes_inherit)
Definition: TCPSocket.cpp:58
lldb_private::TCPSocket::GetLocalIPAddress
std::string GetLocalIPAddress() const
Definition: TCPSocket.cpp:96
Socket.h
lldb_private::TCPSocket::GetRemoteIPAddress
std::string GetRemoteIPAddress() const
Definition: TCPSocket.cpp:118
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
lldb_private::NativeSocket
int NativeSocket
Definition: Socket.h:37
SocketAddress.h
lldb_private::Status
Definition: Status.h:44
lldb_private::TCPSocket::SetOptionNoDelay
int SetOptionNoDelay()
Definition: TCPSocket.cpp:314
uint16_t
lldb_private::TCPSocket
Definition: TCPSocket.h:17
lldb_private::TCPSocket::GetRemoteConnectionURI
std::string GetRemoteConnectionURI() const override
Definition: TCPSocket.cpp:130
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::TCPSocket::CreateSocket
Status CreateSocket(int domain)
Definition: TCPSocket.cpp:138
lldb_private::TCPSocket::GetRemotePortNumber
uint16_t GetRemotePortNumber() const
Definition: TCPSocket.cpp:108
lldb_private::TCPSocket::GetLocalPortNumber
uint16_t GetLocalPortNumber() const
Definition: TCPSocket.cpp:80
lldb_private::TCPSocket::~TCPSocket
~TCPSocket() override
Definition: TCPSocket.cpp:73
lldb_private::TCPSocket::Listen
Status Listen(llvm::StringRef name, int backlog) override
Definition: TCPSocket.cpp:187