示例#1
0
        /// <summary>
        /// Creates a new <see cref="DebugServerClientHandle"/> 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 DebugServerClientHandle DangerousCreate(System.IntPtr unsafeHandle, bool ownsHandle)
        {
            DebugServerClientHandle safeHandle = new DebugServerClientHandle(ownsHandle);

            safeHandle.SetHandle(unsafeHandle);
            return(safeHandle);
        }
示例#2
0
        public static DebugServerError debugserver_client_receive_response(DebugServerClientHandle client, out string response)
        {
            System.Runtime.InteropServices.ICustomMarshaler responseMarshaler = NativeStringMarshaler.GetInstance(null);
            System.IntPtr    responseNative = System.IntPtr.Zero;
            DebugServerError returnValue    = DebugServerNativeMethods.debugserver_client_receive_response(client, out responseNative);

            response = ((string)responseMarshaler.MarshalNativeToManaged(responseNative));
            responseMarshaler.CleanUpNativeData(responseNative);
            return(returnValue);
        }
示例#3
0
        public static DebugServerError debugserver_client_set_argv(DebugServerClientHandle client, int argc, System.Collections.ObjectModel.ReadOnlyCollection <string> argv, out string response)
        {
            System.Runtime.InteropServices.ICustomMarshaler responseMarshaler = NativeStringMarshaler.GetInstance(null);
            System.IntPtr responseNative = System.IntPtr.Zero;
            System.Runtime.InteropServices.ICustomMarshaler argvMarshaler = NativeStringArrayMarshaler.GetInstance(null);
            System.IntPtr    argvNative  = argvMarshaler.MarshalManagedToNative(argv);
            DebugServerError returnValue = DebugServerNativeMethods.debugserver_client_set_argv(client, argc, argvNative, out responseNative);

            response = ((string)responseMarshaler.MarshalNativeToManaged(responseNative));
            responseMarshaler.CleanUpNativeData(responseNative);
            return(returnValue);
        }
示例#4
0
 public static DebugServerClientHandle DangerousCreate(System.IntPtr unsafeHandle)
 {
     return(DebugServerClientHandle.DangerousCreate(unsafeHandle, true));
 }
示例#5
0
        /// <summary>
        /// Starts a new debugserver 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
        /// debugserver_client_t upon successful return. Must be freed using
        /// debugserver_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>
        /// DEBUGSERVER_E_SUCCESS on success, or an DEBUGSERVER_E_* error
        /// code otherwise.
        /// </returns>
        public virtual DebugServerError debugserver_client_start_service(iDeviceHandle device, out DebugServerClientHandle client, string label)
        {
            DebugServerError returnValue;

            returnValue = DebugServerNativeMethods.debugserver_client_start_service(device, out client, label);
            client.Api  = this.Parent;
            return(returnValue);
        }
 public static extern DebugServerError debugserver_client_new(iDeviceHandle device, LockdownServiceDescriptorHandle service, out DebugServerClientHandle client);
 public static extern DebugServerError debugserver_client_set_argv(DebugServerClientHandle client, int argc, System.IntPtr argv, out System.IntPtr response);
 public static extern DebugServerError debugserver_client_receive_response(DebugServerClientHandle client, out System.IntPtr response);
 public static extern DebugServerError debugserver_client_receive(DebugServerClientHandle client, byte[] data, uint size, ref uint received);
示例#10
0
 /// <summary>
 /// Sends a command to the debugserver service.
 /// </summary>
 /// <param name="client">
 /// The debugserver client
 /// </param>
 /// <param name="command">
 /// Command to process and send
 /// </param>
 /// <param name="response">
 /// Response received for the command (can be NULL to ignore)
 /// </param>
 /// <returns>
 /// DEBUGSERVER_E_SUCCESS on success,
 /// DEBUGSERVER_E_INVALID_ARG when client or command is NULL
 /// </returns>
 public virtual DebugServerError debugserver_client_send_command(DebugServerClientHandle client, DebugServerCommandHandle command, out string response)
 {
     return(DebugServerNativeMethods.debugserver_client_send_command(client, command, out response));
 }
