1 //===-- SBCommunication.h ---------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLDB_SBCommunication_h_
11 #define LLDB_SBCommunication_h_
13 #include "lldb/API/SBDefines.h"
14 #include "lldb/API/SBError.h"
18 class LLDB_API SBCommunication {
20 FLAGS_ANONYMOUS_ENUM(){
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 =
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};
34 typedef void (*ReadThreadBytesReceived)(void *baton, const void *src,
38 SBCommunication(const char *broadcaster_name);
43 lldb::SBBroadcaster GetBroadcaster();
45 static const char *GetBroadcasterClass();
47 lldb::ConnectionStatus AdoptFileDesriptor(int fd, bool owns_fd);
49 lldb::ConnectionStatus Connect(const char *url);
51 lldb::ConnectionStatus Disconnect();
53 bool IsConnected() const;
57 void SetCloseOnEOF(bool b);
59 size_t Read(void *dst, size_t dst_len, uint32_t timeout_usec,
60 lldb::ConnectionStatus &status);
62 size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status);
64 bool ReadThreadStart();
66 bool ReadThreadStop();
68 bool ReadThreadIsRunning();
70 bool SetReadThreadBytesReceivedCallback(ReadThreadBytesReceived callback,
71 void *callback_baton);
74 DISALLOW_COPY_AND_ASSIGN(SBCommunication);
76 lldb_private::Communication *m_opaque;
82 #endif // LLDB_SBCommunication_h_