From 4d8b89223cbc9f530cc650ab5131c09eab1af258 Mon Sep 17 00:00:00 2001 From: DanyL Date: Thu, 13 Jun 2019 02:01:04 +0300 Subject: Timeout support for SSL connections and better timeout handeling. --- include/libimobiledevice/heartbeat.h | 16 ++++++++++------ include/libimobiledevice/libimobiledevice.h | 4 ++-- include/libimobiledevice/property_list_service.h | 3 +++ include/libimobiledevice/service.h | 10 ++++++++-- include/libimobiledevice/webinspector.h | 14 ++++++++------ 5 files changed, 31 insertions(+), 16 deletions(-) (limited to 'include') diff --git a/include/libimobiledevice/heartbeat.h b/include/libimobiledevice/heartbeat.h index 00734b5..1f5344a 100644 --- a/include/libimobiledevice/heartbeat.h +++ b/include/libimobiledevice/heartbeat.h @@ -34,12 +34,14 @@ extern "C" { /** 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_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_NOT_ENOUGH_DATA = -5, + HEARTBEAT_E_TIMEOUT = -6, + HEARTBEAT_E_UNKNOWN_ERROR = -256 } heartbeat_error_t; typedef struct heartbeat_client_private heartbeat_client_private; @@ -118,6 +120,8 @@ heartbeat_error_t heartbeat_receive(heartbeat_client_t client, plist_t * plist); * * @return 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 diff --git a/include/libimobiledevice/libimobiledevice.h b/include/libimobiledevice/libimobiledevice.h index 5ec1a6d..729bc89 100644 --- a/include/libimobiledevice/libimobiledevice.h +++ b/include/libimobiledevice/libimobiledevice.h @@ -41,8 +41,8 @@ typedef enum { 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_E_SSL_ERROR = -6, + IDEVICE_E_TIMEOUT = -7 } idevice_error_t; typedef struct idevice_private idevice_private; diff --git a/include/libimobiledevice/property_list_service.h b/include/libimobiledevice/property_list_service.h index 5d5b835..aca966d 100644 --- a/include/libimobiledevice/property_list_service.h +++ b/include/libimobiledevice/property_list_service.h @@ -38,6 +38,7 @@ typedef enum { 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_NOT_ENOUGH_DATA = -6, PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR = -256 } property_list_service_error_t; @@ -130,6 +131,8 @@ property_list_service_error_t property_list_service_receive_plist_with_timeout(p * * @return PROPERTY_LIST_SERVICE_E_SUCCESS on success, * PROPERTY_LIST_SERVICE_E_INVALID_ARG when client or *plist is NULL, + * PROPERTY_LIST_SERVICE_E_NOT_ENOUGH_DATA when not enough data + * received, PROPERTY_LIST_SERVICE_E_RECEIVE_TIMEOUT when the connection times out, * PROPERTY_LIST_SERVICE_E_PLIST_ERROR when the received data cannot be * converted to a plist, PROPERTY_LIST_SERVICE_E_MUX_ERROR when a * communication error occurs, or PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR when diff --git a/include/libimobiledevice/service.h b/include/libimobiledevice/service.h index 13c5df1..5c43e29 100644 --- a/include/libimobiledevice/service.h +++ b/include/libimobiledevice/service.h @@ -37,6 +37,8 @@ typedef enum { SERVICE_E_MUX_ERROR = -3, SERVICE_E_SSL_ERROR = -4, SERVICE_E_START_SERVICE_ERROR = -5, + SERIVCE_E_NOT_ENOUGH_DATA = -6, + SERVICE_E_TIMEOUT = -7, SERVICE_E_UNKNOWN_ERROR = -256 } service_error_t; @@ -132,7 +134,9 @@ service_error_t service_receive_with_timeout(service_client_t client, char *data * * @return SERVICE_E_SUCCESS on success, * SERVICE_E_INVALID_ARG when one or more parameters are - * invalid, SERVICE_E_MUX_ERROR when a communication error + * invalid, SERIVCE_E_NOT_ENOUGH_DATA when not enough data + * received, SERVICE_E_TIMEOUT when the connection times out, + * SERVICE_E_MUX_ERROR when a communication error * occurs, or SERVICE_E_UNKNOWN_ERROR when an unspecified * error occurs. */ @@ -146,7 +150,9 @@ service_error_t service_receive(service_client_t client, char *data, uint32_t si * * @return SERVICE_E_SUCCESS on success, * SERVICE_E_INVALID_ARG if client or client->connection is - * NULL, SERVICE_E_SSL_ERROR when SSL could not be enabled, + * NULL, SERIVCE_E_NOT_ENOUGH_DATA when not enough data + * received, SERVICE_E_TIMEOUT when the connection times out, + * SERVICE_E_SSL_ERROR when SSL could not be enabled, * or SERVICE_E_UNKNOWN_ERROR otherwise. */ service_error_t service_enable_ssl(service_client_t client); diff --git a/include/libimobiledevice/webinspector.h b/include/libimobiledevice/webinspector.h index d2a99c9..da0759c 100644 --- a/include/libimobiledevice/webinspector.h +++ b/include/libimobiledevice/webinspector.h @@ -35,12 +35,14 @@ extern "C" { /** 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_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_RECEIVE_TIMEOUT = -5, + WEBINSPECTOR_E_NOT_ENOUGH_DATA = -6, + WEBINSPECTOR_E_UNKNOWN_ERROR = -256 } webinspector_error_t; typedef struct webinspector_client_private webinspector_client_private; -- cgit v1.1-32-gdbae