Class DebugServerNativeMethods
Inheritance
Inherited Members
Namespace: iMobileDevice.DebugServer
Assembly: iMobileDevice-net.dll
Syntax
public class DebugServerNativeMethods
Methods
debugserver_client_free(IntPtr)
Disconnects a debugserver client from the device and frees up the debugserver client data.
Declaration
public static DebugServerError debugserver_client_free(IntPtr client)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | client | The debugserver client to disconnect and free. |
Returns
Type | Description |
---|---|
DebugServerError | DEBUGSERVER_E_SUCCESS on success, DEBUGSERVER_E_INVALID_ARG when client is NULL, or an DEBUGSERVER_E_* error code otherwise. |
debugserver_client_new(iDeviceHandle, LockdownServiceDescriptorHandle, out DebugServerClientHandle)
Connects to the debugserver service on the specified device.
Declaration
public static DebugServerError debugserver_client_new(iDeviceHandle device, LockdownServiceDescriptorHandle service, out DebugServerClientHandle client)
Parameters
Type | Name | Description |
---|---|---|
iDeviceHandle | device | The device to connect to. |
LockdownServiceDescriptorHandle | service | The service descriptor returned by lockdownd_start_service. |
DebugServerClientHandle | client | Pointer that will point to a newly allocated debugserver_client_t upon successful return. Must be freed using debugserver_client_free() after use. |
Returns
Type | Description |
---|---|
DebugServerError | DEBUGSERVER_E_SUCCESS on success, DEBUGSERVER_E_INVALID_ARG when client is NULL, or an DEBUGSERVER_E_* error code otherwise. |
debugserver_client_receive(DebugServerClientHandle, Byte[], UInt32, ref UInt32)
Receives raw data from the debugserver service.
Declaration
public static DebugServerError debugserver_client_receive(DebugServerClientHandle client, byte[] data, uint size, ref uint received)
Parameters
Type | Name | Description |
---|---|---|
DebugServerClientHandle | client | The debugserver client |
System.Byte[] | data | Buffer that will be filled with the data received |
System.UInt32 | size | Number of bytes to receive |
System.UInt32 | received | Number of bytes received (can be NULL to ignore) |
Returns
Type | Description |
---|---|
DebugServerError | DEBUGSERVER_E_SUCCESS on success, DEBUGSERVER_E_INVALID_ARG when client or plist is NULL |
Remarks
The default read timeout is 10 seconds.
debugserver_client_receive_response(DebugServerClientHandle, out IntPtr)
Receives and parses response of debugserver service.
Declaration
public static DebugServerError debugserver_client_receive_response(DebugServerClientHandle client, out IntPtr response)
Parameters
Type | Name | Description |
---|---|---|
DebugServerClientHandle | client | The debugserver client |
System.IntPtr | response | Response received for last command (can be NULL to ignore) |
Returns
Type | Description |
---|---|
DebugServerError | DEBUGSERVER_E_SUCCESS on success, DEBUGSERVER_E_INVALID_ARG when client is NULL |
debugserver_client_receive_response(DebugServerClientHandle, out String)
Declaration
public static DebugServerError debugserver_client_receive_response(DebugServerClientHandle client, out string response)
Parameters
Type | Name | Description |
---|---|---|
DebugServerClientHandle | client | |
System.String | response |
Returns
Type | Description |
---|---|
DebugServerError |
debugserver_client_receive_with_timeout(DebugServerClientHandle, Byte[], UInt32, ref UInt32, UInt32)
Receives raw data using the given debugserver client with specified timeout.
Declaration
public static DebugServerError debugserver_client_receive_with_timeout(DebugServerClientHandle client, byte[] data, uint size, ref uint received, uint timeout)
Parameters
Type | Name | Description |
---|---|---|
DebugServerClientHandle | client | The debugserver client to use for receiving |
System.Byte[] | data | Buffer that will be filled with the data received |
System.UInt32 | size | Number of bytes to receive |
System.UInt32 | received | Number of bytes received (can be NULL to ignore) |
System.UInt32 | timeout | Maximum time in milliseconds to wait for data. |
Returns
Type | Description |
---|---|
DebugServerError | 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. |
debugserver_client_send(DebugServerClientHandle, Byte[], UInt32, ref UInt32)
Sends raw data using the given debugserver service client.
Declaration
public static DebugServerError debugserver_client_send(DebugServerClientHandle client, byte[] data, uint size, ref uint sent)
Parameters
Type | Name | Description |
---|---|---|
DebugServerClientHandle | client | The debugserver client to use for sending |
System.Byte[] | data | Data to send |
System.UInt32 | size | Size of the data to send |
System.UInt32 | sent | Number of bytes sent (can be NULL to ignore) |
Returns
Type | Description |
---|---|
DebugServerError | 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. |
debugserver_client_send_command(DebugServerClientHandle, DebugServerCommandHandle, out IntPtr)
Sends a command to the debugserver service.
Declaration
public static DebugServerError debugserver_client_send_command(DebugServerClientHandle client, DebugServerCommandHandle command, out IntPtr response)
Parameters
Type | Name | Description |
---|---|---|
DebugServerClientHandle | client | The debugserver client |
DebugServerCommandHandle | command | Command to process and send |
System.IntPtr | response | Response received for the command (can be NULL to ignore) |
Returns
Type | Description |
---|---|
DebugServerError | DEBUGSERVER_E_SUCCESS on success, DEBUGSERVER_E_INVALID_ARG when client or command is NULL |
debugserver_client_send_command(DebugServerClientHandle, DebugServerCommandHandle, out String)
Declaration
public static DebugServerError debugserver_client_send_command(DebugServerClientHandle client, DebugServerCommandHandle command, out string response)
Parameters
Type | Name | Description |
---|---|---|
DebugServerClientHandle | client | |
DebugServerCommandHandle | command | |
System.String | response |
Returns
Type | Description |
---|---|
DebugServerError |
debugserver_client_set_ack_mode(DebugServerClientHandle, Int32)
Controls status of ACK mode when sending commands or receiving responses.
Declaration
public static DebugServerError debugserver_client_set_ack_mode(DebugServerClientHandle client, int enabled)
Parameters
Type | Name | Description |
---|---|---|
DebugServerClientHandle | client | The debugserver client |
System.Int32 | enabled | A boolean flag indicating whether the internal ACK mode handling should be enabled or disabled. |
Returns
Type | Description |
---|---|
DebugServerError | DEBUGSERVER_E_SUCCESS on success, or an DEBUGSERVER_E_* error code otherwise. |
debugserver_client_set_argv(DebugServerClientHandle, Int32, ReadOnlyCollection<String>, out String)
Declaration
public static DebugServerError debugserver_client_set_argv(DebugServerClientHandle client, int argc, ReadOnlyCollection<string> argv, out string response)
Parameters
Type | Name | Description |
---|---|---|
DebugServerClientHandle | client | |
System.Int32 | argc | |
System.Collections.ObjectModel.ReadOnlyCollection<System.String> | argv | |
System.String | response |
Returns
Type | Description |
---|---|
DebugServerError |
debugserver_client_set_argv(DebugServerClientHandle, Int32, IntPtr, out IntPtr)
Sets the argv which launches an app.
Declaration
public static DebugServerError debugserver_client_set_argv(DebugServerClientHandle client, int argc, IntPtr argv, out IntPtr response)
Parameters
Type | Name | Description |
---|---|---|
DebugServerClientHandle | client | The debugserver client |
System.Int32 | argc | Number of arguments |
System.IntPtr | argv | Array starting with the executable to be run followed by it's arguments |
System.IntPtr | response | Response received for the command (can be NULL to ignore) |
Returns
Type | Description |
---|---|
DebugServerError | DEBUGSERVER_E_SUCCESS on success, DEBUGSERVER_E_INVALID_ARG when client is NULL |
debugserver_client_set_environment_hex_encoded(DebugServerClientHandle, String, out IntPtr)
Adds or sets an environment variable.
Declaration
public static DebugServerError debugserver_client_set_environment_hex_encoded(DebugServerClientHandle client, string env, out IntPtr response)
Parameters
Type | Name | Description |
---|---|---|
DebugServerClientHandle | client | The debugserver client |
System.String | env | The environment variable in "KEY=VALUE" notation |
System.IntPtr | response | Response received for the command (can be NULL to ignore) |
Returns
Type | Description |
---|---|
DebugServerError | DEBUGSERVER_E_SUCCESS on success, DEBUGSERVER_E_INVALID_ARG when client is NULL |
debugserver_client_set_environment_hex_encoded(DebugServerClientHandle, String, out String)
Declaration
public static DebugServerError debugserver_client_set_environment_hex_encoded(DebugServerClientHandle client, string env, out string response)
Parameters
Type | Name | Description |
---|---|---|
DebugServerClientHandle | client | |
System.String | env | |
System.String | response |
Returns
Type | Description |
---|---|
DebugServerError |
debugserver_client_start_service(iDeviceHandle, out DebugServerClientHandle, String)
Starts a new debugserver service on the specified device and connects to it.
Declaration
public static DebugServerError debugserver_client_start_service(iDeviceHandle device, out DebugServerClientHandle client, string label)
Parameters
Type | Name | Description |
---|---|---|
iDeviceHandle | device | The device to connect to. |
DebugServerClientHandle | client | Pointer that will point to a newly allocated debugserver_client_t upon successful return. Must be freed using debugserver_client_free() after use. |
System.String | label | The label to use for communication. Usually the program name. Pass NULL to disable sending the label in requests to lockdownd. |
Returns
Type | Description |
---|---|
DebugServerError | DEBUGSERVER_E_SUCCESS on success, or an DEBUGSERVER_E_* error code otherwise. |
debugserver_command_free(IntPtr)
Frees memory of command object.
Declaration
public static DebugServerError debugserver_command_free(IntPtr command)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | command | The command object |
Returns
Type | Description |
---|---|
DebugServerError | DEBUGSERVER_E_SUCCESS on success, DEBUGSERVER_E_INVALID_ARG when command is NULL |
debugserver_command_new(String, Int32, ReadOnlyCollection<String>, out DebugServerCommandHandle)
Declaration
public static DebugServerError debugserver_command_new(string name, int argc, ReadOnlyCollection<string> argv, out DebugServerCommandHandle command)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | |
System.Int32 | argc | |
System.Collections.ObjectModel.ReadOnlyCollection<System.String> | argv | |
DebugServerCommandHandle | command |
Returns
Type | Description |
---|---|
DebugServerError |
debugserver_command_new(String, Int32, IntPtr, out DebugServerCommandHandle)
Creates and initializes a new command object.
Declaration
public static DebugServerError debugserver_command_new(string name, int argc, IntPtr argv, out DebugServerCommandHandle command)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the command which is sent in plain text |
System.Int32 | argc | Number of items in the token array |
System.IntPtr | argv | Array of tokens for the command ment to be encoded |
DebugServerCommandHandle | command | New command object |
Returns
Type | Description |
---|---|
DebugServerError | DEBUGSERVER_E_SUCCESS on success, DEBUGSERVER_E_INVALID_ARG when name or command is NULL |
debugserver_decode_string(String, UInt32, out IntPtr)
Decodes a hex encoded string.
Declaration
public static void debugserver_decode_string(string encodedBuffer, uint encodedLength, out IntPtr buffer)
Parameters
Type | Name | Description |
---|---|---|
System.String | encodedBuffer | |
System.UInt32 | encodedLength | |
System.IntPtr | buffer | Decoded string to be freed by the caller |
debugserver_decode_string(String, UInt32, out String)
Declaration
public static void debugserver_decode_string(string encodedBuffer, uint encodedLength, out string buffer)
Parameters
Type | Name | Description |
---|---|---|
System.String | encodedBuffer | |
System.UInt32 | encodedLength | |
System.String | buffer |
debugserver_encode_string(String, out IntPtr, ref UInt32)
Encodes a string into hex notation.
Declaration
public static void debugserver_encode_string(string buffer, out IntPtr encodedBuffer, ref uint encodedLength)
Parameters
Type | Name | Description |
---|---|---|
System.String | buffer | String to encode into hex notiation |
System.IntPtr | encodedBuffer | |
System.UInt32 | encodedLength |
debugserver_encode_string(String, out String, ref UInt32)
Declaration
public static void debugserver_encode_string(string buffer, out string encodedBuffer, ref uint encodedLength)
Parameters
Type | Name | Description |
---|---|---|
System.String | buffer | |
System.String | encodedBuffer | |
System.UInt32 | encodedLength |