示例#11
0
 /// <summary>
 /// Receives raw data from the debugserver service.
 /// </summary>
 /// <param name="client">
 /// The debugserver client
 /// </param>
 /// <param name="data">
 /// Buffer that will be filled with the data received
 /// </param>
 /// <param name="size">
 /// Number of bytes to receive
 /// </param>
 /// <param name="received">
 /// Number of bytes received (can be NULL to ignore)
 /// </param>
 /// <returns>
 /// DEBUGSERVER_E_SUCCESS on success,
 /// DEBUGSERVER_E_INVALID_ARG when client or plist is NULL
 /// </returns>
 /// <remarks>
 /// The default read timeout is 10 seconds.
 /// </remarks>
 public virtual DebugServerError debugserver_client_receive(DebugServerClientHandle client, byte[] data, uint size, ref uint received)
 {
     return(DebugServerNativeMethods.debugserver_client_receive(client, data, size, ref received));
 }
示例#12
0
 /// <summary>
 /// Receives raw data using the given debugserver client with specified timeout.
 /// </summary>
 /// <param name="client">
 /// The debugserver client to use for receiving
 /// </param>
 /// <param name="data">
 /// Buffer that will be filled with the data received
 /// </param>
 /// <param name="size">
 /// Number of bytes to receive
 /// </param>
 /// <param name="received">
 /// Number of bytes received (can be NULL to ignore)
 /// </param>
 /// <param name="timeout">
 /// Maximum time in milliseconds to wait for data.
 /// </param>
 /// <returns>
 /// DEBUGSERVER_E_SUCCESS on success,
 /// DEBUGSERVER_E_INVALID_ARG when one or more parameters are
 /// invalid, DEBUGSERVER_E_MUX_ERROR when a communication error
 /// occurs, or DEBUGSERVER_E_UNKNOWN_ERROR when an unspecified
 /// error occurs.
 /// </returns>
 public virtual DebugServerError debugserver_client_receive_with_timeout(DebugServerClientHandle client, byte[] data, uint size, ref uint received, uint timeout)
 {
     return(DebugServerNativeMethods.debugserver_client_receive_with_timeout(client, data, size, ref received, timeout));
 }
示例#13
0
 /// <summary>
 /// Sends raw data using the given debugserver service client.
 /// </summary>
 /// <param name="client">
 /// The debugserver client to use for sending
 /// </param>
 /// <param name="data">
 /// Data to send
 /// </param>
 /// <param name="size">
 /// Size of the data to send
 /// </param>
 /// <param name="sent">
 /// Number of bytes sent (can be NULL to ignore)
 /// </param>
 /// <returns>
 /// DEBUGSERVER_E_SUCCESS on success,
 /// DEBUGSERVER_E_INVALID_ARG when one or more parameters are
 /// invalid, or DEBUGSERVER_E_UNKNOWN_ERROR when an unspecified
 /// error occurs.
 /// </returns>
 public virtual DebugServerError debugserver_client_send(DebugServerClientHandle client, byte[] data, uint size, ref uint sent)
 {
     return(DebugServerNativeMethods.debugserver_client_send(client, data, size, ref sent));
 }
示例#14
0
 public object MarshalNativeToManaged(System.IntPtr nativeData)
 {
     return(DebugServerClientHandle.DangerousCreate(nativeData, false));
 }
 public static extern DebugServerError debugserver_client_send(DebugServerClientHandle client, byte[] data, uint size, ref uint sent);
 public static extern DebugServerError debugserver_client_receive_with_timeout(DebugServerClientHandle client, byte[] data, uint size, ref uint received, uint timeout);
