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