blob: ca2bfa789440cc4a4055c1e065b9da9c48d25b16 [file] [log] [blame]
Johnny Chen5cb6cab2011-07-19 22:41:47 +00001//===-- SWIG Interface for SBCommunication ----------------------*- 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
10namespace lldb {
11
12class SBCommunication
13{
14public:
15 enum {
16 eBroadcastBitDisconnected = (1 << 0), ///< Sent when the communications connection is lost.
17 eBroadcastBitReadThreadGotBytes = (1 << 1), ///< Sent by the read thread when bytes become available.
18 eBroadcastBitReadThreadDidExit = (1 << 2), ///< Sent by the read thread when it exits to inform clients.
19 eBroadcastBitReadThreadShouldExit = (1 << 3), ///< Sent by clients that need to cancel the read thread.
20 eBroadcastBitPacketAvailable = (1 << 4), ///< Sent when data received makes a complete packet.
21 eAllEventBits = 0xffffffff
22 };
23
24 typedef void (*ReadThreadBytesReceived) (void *baton, const void *src, size_t src_len);
25
26 SBCommunication ();
27 SBCommunication (const char * broadcaster_name);
28 ~SBCommunication ();
29
30
31 bool
32 IsValid () const;
33
34 lldb::SBBroadcaster
35 GetBroadcaster ();
36
37 lldb::ConnectionStatus
38 AdoptFileDesriptor (int fd, bool owns_fd);
39
40 lldb::ConnectionStatus
41 Connect (const char *url);
42
43 lldb::ConnectionStatus
44 Disconnect ();
45
46 bool
47 IsConnected () const;
48
49 bool
50 GetCloseOnEOF ();
51
52 void
53 SetCloseOnEOF (bool b);
54
55 size_t
56 Read (void *dst,
57 size_t dst_len,
58 uint32_t timeout_usec,
59 lldb::ConnectionStatus &status);
60
61 size_t
62 Write (const void *src,
63 size_t src_len,
64 lldb::ConnectionStatus &status);
65
66 bool
67 ReadThreadStart ();
68
69 bool
70 ReadThreadStop ();
71
72 bool
73 ReadThreadIsRunning ();
74
75 bool
76 SetReadThreadBytesReceivedCallback (ReadThreadBytesReceived callback,
77 void *callback_baton);
78};
79
80} // namespace lldb