示例#17
0
 /// <summary>
 /// Receives and parses response of debugserver service.
 /// </summary>
 /// <param name="client">
 /// The debugserver client
 /// </param>
 /// <param name="response">
 /// Response received for last command (can be NULL to ignore)
 /// </param>
 /// <returns>
 /// DEBUGSERVER_E_SUCCESS on success,
 /// DEBUGSERVER_E_INVALID_ARG when client is NULL
 /// </returns>
 public virtual DebugServerError debugserver_client_receive_response(DebugServerClientHandle client, out string response)
 {
     return(DebugServerNativeMethods.debugserver_client_receive_response(client, out response));
 }
 public static extern DebugServerError debugserver_client_send_command(DebugServerClientHandle client, DebugServerCommandHandle command, out System.IntPtr response);
示例#19
0
 /// <summary>
 /// Controls status of ACK mode when sending commands or receiving responses.
 /// </summary>
 /// <param name="client">
 /// The debugserver client
 /// </param>
 /// <param name="enabled">
 /// A boolean flag indicating whether the internal ACK mode
 /// handling should be enabled or disabled.
 /// </param>
 /// <returns>
 /// DEBUGSERVER_E_SUCCESS on success, or an DEBUGSERVER_E_* error
 /// code otherwise.
 /// </returns>
 public virtual DebugServerError debugserver_client_set_ack_mode(DebugServerClientHandle client, int enabled)
 {
     return(DebugServerNativeMethods.debugserver_client_set_ack_mode(client, enabled));
 }
 public static extern DebugServerError debugserver_client_set_ack_mode(DebugServerClientHandle client, int enabled);
示例#21
0
 /// <summary>
 /// Sets the argv which launches an app.
 /// </summary>
 /// <param name="client">
 /// The debugserver client
 /// </param>
 /// <param name="argc">
 /// Number of arguments
 /// </param>
 /// <param name="argv">
 /// Array starting with the executable to be run followed by it's arguments
 /// </param>
 /// <param name="response">
 /// Response received for the command (can be NULL to ignore)
 /// </param>
 /// <returns>
 /// DEBUGSERVER_E_SUCCESS on success,
 /// DEBUGSERVER_E_INVALID_ARG when client is NULL
 /// </returns>
 public virtual DebugServerError debugserver_client_set_argv(DebugServerClientHandle client, int argc, System.Collections.ObjectModel.ReadOnlyCollection <string> argv, out string response)
 {
     return(DebugServerNativeMethods.debugserver_client_set_argv(client, argc, argv, out response));
 }
 public static extern DebugServerError debugserver_client_set_environment_hex_encoded(DebugServerClientHandle client, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string env, out System.IntPtr response);
示例#23
0
 /// <summary>
 /// Adds or sets an environment variable.
 /// </summary>
 /// <param name="client">
 /// The debugserver client
 /// </param>
 /// <param name="env">
 /// The environment variable in "KEY=VALUE" notation
 /// </param>
 /// <param name="response">
 /// Response received for the command (can be NULL to ignore)
 /// </param>
 /// <returns>
 /// DEBUGSERVER_E_SUCCESS on success,
 /// DEBUGSERVER_E_INVALID_ARG when client is NULL
 /// </returns>
 public virtual DebugServerError debugserver_client_set_environment_hex_encoded(DebugServerClientHandle client, string env, out string response)
 {
     return(DebugServerNativeMethods.debugserver_client_set_environment_hex_encoded(client, env, out response));
 }
 public static extern DebugServerError debugserver_client_start_service(iDeviceHandle device, out DebugServerClientHandle client, [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string label);
示例#25
0
        /// <summary>
        /// Connects to the debugserver 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
        /// debugserver_client_t upon successful return. Must be freed using
        /// debugserver_client_free() after use.
        /// </param>
        /// <returns>
        /// DEBUGSERVER_E_SUCCESS on success, DEBUGSERVER_E_INVALID_ARG when
        /// client is NULL, or an DEBUGSERVER_E_* error code otherwise.
        /// </returns>
        public virtual DebugServerError debugserver_client_new(iDeviceHandle device, LockdownServiceDescriptorHandle service, out DebugServerClientHandle client)
        {
            DebugServerError returnValue;

            returnValue = DebugServerNativeMethods.debugserver_client_new(device, service, out client);
            client.Api  = this.Parent;
            return(returnValue);
        }