예제 #1
0
        /// <summary>
        /// Creates a new <see cref="HeartBeatClientHandle"/> from a <see cref="IntPtr"/>.
        /// </summary>
        /// <param name="unsafeHandle">
        /// The underlying <see cref="IntPtr"/>
        /// </param>
        /// <param name="ownsHandle">
        /// <see langword="true"/> to reliably release the handle during the finalization phase; <see langword="false"/> to prevent reliable release (not recommended).
        /// </param>
        /// <returns>
        /// </returns>
        public static HeartBeatClientHandle DangerousCreate(System.IntPtr unsafeHandle, bool ownsHandle)
        {
            HeartBeatClientHandle safeHandle = new HeartBeatClientHandle(ownsHandle);

            safeHandle.SetHandle(unsafeHandle);
            return(safeHandle);
        }
예제 #2
0
        /// <summary>
        /// Receives a plist using the given heartbeat client.
        /// </summary>
        /// <param name="client">
        /// The heartbeat client to use for receiving
        /// </param>
        /// <param name="plist">
        /// pointer to a plist_t that will point to the received plist
        /// upon successful return
        /// </param>
        /// <param name="timeout">
        /// Maximum time in milliseconds to wait for data.
        /// </param>
        /// <returns>
        /// HEARTBEAT_E_SUCCESS on success,
        /// HEARTBEAT_E_INVALID_ARG when client or *plist is NULL,
        /// HEARTBEAT_E_NOT_ENOUGH_DATA when not enough data
        /// received, HEARTBEAT_E_TIMEOUT when the connection times out,
        /// HEARTBEAT_E_PLIST_ERROR when the received data cannot be
        /// converted to a plist, HEARTBEAT_E_MUX_ERROR when a
        /// communication error occurs, or HEARTBEAT_E_UNKNOWN_ERROR
        /// when an unspecified error occurs.
        /// </returns>
        public virtual HeartBeatError heartbeat_receive_with_timeout(HeartBeatClientHandle client, out PlistHandle plist, uint timeoutMs)
        {
            HeartBeatError returnValue;

            returnValue = HeartBeatNativeMethods.heartbeat_receive_with_timeout(client, out plist, timeoutMs);
            plist.Api   = this.Parent;
            return(returnValue);
        }
예제 #3
0
        /// <summary>
        /// Receives a plist from the service.
        /// </summary>
        /// <param name="client">
        /// The heartbeat client
        /// </param>
        /// <param name="plist">
        /// The plist to store the received data
        /// </param>
        /// <returns>
        /// HEARTBEAT_E_SUCCESS on success,
        /// HEARTBEAT_E_INVALID_ARG when client or plist is NULL
        /// </returns>
        public virtual HeartBeatError heartbeat_receive(HeartBeatClientHandle client, out PlistHandle plist)
        {
            HeartBeatError returnValue;

            returnValue = HeartBeatNativeMethods.heartbeat_receive(client, out plist);
            plist.Api   = this.Parent;
            return(returnValue);
        }
 public object MarshalNativeToManaged(System.IntPtr nativeData)
 {
     return(HeartBeatClientHandle.DangerousCreate(nativeData, false));
 }
 public static extern HeartBeatError heartbeat_client_start_service(iDeviceHandle device, out HeartBeatClientHandle client, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string label);
 public static extern HeartBeatError heartbeat_client_new(iDeviceHandle device, LockdownServiceDescriptorHandle service, out HeartBeatClientHandle client);
 public static extern HeartBeatError heartbeat_receive_with_timeout(HeartBeatClientHandle client, out PlistHandle plist, uint timeoutMs);
 public static extern HeartBeatError heartbeat_receive(HeartBeatClientHandle client, out PlistHandle plist);
 public static extern HeartBeatError heartbeat_send(HeartBeatClientHandle client, PlistHandle plist);
예제 #10
0
        /// <summary>
        /// Starts a new heartbeat service on the specified device and connects to it.
        /// </summary>
        /// <param name="device">
        /// The device to connect to.
        /// </param>
        /// <param name="client">
        /// Pointer that will point to a newly allocated
        /// heartbeat_client_t upon successful return. Must be freed using
        /// heartbeat_client_free() after use.
        /// </param>
        /// <param name="label">
        /// The label to use for communication. Usually the program name.
        /// Pass NULL to disable sending the label in requests to lockdownd.
        /// </param>
        /// <returns>
        /// HEARTBEAT_E_SUCCESS on success, or an HEARTBEAT_E_* error
        /// code otherwise.
        /// </returns>
        public virtual HeartBeatError heartbeat_client_start_service(iDeviceHandle device, out HeartBeatClientHandle client, string label)
        {
            HeartBeatError returnValue;

            returnValue = HeartBeatNativeMethods.heartbeat_client_start_service(device, out client, label);
            client.Api  = this.Parent;
            return(returnValue);
        }
예제 #11
0
        /// <summary>
        /// Connects to the heartbeat service on the specified device.
        /// </summary>
        /// <param name="device">
        /// The device to connect to.
        /// </param>
        /// <param name="service">
        /// The service descriptor returned by lockdownd_start_service.
        /// </param>
        /// <param name="client">
        /// Pointer that will point to a newly allocated
        /// heartbeat_client_t upon successful return. Must be freed using
        /// heartbeat_client_free() after use.
        /// </param>
        /// <returns>
        /// HEARTBEAT_E_SUCCESS on success, HEARTBEAT_E_INVALID_ARG when
        /// client is NULL, or an HEARTBEAT_E_* error code otherwise.
        /// </returns>
        public virtual HeartBeatError heartbeat_client_new(iDeviceHandle device, LockdownServiceDescriptorHandle service, out HeartBeatClientHandle client)
        {
            HeartBeatError returnValue;

            returnValue = HeartBeatNativeMethods.heartbeat_client_new(device, service, out client);
            client.Api  = this.Parent;
            return(returnValue);
        }
예제 #12
0
 /// <summary>
 /// Sends a plist to the service.
 /// </summary>
 /// <param name="client">
 /// The heartbeat client
 /// </param>
 /// <param name="plist">
 /// The plist to send
 /// </param>
 /// <returns>
 /// HEARTBEAT_E_SUCCESS on success,
 /// HEARTBEAT_E_INVALID_ARG when client or plist is NULL
 /// </returns>
 public virtual HeartBeatError heartbeat_send(HeartBeatClientHandle client, PlistHandle plist)
 {
     return(HeartBeatNativeMethods.heartbeat_send(client, plist));
 }
 public static HeartBeatClientHandle DangerousCreate(System.IntPtr unsafeHandle)
 {
     return(HeartBeatClientHandle.DangerousCreate(unsafeHandle, true));
 }