diff options
27 files changed, 267 insertions, 343 deletions
diff --git a/include/libimobiledevice/afc.h b/include/libimobiledevice/afc.h index b045554..7637db5 100644 --- a/include/libimobiledevice/afc.h +++ b/include/libimobiledevice/afc.h @@ -33,41 +33,38 @@ extern "C" { #define AFC_SERVICE_NAME "com.apple.afc" -/** @name Error Codes */ -/*@{*/ -#define AFC_E_SUCCESS 0 -#define AFC_E_UNKNOWN_ERROR 1 -#define AFC_E_OP_HEADER_INVALID 2 -#define AFC_E_NO_RESOURCES 3 -#define AFC_E_READ_ERROR 4 -#define AFC_E_WRITE_ERROR 5 -#define AFC_E_UNKNOWN_PACKET_TYPE 6 -#define AFC_E_INVALID_ARG 7 -#define AFC_E_OBJECT_NOT_FOUND 8 -#define AFC_E_OBJECT_IS_DIR 9 -#define AFC_E_PERM_DENIED 10 -#define AFC_E_SERVICE_NOT_CONNECTED 11 -#define AFC_E_OP_TIMEOUT 12 -#define AFC_E_TOO_MUCH_DATA 13 -#define AFC_E_END_OF_DATA 14 -#define AFC_E_OP_NOT_SUPPORTED 15 -#define AFC_E_OBJECT_EXISTS 16 -#define AFC_E_OBJECT_BUSY 17 -#define AFC_E_NO_SPACE_LEFT 18 -#define AFC_E_OP_WOULD_BLOCK 19 -#define AFC_E_IO_ERROR 20 -#define AFC_E_OP_INTERRUPTED 21 -#define AFC_E_OP_IN_PROGRESS 22 -#define AFC_E_INTERNAL_ERROR 23 - -#define AFC_E_MUX_ERROR 30 -#define AFC_E_NO_MEM 31 -#define AFC_E_NOT_ENOUGH_DATA 32 -#define AFC_E_DIR_NOT_EMPTY 33 -/*@}*/ - -/** Represents an error code. */ -typedef int16_t afc_error_t; +/** Error Codes */ +typedef enum { + AFC_E_SUCCESS = 0, + AFC_E_UNKNOWN_ERROR = 1, + AFC_E_OP_HEADER_INVALID = 2, + AFC_E_NO_RESOURCES = 3, + AFC_E_READ_ERROR = 4, + AFC_E_WRITE_ERROR = 5, + AFC_E_UNKNOWN_PACKET_TYPE = 6, + AFC_E_INVALID_ARG = 7, + AFC_E_OBJECT_NOT_FOUND = 8, + AFC_E_OBJECT_IS_DIR = 9, + AFC_E_PERM_DENIED = 10, + AFC_E_SERVICE_NOT_CONNECTED = 11, + AFC_E_OP_TIMEOUT = 12, + AFC_E_TOO_MUCH_DATA = 13, + AFC_E_END_OF_DATA = 14, + AFC_E_OP_NOT_SUPPORTED = 15, + AFC_E_OBJECT_EXISTS = 16, + AFC_E_OBJECT_BUSY = 17, + AFC_E_NO_SPACE_LEFT = 18, + AFC_E_OP_WOULD_BLOCK = 19, + AFC_E_IO_ERROR = 20, + AFC_E_OP_INTERRUPTED = 21, + AFC_E_OP_IN_PROGRESS = 22, + AFC_E_INTERNAL_ERROR = 23, + AFC_E_MUX_ERROR = 30, + AFC_E_NO_MEM = 31, + AFC_E_NOT_ENOUGH_DATA = 32, + AFC_E_DIR_NOT_EMPTY = 33, + AFC_E_FORCE_SIGNED_TYPE = -1 +} afc_error_t; /** Flags for afc_file_open */ typedef enum { diff --git a/include/libimobiledevice/debugserver.h b/include/libimobiledevice/debugserver.h index aa62746..3b1969a 100644 --- a/include/libimobiledevice/debugserver.h +++ b/include/libimobiledevice/debugserver.h @@ -32,18 +32,15 @@ extern "C" { #define DEBUGSERVER_SERVICE_NAME "com.apple.debugserver" -/** @name Error Codes */ -/*@{*/ -#define DEBUGSERVER_E_SUCCESS 0 -#define DEBUGSERVER_E_INVALID_ARG -1 -#define DEBUGSERVER_E_MUX_ERROR -2 -#define DEBUGSERVER_E_SSL_ERROR -3 -#define DEBUGSERVER_E_RESPONSE_ERROR -4 -#define DEBUGSERVER_E_UNKNOWN_ERROR -256 -/*@}*/ - -/** Represents an error code. */ -typedef int16_t debugserver_error_t; +/** Error Codes */ +typedef enum { + DEBUGSERVER_E_SUCCESS = 0, + DEBUGSERVER_E_INVALID_ARG = -1, + DEBUGSERVER_E_MUX_ERROR = -2, + DEBUGSERVER_E_SSL_ERROR = -3, + DEBUGSERVER_E_RESPONSE_ERROR = -4, + DEBUGSERVER_E_UNKNOWN_ERROR = -256 +} debugserver_error_t; typedef struct debugserver_client_private debugserver_client_private; typedef debugserver_client_private *debugserver_client_t; /**< The client handle. */ diff --git a/include/libimobiledevice/diagnostics_relay.h b/include/libimobiledevice/diagnostics_relay.h index b25750b..5162657 100644 --- a/include/libimobiledevice/diagnostics_relay.h +++ b/include/libimobiledevice/diagnostics_relay.h @@ -32,16 +32,15 @@ extern "C" { #define DIAGNOSTICS_RELAY_SERVICE_NAME "com.apple.mobile.diagnostics_relay" -/** @name Error Codes */ -/*@{*/ -#define DIAGNOSTICS_RELAY_E_SUCCESS 0 -#define DIAGNOSTICS_RELAY_E_INVALID_ARG -1 -#define DIAGNOSTICS_RELAY_E_PLIST_ERROR -2 -#define DIAGNOSTICS_RELAY_E_MUX_ERROR -3 -#define DIAGNOSTICS_RELAY_E_UNKNOWN_REQUEST -4 - -#define DIAGNOSTICS_RELAY_E_UNKNOWN_ERROR -256 -/*@}*/ +/** Error Codes */ +typedef enum { + DIAGNOSTICS_RELAY_E_SUCCESS = 0, + DIAGNOSTICS_RELAY_E_INVALID_ARG = -1, + DIAGNOSTICS_RELAY_E_PLIST_ERROR = -2, + DIAGNOSTICS_RELAY_E_MUX_ERROR = -3, + DIAGNOSTICS_RELAY_E_UNKNOWN_REQUEST = -4, + DIAGNOSTICS_RELAY_E_UNKNOWN_ERROR = -256 +} diagnostics_relay_error_t; #define DIAGNOSTICS_RELAY_ACTION_FLAG_WAIT_FOR_DISCONNECT (1 << 1) #define DIAGNOSTICS_RELAY_ACTION_FLAG_DISPLAY_PASS (1 << 2) @@ -52,9 +51,6 @@ extern "C" { #define DIAGNOSTICS_RELAY_REQUEST_TYPE_GAS_GAUGE "GasGauge" #define DIAGNOSTICS_RELAY_REQUEST_TYPE_NAND "NAND" -/** Represents an error code. */ -typedef int16_t diagnostics_relay_error_t; - typedef struct diagnostics_relay_client_private diagnostics_relay_client_private; typedef diagnostics_relay_client_private *diagnostics_relay_client_t; /**< The client handle. */ diff --git a/include/libimobiledevice/file_relay.h b/include/libimobiledevice/file_relay.h index 95aba6b..c0ab25c 100644 --- a/include/libimobiledevice/file_relay.h +++ b/include/libimobiledevice/file_relay.h @@ -32,21 +32,17 @@ extern "C" { #define FILE_RELAY_SERVICE_NAME "com.apple.mobile.file_relay" -/** @name Error Codes */ -/*@{*/ -#define FILE_RELAY_E_SUCCESS 0 -#define FILE_RELAY_E_INVALID_ARG -1 -#define FILE_RELAY_E_PLIST_ERROR -2 -#define FILE_RELAY_E_MUX_ERROR -3 -#define FILE_RELAY_E_INVALID_SOURCE -4 -#define FILE_RELAY_E_STAGING_EMPTY -5 -#define FILE_RELAY_E_PERMISSION_DENIED -6 - -#define FILE_RELAY_E_UNKNOWN_ERROR -256 -/*@}*/ - -/** Represents an error code. */ -typedef int16_t file_relay_error_t; +/** Error Codes */ +typedef enum { + FILE_RELAY_E_SUCCESS = 0, + FILE_RELAY_E_INVALID_ARG = -1, + FILE_RELAY_E_PLIST_ERROR = -2, + FILE_RELAY_E_MUX_ERROR = -3, + FILE_RELAY_E_INVALID_SOURCE = -4, + FILE_RELAY_E_STAGING_EMPTY = -5, + FILE_RELAY_E_PERMISSION_DENIED = -6, + FILE_RELAY_E_UNKNOWN_ERROR = -256 +} file_relay_error_t; typedef struct file_relay_client_private file_relay_client_private; typedef file_relay_client_private *file_relay_client_t; /**< The client handle. */ diff --git a/include/libimobiledevice/heartbeat.h b/include/libimobiledevice/heartbeat.h index c943e51..7d8be39 100644 --- a/include/libimobiledevice/heartbeat.h +++ b/include/libimobiledevice/heartbeat.h @@ -32,18 +32,15 @@ extern "C" { #define HEARTBEAT_SERVICE_NAME "com.apple.mobile.heartbeat" -/** @name Error Codes */ -/*@{*/ -#define HEARTBEAT_E_SUCCESS 0 -#define HEARTBEAT_E_INVALID_ARG -1 -#define HEARTBEAT_E_PLIST_ERROR -2 -#define HEARTBEAT_E_MUX_ERROR -3 -#define HEARTBEAT_E_SSL_ERROR -4 -#define HEARTBEAT_E_UNKNOWN_ERROR -256 -/*@}*/ - -/** Represents an error code. */ -typedef int16_t heartbeat_error_t; +/** Error Codes */ +typedef enum { + HEARTBEAT_E_SUCCESS = 0, + HEARTBEAT_E_INVALID_ARG = -1, + HEARTBEAT_E_PLIST_ERROR = -2, + HEARTBEAT_E_MUX_ERROR = -3, + HEARTBEAT_E_SSL_ERROR = -4, + HEARTBEAT_E_UNKNOWN_ERROR = -256 +} heartbeat_error_t; typedef struct heartbeat_client_private heartbeat_client_private; typedef heartbeat_client_private *heartbeat_client_t; /**< The client handle. */ diff --git a/include/libimobiledevice/house_arrest.h b/include/libimobiledevice/house_arrest.h index 170cad2..9b7ff91 100644 --- a/include/libimobiledevice/house_arrest.h +++ b/include/libimobiledevice/house_arrest.h @@ -33,19 +33,15 @@ extern "C" { #define HOUSE_ARREST_SERVICE_NAME "com.apple.mobile.house_arrest" -/** @name Error Codes */ -/*@{*/ -#define HOUSE_ARREST_E_SUCCESS 0 -#define HOUSE_ARREST_E_INVALID_ARG -1 -#define HOUSE_ARREST_E_PLIST_ERROR -2 -#define HOUSE_ARREST_E_CONN_FAILED -3 -#define HOUSE_ARREST_E_INVALID_MODE -4 - -#define HOUSE_ARREST_E_UNKNOWN_ERROR -256 -/*@}*/ - -/** Represents an error code. */ -typedef int16_t house_arrest_error_t; +/** Error Codes */ +typedef enum { + HOUSE_ARREST_E_SUCCESS = 0, + HOUSE_ARREST_E_INVALID_ARG = -1, + HOUSE_ARREST_E_PLIST_ERROR = -2, + HOUSE_ARREST_E_CONN_FAILED = -3, + HOUSE_ARREST_E_INVALID_MODE = -4, + HOUSE_ARREST_E_UNKNOWN_ERROR = -256 +} house_arrest_error_t; typedef struct house_arrest_client_private house_arrest_client_private; typedef house_arrest_client_private *house_arrest_client_t; /**< The client handle. */ diff --git a/include/libimobiledevice/installation_proxy.h b/include/libimobiledevice/installation_proxy.h index 4740b20..f76ee68 100644 --- a/include/libimobiledevice/installation_proxy.h +++ b/include/libimobiledevice/installation_proxy.h @@ -32,21 +32,17 @@ extern "C" { #define INSTPROXY_SERVICE_NAME "com.apple.mobile.installation_proxy" -/** @name Error Codes */ -/*@{*/ -#define INSTPROXY_E_SUCCESS 0 -#define INSTPROXY_E_INVALID_ARG -1 -#define INSTPROXY_E_PLIST_ERROR -2 -#define INSTPROXY_E_CONN_FAILED -3 -#define INSTPROXY_E_OP_IN_PROGRESS -4 -#define INSTPROXY_E_OP_FAILED -5 -#define INSTPROXY_E_RECEIVE_TIMEOUT -6 - -#define INSTPROXY_E_UNKNOWN_ERROR -256 -/*@}*/ - -/** Represents an error code. */ -typedef int16_t instproxy_error_t; +/** Error Codes */ +typedef enum { + INSTPROXY_E_SUCCESS = 0, + INSTPROXY_E_INVALID_ARG = -1, + INSTPROXY_E_PLIST_ERROR = -2, + INSTPROXY_E_CONN_FAILED = -3, + INSTPROXY_E_OP_IN_PROGRESS = -4, + INSTPROXY_E_OP_FAILED = -5, + INSTPROXY_E_RECEIVE_TIMEOUT = -6, + INSTPROXY_E_UNKNOWN_ERROR = -256 +} instproxy_error_t; typedef struct instproxy_client_private instproxy_client_private; typedef instproxy_client_private *instproxy_client_t; /**< The client handle. */ diff --git a/include/libimobiledevice/libimobiledevice.h b/include/libimobiledevice/libimobiledevice.h index 3cbb96b..c91ec83 100644 --- a/include/libimobiledevice/libimobiledevice.h +++ b/include/libimobiledevice/libimobiledevice.h @@ -32,19 +32,16 @@ extern "C" { #include <sys/stat.h> #include <plist/plist.h> -/** @name Error Codes */ -/*@{*/ -#define IDEVICE_E_SUCCESS 0 -#define IDEVICE_E_INVALID_ARG -1 -#define IDEVICE_E_UNKNOWN_ERROR -2 -#define IDEVICE_E_NO_DEVICE -3 -#define IDEVICE_E_NOT_ENOUGH_DATA -4 -#define IDEVICE_E_BAD_HEADER -5 -#define IDEVICE_E_SSL_ERROR -6 -/*@}*/ - -/** Represents an error code. */ -typedef int16_t idevice_error_t; +/** Error Codes */ +typedef enum { + IDEVICE_E_SUCCESS = 0, + IDEVICE_E_INVALID_ARG = -1, + IDEVICE_E_UNKNOWN_ERROR = -2, + IDEVICE_E_NO_DEVICE = -3, + IDEVICE_E_NOT_ENOUGH_DATA = -4, + IDEVICE_E_BAD_HEADER = -5, + IDEVICE_E_SSL_ERROR = -6 +} idevice_error_t; typedef struct idevice_private idevice_private; typedef idevice_private *idevice_t; /**< The device handle. */ diff --git a/include/libimobiledevice/lockdown.h b/include/libimobiledevice/lockdown.h index 3a088c1..beb07d3 100644 --- a/include/libimobiledevice/lockdown.h +++ b/include/libimobiledevice/lockdown.h @@ -31,35 +31,31 @@ extern "C" { #include <libimobiledevice/libimobiledevice.h> #include <libimobiledevice/lockdown.h> -/** @name Error Codes */ -/*@{*/ -#define LOCKDOWN_E_SUCCESS 0 -#define LOCKDOWN_E_INVALID_ARG -1 -#define LOCKDOWN_E_INVALID_CONF -2 -#define LOCKDOWN_E_PLIST_ERROR -3 -#define LOCKDOWN_E_PAIRING_FAILED -4 -#define LOCKDOWN_E_SSL_ERROR -5 -#define LOCKDOWN_E_DICT_ERROR -6 -#define LOCKDOWN_E_START_SERVICE_FAILED -7 -#define LOCKDOWN_E_NOT_ENOUGH_DATA -8 -#define LOCKDOWN_E_SET_VALUE_PROHIBITED -9 -#define LOCKDOWN_E_GET_VALUE_PROHIBITED -10 -#define LOCKDOWN_E_REMOVE_VALUE_PROHIBITED -11 -#define LOCKDOWN_E_MUX_ERROR -12 -#define LOCKDOWN_E_ACTIVATION_FAILED -13 -#define LOCKDOWN_E_PASSWORD_PROTECTED -14 -#define LOCKDOWN_E_NO_RUNNING_SESSION -15 -#define LOCKDOWN_E_INVALID_HOST_ID -16 -#define LOCKDOWN_E_INVALID_SERVICE -17 -#define LOCKDOWN_E_INVALID_ACTIVATION_RECORD -18 -#define LOCKDOWN_E_PAIRING_DIALOG_PENDING -20 -#define LOCKDOWN_E_USER_DENIED_PAIRING -21 - -#define LOCKDOWN_E_UNKNOWN_ERROR -256 -/*@}*/ - -/** Represents an error code. */ -typedef int16_t lockdownd_error_t; +/** Error Codes */ +typedef enum { + LOCKDOWN_E_SUCCESS = 0, + LOCKDOWN_E_INVALID_ARG = -1, + LOCKDOWN_E_INVALID_CONF = -2, + LOCKDOWN_E_PLIST_ERROR = -3, + LOCKDOWN_E_PAIRING_FAILED = -4, + LOCKDOWN_E_SSL_ERROR = -5, + LOCKDOWN_E_DICT_ERROR = -6, + LOCKDOWN_E_START_SERVICE_FAILED = -7, + LOCKDOWN_E_NOT_ENOUGH_DATA = -8, + LOCKDOWN_E_SET_VALUE_PROHIBITED = -9, + LOCKDOWN_E_GET_VALUE_PROHIBITED = -10, + LOCKDOWN_E_REMOVE_VALUE_PROHIBITED = -11, + LOCKDOWN_E_MUX_ERROR = -12, + LOCKDOWN_E_ACTIVATION_FAILED = -13, + LOCKDOWN_E_PASSWORD_PROTECTED = -14, + LOCKDOWN_E_NO_RUNNING_SESSION = -15, + LOCKDOWN_E_INVALID_HOST_ID = -16, + LOCKDOWN_E_INVALID_SERVICE = -17, + LOCKDOWN_E_INVALID_ACTIVATION_RECORD = -18, + LOCKDOWN_E_PAIRING_DIALOG_PENDING = -20, + LOCKDOWN_E_USER_DENIED_PAIRING = -21, + LOCKDOWN_E_UNKNOWN_ERROR = -256 +} lockdownd_error_t; typedef struct lockdownd_client_private lockdownd_client_private; typedef lockdownd_client_private *lockdownd_client_t; /**< The client handle. */ diff --git a/include/libimobiledevice/misagent.h b/include/libimobiledevice/misagent.h index 7bb7333..28d55e8 100644 --- a/include/libimobiledevice/misagent.h +++ b/include/libimobiledevice/misagent.h @@ -32,19 +32,15 @@ extern "C" { #define MISAGENT_SERVICE_NAME "com.apple.misagent" -/** @name Error Codes */ -/*@{*/ -#define MISAGENT_E_SUCCESS 0 -#define MISAGENT_E_INVALID_ARG -1 -#define MISAGENT_E_PLIST_ERROR -2 -#define MISAGENT_E_CONN_FAILED -3 -#define MISAGENT_E_REQUEST_FAILED -4 - -#define MISAGENT_E_UNKNOWN_ERROR -256 -/*@}*/ - -/** Represents an error code. */ -typedef int16_t misagent_error_t; +/** Error Codes */ +typedef enum { + MISAGENT_E_SUCCESS = 0, + MISAGENT_E_INVALID_ARG = -1, + MISAGENT_E_PLIST_ERROR = -2, + MISAGENT_E_CONN_FAILED = -3, + MISAGENT_E_REQUEST_FAILED = -4, + MISAGENT_E_UNKNOWN_ERROR = -256 +} misagent_error_t; typedef struct misagent_client_private misagent_client_private; typedef misagent_client_private *misagent_client_t; /**< The client handle. */ diff --git a/include/libimobiledevice/mobile_image_mounter.h b/include/libimobiledevice/mobile_image_mounter.h index 7fe2c2a..43a2d9c 100644 --- a/include/libimobiledevice/mobile_image_mounter.h +++ b/include/libimobiledevice/mobile_image_mounter.h @@ -32,19 +32,15 @@ extern "C" { #define MOBILE_IMAGE_MOUNTER_SERVICE_NAME "com.apple.mobile.mobile_image_mounter" -/** @name Error Codes */ -/*@{*/ -#define MOBILE_IMAGE_MOUNTER_E_SUCCESS 0 -#define MOBILE_IMAGE_MOUNTER_E_INVALID_ARG -1 -#define MOBILE_IMAGE_MOUNTER_E_PLIST_ERROR -2 -#define MOBILE_IMAGE_MOUNTER_E_CONN_FAILED -3 -#define MOBILE_IMAGE_MOUNTER_E_COMMAND_FAILED -4 - -#define MOBILE_IMAGE_MOUNTER_E_UNKNOWN_ERROR -256 -/*@}*/ - -/** Represents an error code. */ -typedef int16_t mobile_image_mounter_error_t; +/** Error Codes */ +typedef enum { + MOBILE_IMAGE_MOUNTER_E_SUCCESS = 0, + MOBILE_IMAGE_MOUNTER_E_INVALID_ARG = -1, + MOBILE_IMAGE_MOUNTER_E_PLIST_ERROR = -2, + MOBILE_IMAGE_MOUNTER_E_CONN_FAILED = -3, + MOBILE_IMAGE_MOUNTER_E_COMMAND_FAILED = -4, + MOBILE_IMAGE_MOUNTER_E_UNKNOWN_ERROR = -256 +} mobile_image_mounter_error_t; typedef struct mobile_image_mounter_client_private mobile_image_mounter_client_private; typedef mobile_image_mounter_client_private *mobile_image_mounter_client_t; /**< The client handle. */ diff --git a/include/libimobiledevice/mobilebackup.h b/include/libimobiledevice/mobilebackup.h index c07ba68..77acadb 100644 --- a/include/libimobiledevice/mobilebackup.h +++ b/include/libimobiledevice/mobilebackup.h @@ -32,20 +32,16 @@ extern "C" { #define MOBILEBACKUP_SERVICE_NAME "com.apple.mobilebackup" -/** @name Error Codes */ -/*@{*/ -#define MOBILEBACKUP_E_SUCCESS 0 -#define MOBILEBACKUP_E_INVALID_ARG -1 -#define MOBILEBACKUP_E_PLIST_ERROR -2 -#define MOBILEBACKUP_E_MUX_ERROR -3 -#define MOBILEBACKUP_E_BAD_VERSION -4 -#define MOBILEBACKUP_E_REPLY_NOT_OK -5 - -#define MOBILEBACKUP_E_UNKNOWN_ERROR -256 -/*@}*/ - -/** Represents an error code. */ -typedef int16_t mobilebackup_error_t; +/** Error Codes */ +typedef enum { + MOBILEBACKUP_E_SUCCESS = 0, + MOBILEBACKUP_E_INVALID_ARG = -1, + MOBILEBACKUP_E_PLIST_ERROR = -2, + MOBILEBACKUP_E_MUX_ERROR = -3, + MOBILEBACKUP_E_BAD_VERSION = -4, + MOBILEBACKUP_E_REPLY_NOT_OK = -5, + MOBILEBACKUP_E_UNKNOWN_ERROR = -256 +} mobilebackup_error_t; typedef struct mobilebackup_client_private mobilebackup_client_private; typedef mobilebackup_client_private *mobilebackup_client_t; /**< The client handle. */ @@ -56,7 +52,6 @@ typedef enum { MB_RESTORE_PRESERVE_CAMERA_ROLL = 1 << 2 } mobilebackup_flags_t; - /** * Connects to the mobilebackup service on the specified device. * diff --git a/include/libimobiledevice/mobilebackup2.h b/include/libimobiledevice/mobilebackup2.h index ad1dcea..2faa859 100644 --- a/include/libimobiledevice/mobilebackup2.h +++ b/include/libimobiledevice/mobilebackup2.h @@ -32,21 +32,17 @@ extern "C" { #define MOBILEBACKUP2_SERVICE_NAME "com.apple.mobilebackup2" -/** @name Error Codes */ -/*@{*/ -#define MOBILEBACKUP2_E_SUCCESS 0 -#define MOBILEBACKUP2_E_INVALID_ARG -1 -#define MOBILEBACKUP2_E_PLIST_ERROR -2 -#define MOBILEBACKUP2_E_MUX_ERROR -3 -#define MOBILEBACKUP2_E_BAD_VERSION -4 -#define MOBILEBACKUP2_E_REPLY_NOT_OK -5 -#define MOBILEBACKUP2_E_NO_COMMON_VERSION -6 - -#define MOBILEBACKUP2_E_UNKNOWN_ERROR -256 -/*@}*/ - -/** Represents an error code. */ -typedef int16_t mobilebackup2_error_t; +/** Error Codes */ +typedef enum { + MOBILEBACKUP2_E_SUCCESS = 0, + MOBILEBACKUP2_E_INVALID_ARG = -1, + MOBILEBACKUP2_E_PLIST_ERROR = -2, + MOBILEBACKUP2_E_MUX_ERROR = -3, + MOBILEBACKUP2_E_BAD_VERSION = -4, + MOBILEBACKUP2_E_REPLY_NOT_OK = -5, + MOBILEBACKUP2_E_NO_COMMON_VERSION = -6, + MOBILEBACKUP2_E_UNKNOWN_ERROR = -256 +} mobilebackup2_error_t; typedef struct mobilebackup2_client_private mobilebackup2_client_private; typedef mobilebackup2_client_private *mobilebackup2_client_t; /**< The client handle. */ diff --git a/include/libimobiledevice/mobilesync.h b/include/libimobiledevice/mobilesync.h index 6ba197b..3c0d576 100644 --- a/include/libimobiledevice/mobilesync.h +++ b/include/libimobiledevice/mobilesync.h @@ -33,20 +33,19 @@ extern "C" { #define MOBILESYNC_SERVICE_NAME "com.apple.mobilesync" -/** @name Error Codes */ -/*@{*/ -#define MOBILESYNC_E_SUCCESS 0 -#define MOBILESYNC_E_INVALID_ARG -1 -#define MOBILESYNC_E_PLIST_ERROR -2 -#define MOBILESYNC_E_MUX_ERROR -3 -#define MOBILESYNC_E_BAD_VERSION -4 -#define MOBILESYNC_E_SYNC_REFUSED -5 -#define MOBILESYNC_E_CANCELLED -6 -#define MOBILESYNC_E_WRONG_DIRECTION -7 -#define MOBILESYNC_E_NOT_READY -8 - -#define MOBILESYNC_E_UNKNOWN_ERROR -256 -/*@}*/ +/** Error Codes */ +typedef enum { + MOBILESYNC_E_SUCCESS = 0, + MOBILESYNC_E_INVALID_ARG = -1, + MOBILESYNC_E_PLIST_ERROR = -2, + MOBILESYNC_E_MUX_ERROR = -3, + MOBILESYNC_E_BAD_VERSION = -4, + MOBILESYNC_E_SYNC_REFUSED = -5, + MOBILESYNC_E_CANCELLED = -6, + MOBILESYNC_E_WRONG_DIRECTION = -7, + MOBILESYNC_E_NOT_READY = -8, + MOBILESYNC_E_UNKNOWN_ERROR = -256 +} mobilesync_error_t; /** The sync type of the current sync session. */ typedef enum { @@ -55,9 +54,6 @@ typedef enum { MOBILESYNC_SYNC_TYPE_RESET /**< Reset-sync signals that the computer should send all data again. */ } mobilesync_sync_type_t; -/** Represents an error code. */ -typedef int16_t mobilesync_error_t; - typedef struct mobilesync_client_private mobilesync_client_private; typedef mobilesync_client_private *mobilesync_client_t; /**< The client handle */ diff --git a/include/libimobiledevice/notification_proxy.h b/include/libimobiledevice/notification_proxy.h index a66057b..275be74 100644 --- a/include/libimobiledevice/notification_proxy.h +++ b/include/libimobiledevice/notification_proxy.h @@ -32,18 +32,14 @@ extern "C" { #define NP_SERVICE_NAME "com.apple.mobile.notification_proxy" -/** @name Error Codes */ -/*@{*/ -#define NP_E_SUCCESS 0 -#define NP_E_INVALID_ARG -1 -#define NP_E_PLIST_ERROR -2 -#define NP_E_CONN_FAILED -3 - -#define NP_E_UNKNOWN_ERROR -256 -/*@}*/ - -/** Represents an error code. */ -typedef int16_t np_error_t; +/** Error Codes */ +typedef enum { + NP_E_SUCCESS = 0, + NP_E_INVALID_ARG = -1, + NP_E_PLIST_ERROR = -2, + NP_E_CONN_FAILED = -3, + NP_E_UNKNOWN_ERROR = -256 +} np_error_t; /** * @name Notifications that can be send diff --git a/include/libimobiledevice/property_list_service.h b/include/libimobiledevice/property_list_service.h index 4a004ba..dd16b86 100644 --- a/include/libimobiledevice/property_list_service.h +++ b/include/libimobiledevice/property_list_service.h @@ -29,18 +29,15 @@ extern "C" { #include <libimobiledevice/lockdown.h> /* Error Codes */ -/*@{*/ -#define PROPERTY_LIST_SERVICE_E_SUCCESS 0 -#define PROPERTY_LIST_SERVICE_E_INVALID_ARG -1 -#define PROPERTY_LIST_SERVICE_E_PLIST_ERROR -2 -#define PROPERTY_LIST_SERVICE_E_MUX_ERROR -3 -#define PROPERTY_LIST_SERVICE_E_SSL_ERROR -4 -#define PROPERTY_LIST_SERVICE_E_RECEIVE_TIMEOUT -5 -#define PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR -256 -/*@}*/ - -/** Represents an error code */ -typedef int16_t property_list_service_error_t; +typedef enum { + PROPERTY_LIST_SERVICE_E_SUCCESS = 0, + PROPERTY_LIST_SERVICE_E_INVALID_ARG = -1, + PROPERTY_LIST_SERVICE_E_PLIST_ERROR = -2, + PROPERTY_LIST_SERVICE_E_MUX_ERROR = -3, + PROPERTY_LIST_SERVICE_E_SSL_ERROR = -4, + PROPERTY_LIST_SERVICE_E_RECEIVE_TIMEOUT = -5, + PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR = -256 +} property_list_service_error_t; typedef struct property_list_service_client_private property_list_service_private; typedef property_list_service_private* property_list_service_client_t; /**< The client handle. */ diff --git a/include/libimobiledevice/restore.h b/include/libimobiledevice/restore.h index 63f8915..9373249 100644 --- a/include/libimobiledevice/restore.h +++ b/include/libimobiledevice/restore.h @@ -30,22 +30,19 @@ extern "C" { #include <libimobiledevice/libimobiledevice.h> -/** @name Error Codes */ -/*@{*/ -#define RESTORE_E_SUCCESS 0 -#define RESTORE_E_INVALID_ARG -1 -#define RESTORE_E_INVALID_CONF -2 -#define RESTORE_E_PLIST_ERROR -3 -#define RESTORE_E_DICT_ERROR -4 -#define RESTORE_E_NOT_ENOUGH_DATA -5 -#define RESTORE_E_MUX_ERROR -6 -#define RESTORE_E_START_RESTORE_FAILED -7 - -#define RESTORE_E_UNKNOWN_ERROR -256 -/*@}*/ - -/** Represents an error code. */ -typedef int16_t restored_error_t; +/** Error Codes */ +typedef enum { + RESTORE_E_SUCCESS = 0, + RESTORE_E_INVALID_ARG = -1, + RESTORE_E_INVALID_CONF = -2, + RESTORE_E_PLIST_ERROR = -3, + RESTORE_E_DICT_ERROR = -4, + RESTORE_E_NOT_ENOUGH_DATA = -5, + RESTORE_E_MUX_ERROR = -6, + RESTORE_E_START_RESTORE_FAILED = -7, + RESTORE_E_DEVICE_ERROR = -8, + RESTORE_E_UNKNOWN_ERROR = -256 +} restored_error_t; typedef struct restored_client_private restored_client_private; typedef restored_client_private *restored_client_t; /**< The client handle. */ diff --git a/include/libimobiledevice/sbservices.h b/include/libimobiledevice/sbservices.h index f0bf2c4..f4f8dde 100644 --- a/include/libimobiledevice/sbservices.h +++ b/include/libimobiledevice/sbservices.h @@ -32,15 +32,14 @@ extern "C" { #define SBSERVICES_SERVICE_NAME "com.apple.springboardservices" -/** @name Error Codes */ -/*@{*/ -#define SBSERVICES_E_SUCCESS 0 -#define SBSERVICES_E_INVALID_ARG -1 -#define SBSERVICES_E_PLIST_ERROR -2 -#define SBSERVICES_E_CONN_FAILED -3 - -#define SBSERVICES_E_UNKNOWN_ERROR -256 -/*@}*/ +/** Error Codes */ +typedef enum { + SBSERVICES_E_SUCCESS = 0, + SBSERVICES_E_INVALID_ARG = -1, + SBSERVICES_E_PLIST_ERROR = -2, + SBSERVICES_E_CONN_FAILED = -3, + SBSERVICES_E_UNKNOWN_ERROR = -256 +} sbservices_error_t; /** @name Orientation of the user interface on the device */ /*@{*/ @@ -53,9 +52,6 @@ typedef enum { } sbservices_interface_orientation_t; /*@}*/ -/** Represents an error code. */ -typedef int16_t sbservices_error_t; - typedef struct sbservices_client_private sbservices_client_private; typedef sbservices_client_private *sbservices_client_t; /**< The client handle. */ diff --git a/include/libimobiledevice/screenshotr.h b/include/libimobiledevice/screenshotr.h index 3601172..70cb2d2 100644 --- a/include/libimobiledevice/screenshotr.h +++ b/include/libimobiledevice/screenshotr.h @@ -33,19 +33,15 @@ extern "C" { #define SCREENSHOTR_SERVICE_NAME "com.apple.mobile.screenshotr" -/** @name Error Codes */ -/*@{*/ -#define SCREENSHOTR_E_SUCCESS 0 -#define SCREENSHOTR_E_INVALID_ARG -1 -#define SCREENSHOTR_E_PLIST_ERROR -2 -#define SCREENSHOTR_E_MUX_ERROR -3 -#define SCREENSHOTR_E_BAD_VERSION -4 - -#define SCREENSHOTR_E_UNKNOWN_ERROR -256 -/*@}*/ - -/** Represents an error code. */ -typedef int16_t screenshotr_error_t; +/** Error Codes */ +typedef enum { + SCREENSHOTR_E_SUCCESS = 0, + SCREENSHOTR_E_INVALID_ARG = -1, + SCREENSHOTR_E_PLIST_ERROR = -2, + SCREENSHOTR_E_MUX_ERROR = -3, + SCREENSHOTR_E_BAD_VERSION = -4, + SCREENSHOTR_E_UNKNOWN_ERROR = -256 +} screenshotr_error_t; typedef struct screenshotr_client_private screenshotr_client_private; typedef screenshotr_client_private *screenshotr_client_t; /**< The client handle. */ diff --git a/include/libimobiledevice/service.h b/include/libimobiledevice/service.h index acf846b..760dbb4 100644 --- a/include/libimobiledevice/service.h +++ b/include/libimobiledevice/service.h @@ -30,23 +30,20 @@ extern "C" { #include <libimobiledevice/libimobiledevice.h> #include <libimobiledevice/lockdown.h> -/** @name Error Codes */ -/*@{*/ -#define SERVICE_E_SUCCESS 0 -#define SERVICE_E_INVALID_ARG -1 -#define SERVICE_E_MUX_ERROR -3 -#define SERVICE_E_SSL_ERROR -4 -#define SERVICE_E_START_SERVICE_ERROR -5 -#define SERVICE_E_UNKNOWN_ERROR -256 -/*@}*/ - -/** Represents an error code. */ -typedef int16_t service_error_t; +/** Error Codes */ +typedef enum { + SERVICE_E_SUCCESS = 0, + SERVICE_E_INVALID_ARG = -1, + SERVICE_E_MUX_ERROR = -3, + SERVICE_E_SSL_ERROR = -4, + SERVICE_E_START_SERVICE_ERROR = -5, + SERVICE_E_UNKNOWN_ERROR = -256 +} service_error_t; typedef struct service_client_private service_client_private; typedef service_client_private* service_client_t; /**< The client handle. */ -#define SERVICE_CONSTRUCTOR(x) (int16_t (*)(idevice_t, lockdownd_service_descriptor_t, void**))(x) +#define SERVICE_CONSTRUCTOR(x) (int32_t (*)(idevice_t, lockdownd_service_descriptor_t, void**))(x) /* Interface */ @@ -79,7 +76,7 @@ service_error_t service_client_new(idevice_t device, lockdownd_service_descripto * @return SERVICE_E_SUCCESS on success, or a SERVICE_E_* error code * otherwise. */ -service_error_t service_client_factory_start_service(idevice_t device, const char* service_name, void **client, const char* label, int16_t (*constructor_func)(idevice_t, lockdownd_service_descriptor_t, void**), int16_t *error_code); +service_error_t service_client_factory_start_service(idevice_t device, const char* service_name, void **client, const char* label, int32_t (*constructor_func)(idevice_t, lockdownd_service_descriptor_t, void**), int32_t *error_code); /** * Frees a service instance. diff --git a/include/libimobiledevice/syslog_relay.h b/include/libimobiledevice/syslog_relay.h index 952840e..1b9c4f1 100644 --- a/include/libimobiledevice/syslog_relay.h +++ b/include/libimobiledevice/syslog_relay.h @@ -32,17 +32,14 @@ extern "C" { #define SYSLOG_RELAY_SERVICE_NAME "com.apple.syslog_relay" -/** @name Error Codes */ -/*@{*/ -#define SYSLOG_RELAY_E_SUCCESS 0 -#define SYSLOG_RELAY_E_INVALID_ARG -1 -#define SYSLOG_RELAY_E_MUX_ERROR -2 -#define SYSLOG_RELAY_E_SSL_ERROR -3 -#define SYSLOG_RELAY_E_UNKNOWN_ERROR -256 -/*@}*/ - -/** Represents an error code. */ -typedef int16_t syslog_relay_error_t; +/** Error Codes */ +typedef enum { + SYSLOG_RELAY_E_SUCCESS = 0, + SYSLOG_RELAY_E_INVALID_ARG = -1, + SYSLOG_RELAY_E_MUX_ERROR = -2, + SYSLOG_RELAY_E_SSL_ERROR = -3, + SYSLOG_RELAY_E_UNKNOWN_ERROR = -256 +} syslog_relay_error_t; typedef struct syslog_relay_client_private syslog_relay_client_private; typedef syslog_relay_client_private *syslog_relay_client_t; /**< The client handle. */ diff --git a/include/libimobiledevice/webinspector.h b/include/libimobiledevice/webinspector.h index 499e7f0..9f0c75c 100644 --- a/include/libimobiledevice/webinspector.h +++ b/include/libimobiledevice/webinspector.h @@ -32,18 +32,15 @@ extern "C" { #define WEBINSPECTOR_SERVICE_NAME "com.apple.webinspector" -/** @name Error Codes */ -/*@{*/ -#define WEBINSPECTOR_E_SUCCESS 0 -#define WEBINSPECTOR_E_INVALID_ARG -1 -#define WEBINSPECTOR_E_PLIST_ERROR -2 -#define WEBINSPECTOR_E_MUX_ERROR -3 -#define WEBINSPECTOR_E_SSL_ERROR -4 -#define WEBINSPECTOR_E_UNKNOWN_ERROR -256 -/*@}*/ - -/** Represents an error code. */ -typedef int16_t webinspector_error_t; +/** Error Codes */ +typedef enum { + WEBINSPECTOR_E_SUCCESS = 0, + WEBINSPECTOR_E_INVALID_ARG = -1, + WEBINSPECTOR_E_PLIST_ERROR = -2, + WEBINSPECTOR_E_MUX_ERROR = -3, + WEBINSPECTOR_E_SSL_ERROR = -4, + WEBINSPECTOR_E_UNKNOWN_ERROR = -256 +} webinspector_error_t; typedef struct webinspector_client_private webinspector_client_private; typedef webinspector_client_private *webinspector_client_t; /**< The client handle. */ diff --git a/src/diagnostics_relay.c b/src/diagnostics_relay.c index 055f60a..825678a 100644 --- a/src/diagnostics_relay.c +++ b/src/diagnostics_relay.c @@ -153,7 +153,7 @@ static diagnostics_relay_error_t diagnostics_relay_send(diagnostics_relay_client return DIAGNOSTICS_RELAY_E_INVALID_ARG; diagnostics_relay_error_t ret = DIAGNOSTICS_RELAY_E_SUCCESS; - idevice_error_t err; + property_list_service_error_t err; err = property_list_service_send_xml_plist(client->parent, plist); if (err != PROPERTY_LIST_SERVICE_E_SUCCESS) { diff --git a/src/lockdown.c b/src/lockdown.c index 8dc1644..14886c9 100644 --- a/src/lockdown.c +++ b/src/lockdown.c @@ -287,7 +287,7 @@ LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_send(lockdownd_client_t client, return LOCKDOWN_E_INVALID_ARG; lockdownd_error_t ret = LOCKDOWN_E_SUCCESS; - idevice_error_t err; + property_list_service_error_t err; err = property_list_service_send_xml_plist(client->parent, plist); if (err != PROPERTY_LIST_SERVICE_E_SUCCESS) { @@ -1031,6 +1031,7 @@ LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_goodbye(lockdownd_client_t clie LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_start_session(lockdownd_client_t client, const char *host_id, char **session_id, int *ssl_enabled) { lockdownd_error_t ret = LOCKDOWN_E_SUCCESS; + property_list_service_error_t plret; plist_t dict = NULL; if (!client || !host_id) @@ -1113,8 +1114,9 @@ LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_start_session(lockdownd_client_ debug_info("Enable SSL Session: %s", (use_ssl?"true":"false")); if (use_ssl) { - ret = property_list_service_enable_ssl(client->parent); - if (ret == PROPERTY_LIST_SERVICE_E_SUCCESS) { + plret = property_list_service_enable_ssl(client->parent); + if (plret == PROPERTY_LIST_SERVICE_E_SUCCESS) { + ret = LOCKDOWN_E_SUCCESS; client->ssl_enabled = 1; } else { ret = LOCKDOWN_E_SSL_ERROR; diff --git a/src/restore.c b/src/restore.c index 3f6be8f..4d4823f 100644 --- a/src/restore.c +++ b/src/restore.c @@ -154,7 +154,7 @@ LIBIMOBILEDEVICE_API restored_error_t restored_send(restored_client_t client, pl return RESTORE_E_INVALID_ARG; restored_error_t ret = RESTORE_E_SUCCESS; - idevice_error_t err; + property_list_service_error_t err; err = property_list_service_send_xml_plist(client->parent, plist); if (err != PROPERTY_LIST_SERVICE_E_SUCCESS) { @@ -297,6 +297,7 @@ LIBIMOBILEDEVICE_API restored_error_t restored_client_new(idevice_t device, rest return RESTORE_E_INVALID_ARG; restored_error_t ret = RESTORE_E_SUCCESS; + idevice_error_t idev_ret; static struct lockdownd_service_descriptor service = { .port = 0xf27e, @@ -317,9 +318,10 @@ LIBIMOBILEDEVICE_API restored_error_t restored_client_new(idevice_t device, rest if (label != NULL) client_loc->label = strdup(label); - ret = idevice_get_udid(device, &client_loc->udid); - if (RESTORE_E_SUCCESS != ret) { + idev_ret = idevice_get_udid(device, &client_loc->udid); + if (IDEVICE_E_SUCCESS != idev_ret) { debug_info("failed to get device udid."); + ret = RESTORE_E_DEVICE_ERROR; } debug_info("device udid: %s", client_loc->udid); diff --git a/src/service.c b/src/service.c index c4743dc..48959b6 100644 --- a/src/service.c +++ b/src/service.c @@ -76,7 +76,7 @@ LIBIMOBILEDEVICE_API service_error_t service_client_new(idevice_t device, lockdo return SERVICE_E_SUCCESS; } -LIBIMOBILEDEVICE_API service_error_t service_client_factory_start_service(idevice_t device, const char* service_name, void **client, const char* label, int16_t (*constructor_func)(idevice_t, lockdownd_service_descriptor_t, void**), int16_t *error_code) +LIBIMOBILEDEVICE_API service_error_t service_client_factory_start_service(idevice_t device, const char* service_name, void **client, const char* label, int32_t (*constructor_func)(idevice_t, lockdownd_service_descriptor_t, void**), int32_t *error_code) { *client = NULL; @@ -95,9 +95,9 @@ LIBIMOBILEDEVICE_API service_error_t service_client_factory_start_service(idevic return SERVICE_E_START_SERVICE_ERROR; } - int16_t ec; + int32_t ec; if (constructor_func) { - ec = (int16_t)constructor_func(device, service, client); + ec = (int32_t)constructor_func(device, service, client); } else { ec = service_client_new(device, service, (service_client_t*)client); } diff --git a/src/syslog_relay.c b/src/syslog_relay.c index 63e7d34..44006ce 100644 --- a/src/syslog_relay.c +++ b/src/syslog_relay.c @@ -139,7 +139,7 @@ LIBIMOBILEDEVICE_API syslog_relay_error_t syslog_relay_receive_with_timeout(sysl void *syslog_relay_worker(void *arg) { - service_error_t ret = SERVICE_E_UNKNOWN_ERROR; + syslog_relay_error_t ret = SYSLOG_RELAY_E_UNKNOWN_ERROR; struct syslog_relay_worker_thread *srwt = (struct syslog_relay_worker_thread*)arg; if (!srwt) |