LLDB API Documentation

SBCommunication.h
Go to the documentation of this file.
1 //===-- SBCommunication.h ---------------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLDB_SBCommunication_h_
11 #define LLDB_SBCommunication_h_
12 
13 #include "lldb/API/SBDefines.h"
14 #include "lldb/API/SBError.h"
15 
16 namespace lldb {
17 
18 class LLDB_API SBCommunication {
19 public:
21  eBroadcastBitDisconnected =
22  (1 << 0), ///< Sent when the communications connection is lost.
23  eBroadcastBitReadThreadGotBytes =
24  (1 << 1), ///< Sent by the read thread when bytes become available.
25  eBroadcastBitReadThreadDidExit =
26  (1
27  << 2), ///< Sent by the read thread when it exits to inform clients.
28  eBroadcastBitReadThreadShouldExit =
29  (1 << 3), ///< Sent by clients that need to cancel the read thread.
30  eBroadcastBitPacketAvailable =
31  (1 << 4), ///< Sent when data received makes a complete packet.
32  eAllEventBits = 0xffffffff};
33 
34  typedef void (*ReadThreadBytesReceived)(void *baton, const void *src,
35  size_t src_len);
36 
38  SBCommunication(const char *broadcaster_name);
39  ~SBCommunication();
40 
41  bool IsValid() const;
42 
43  lldb::SBBroadcaster GetBroadcaster();
44 
45  static const char *GetBroadcasterClass();
46 
47  lldb::ConnectionStatus AdoptFileDesriptor(int fd, bool owns_fd);
48 
49  lldb::ConnectionStatus Connect(const char *url);
50 
51  lldb::ConnectionStatus Disconnect();
52 
53  bool IsConnected() const;
54 
55  bool GetCloseOnEOF();
56 
57  void SetCloseOnEOF(bool b);
58 
59  size_t Read(void *dst, size_t dst_len, uint32_t timeout_usec,
60  lldb::ConnectionStatus &status);
61 
62  size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status);
63 
64  bool ReadThreadStart();
65 
66  bool ReadThreadStop();
67 
68  bool ReadThreadIsRunning();
69 
70  bool SetReadThreadBytesReceivedCallback(ReadThreadBytesReceived callback,
71  void *callback_baton);
72 
73 private:
74  DISALLOW_COPY_AND_ASSIGN(SBCommunication);
75 
76  lldb_private::Communication *m_opaque;
77  bool m_opaque_owned;
78 };
79 
80 } // namespace lldb
81 
82 #endif // LLDB_SBCommunication_h_
class LLDB_API SBCommunication
Definition: SBDefines.h:41