1 //===-- ConnectionMachPort.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 #if defined(__APPLE__) 10 11 #ifndef liblldb_ConnectionMachPort_h_ 12 #define liblldb_ConnectionMachPort_h_ 13 14 // C Includes 15 #include <mach/mach.h> 16 17 // C++ Includes 18 #include <string> 19 20 // Other libraries and framework includes 21 // Project includes 22 #include "lldb/Core/Connection.h" 23 24 class ConnectionMachPort : 25 public lldb_private::Connection 26 { 27 public: 28 ConnectionMachPort (); 29 30 virtual 31 ~ConnectionMachPort (); 32 33 virtual bool 34 IsConnected () const; 35 36 virtual lldb::ConnectionStatus 37 BytesAvailable (uint32_t timeout_usec, lldb_private::Error *error_ptr); 38 39 virtual lldb::ConnectionStatus 40 Connect (const char *s, lldb_private::Error *error_ptr); 41 42 virtual lldb::ConnectionStatus 43 Disconnect (lldb_private::Error *error_ptr); 44 45 virtual size_t 46 Read (void *dst, 47 size_t dst_len, 48 uint32_t timeout_usec, 49 lldb::ConnectionStatus &status, 50 lldb_private::Error *error_ptr); 51 52 virtual size_t 53 Write (const void *src, 54 size_t src_len, 55 lldb::ConnectionStatus &status, 56 lldb_private::Error *error_ptr); 57 58 lldb::ConnectionStatus 59 BootstrapCheckIn (const char *port_name, 60 lldb_private::Error *error_ptr); 61 62 lldb::ConnectionStatus 63 BootstrapLookup (const char *port_name, 64 lldb_private::Error *error_ptr); 65 66 struct PayloadType 67 { 68 uint32_t command; 69 uint32_t data_length; 70 uint8_t data[32]; 71 }; 72 73 kern_return_t 74 Send (const PayloadType &payload); 75 76 kern_return_t 77 Receive (PayloadType &payload); 78 79 80 protected: 81 mach_port_t m_task; 82 mach_port_t m_port; 83 84 private: 85 86 87 DISALLOW_COPY_AND_ASSIGN (ConnectionMachPort); 88 }; 89 90 #endif // liblldb_ConnectionMachPort_h_ 91 92 #endif // #if defined(__APPLE__) 93