1 //===-- ConnectionSharedMemory.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 liblldb_ConnectionSharedMemory_h_
11 #define liblldb_ConnectionSharedMemory_h_
12 
13 // C Includes
14 // C++ Includes
15 #include <string>
16 
17 // Other libraries and framework includes
18 // Project includes
19 #include "lldb/Core/Connection.h"
20 #include "lldb/Core/DataBufferMemoryMap.h"
21 
22 namespace lldb_private {
23 
24 class ConnectionSharedMemory :
25     public Connection
26 {
27 public:
28 
29     ConnectionSharedMemory ();
30 
31     virtual
32     ~ConnectionSharedMemory ();
33 
34     virtual bool
35     IsConnected () const;
36 
37     virtual lldb::ConnectionStatus
38     BytesAvailable (uint32_t timeout_usec, Error *error_ptr);
39 
40     virtual lldb::ConnectionStatus
41     Connect (const char *s, Error *error_ptr);
42 
43     virtual lldb::ConnectionStatus
44     Disconnect (Error *error_ptr);
45 
46     virtual size_t
47     Read (void *dst,
48           size_t dst_len,
49           uint32_t timeout_usec,
50           lldb::ConnectionStatus &status,
51           Error *error_ptr);
52 
53     virtual size_t
54     Write (const void *src, size_t src_len, lldb::ConnectionStatus &status, Error *error_ptr);
55 
56     lldb::ConnectionStatus
57     Open (bool create, const char *name, size_t size, Error *error_ptr);
58 
59 protected:
60 
61     std::string m_name;
62     int m_fd;    // One buffer that contains all we need
63     DataBufferMemoryMap m_mmap;
64 private:
65     DISALLOW_COPY_AND_ASSIGN (ConnectionSharedMemory);
66 };
67 
68 } // namespace lldb_private
69 
70 #endif  // liblldb_ConnectionSharedMemory_h_
71