• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- 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 
10 namespace lldb {
11 
12 class SBCommunication
13 {
14 public:
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     static const char *GetBroadcasterClass();
38 
39     lldb::ConnectionStatus
40     AdoptFileDesriptor (int fd, bool owns_fd);
41 
42     lldb::ConnectionStatus
43     Connect (const char *url);
44 
45     lldb::ConnectionStatus
46     Disconnect ();
47 
48     bool
49     IsConnected () const;
50 
51     bool
52     GetCloseOnEOF ();
53 
54     void
55     SetCloseOnEOF (bool b);
56 
57     size_t
58     Read (void *dst,
59           size_t dst_len,
60           uint32_t timeout_usec,
61           lldb::ConnectionStatus &status);
62 
63     size_t
64     Write (const void *src,
65            size_t src_len,
66            lldb::ConnectionStatus &status);
67 
68     bool
69     ReadThreadStart ();
70 
71     bool
72     ReadThreadStop ();
73 
74     bool
75     ReadThreadIsRunning ();
76 
77     bool
78     SetReadThreadBytesReceivedCallback (ReadThreadBytesReceived callback,
79                                         void *callback_baton);
80 };
81 
82 } // namespace lldb
83