From fcc1bb855efb6860417ed827d3b50feba24a9a8b Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Tue, 26 Feb 2013 03:20:56 +0100 Subject: Refactor port number use into service descriptor to enable SSL for services This is a major change which breaks API but is required in order to support SSL communication for services as used by network connections. --- include/libimobiledevice/afc.h | 3 ++- include/libimobiledevice/diagnostics_relay.h | 3 ++- include/libimobiledevice/file_relay.h | 3 ++- include/libimobiledevice/house_arrest.h | 3 ++- include/libimobiledevice/installation_proxy.h | 3 ++- include/libimobiledevice/lockdown.h | 10 +++++++++- include/libimobiledevice/misagent.h | 3 ++- include/libimobiledevice/mobile_image_mounter.h | 3 ++- include/libimobiledevice/mobilebackup.h | 3 ++- include/libimobiledevice/mobilebackup2.h | 3 ++- include/libimobiledevice/mobilesync.h | 3 ++- include/libimobiledevice/notification_proxy.h | 3 ++- include/libimobiledevice/sbservices.h | 3 ++- include/libimobiledevice/screenshotr.h | 3 ++- include/libimobiledevice/webinspector.h | 3 ++- 15 files changed, 37 insertions(+), 15 deletions(-) (limited to 'include/libimobiledevice') diff --git a/include/libimobiledevice/afc.h b/include/libimobiledevice/afc.h index 8d47696..1b4ad5b 100644 --- a/include/libimobiledevice/afc.h +++ b/include/libimobiledevice/afc.h @@ -28,6 +28,7 @@ extern "C" { #endif #include +#include /** @name Error Codes */ /*@{*/ @@ -93,7 +94,7 @@ typedef afc_client_private *afc_client_t; /**< The client handle. */ /* Interface */ afc_error_t afc_client_new_from_connection(idevice_connection_t connection, afc_client_t *client); -afc_error_t afc_client_new(idevice_t device, uint16_t port, afc_client_t *client); +afc_error_t afc_client_new(idevice_t device, lockdownd_service_descriptor_t service, afc_client_t *client); afc_error_t afc_client_free(afc_client_t client); afc_error_t afc_get_device_info(afc_client_t client, char ***infos); afc_error_t afc_read_directory(afc_client_t client, const char *dir, char ***list); diff --git a/include/libimobiledevice/diagnostics_relay.h b/include/libimobiledevice/diagnostics_relay.h index bdb3f36..ec87732 100644 --- a/include/libimobiledevice/diagnostics_relay.h +++ b/include/libimobiledevice/diagnostics_relay.h @@ -28,6 +28,7 @@ extern "C" { #endif #include +#include /** @name Error Codes */ /*@{*/ @@ -55,7 +56,7 @@ 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. */ -diagnostics_relay_error_t diagnostics_relay_client_new(idevice_t device, uint16_t port, diagnostics_relay_client_t *client); +diagnostics_relay_error_t diagnostics_relay_client_new(idevice_t device, lockdownd_service_descriptor_t service, diagnostics_relay_client_t *client); diagnostics_relay_error_t diagnostics_relay_client_free(diagnostics_relay_client_t client); diagnostics_relay_error_t diagnostics_relay_goodbye(diagnostics_relay_client_t client); diff --git a/include/libimobiledevice/file_relay.h b/include/libimobiledevice/file_relay.h index 52d4758..85f9213 100644 --- a/include/libimobiledevice/file_relay.h +++ b/include/libimobiledevice/file_relay.h @@ -28,6 +28,7 @@ extern "C" { #endif #include +#include /** @name Error Codes */ /*@{*/ @@ -47,7 +48,7 @@ typedef int16_t 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. */ -file_relay_error_t file_relay_client_new(idevice_t device, uint16_t port, file_relay_client_t *client); +file_relay_error_t file_relay_client_new(idevice_t device, lockdownd_service_descriptor_t service, file_relay_client_t *client); file_relay_error_t file_relay_client_free(file_relay_client_t client); file_relay_error_t file_relay_request_sources(file_relay_client_t client, const char **sources, idevice_connection_t *connection); diff --git a/include/libimobiledevice/house_arrest.h b/include/libimobiledevice/house_arrest.h index 04290f1..ee03072 100644 --- a/include/libimobiledevice/house_arrest.h +++ b/include/libimobiledevice/house_arrest.h @@ -28,6 +28,7 @@ extern "C" { #endif #include +#include #include /** @name Error Codes */ @@ -48,7 +49,7 @@ typedef struct house_arrest_client_private house_arrest_client_private; typedef house_arrest_client_private *house_arrest_client_t; /**< The client handle. */ /* Interface */ -house_arrest_error_t house_arrest_client_new(idevice_t device, uint16_t port, house_arrest_client_t *client); +house_arrest_error_t house_arrest_client_new(idevice_t device, lockdownd_service_descriptor_t service, house_arrest_client_t *client); house_arrest_error_t house_arrest_client_free(house_arrest_client_t client); house_arrest_error_t house_arrest_send_request(house_arrest_client_t client, plist_t dict); diff --git a/include/libimobiledevice/installation_proxy.h b/include/libimobiledevice/installation_proxy.h index 11fb66e..6a20c0b 100644 --- a/include/libimobiledevice/installation_proxy.h +++ b/include/libimobiledevice/installation_proxy.h @@ -28,6 +28,7 @@ extern "C" { #endif #include +#include /** @name Error Codes */ /*@{*/ @@ -51,7 +52,7 @@ typedef instproxy_client_private *instproxy_client_t; /**< The client handle. */ typedef void (*instproxy_status_cb_t) (const char *operation, plist_t status, void *user_data); /* Interface */ -instproxy_error_t instproxy_client_new(idevice_t device, uint16_t port, instproxy_client_t *client); +instproxy_error_t instproxy_client_new(idevice_t device, lockdownd_service_descriptor_t service, instproxy_client_t *client); instproxy_error_t instproxy_client_free(instproxy_client_t client); instproxy_error_t instproxy_browse(instproxy_client_t client, plist_t client_options, plist_t *result); diff --git a/include/libimobiledevice/lockdown.h b/include/libimobiledevice/lockdown.h index 4e7a4e8..287d3f6 100644 --- a/include/libimobiledevice/lockdown.h +++ b/include/libimobiledevice/lockdown.h @@ -29,6 +29,7 @@ extern "C" { #endif #include +#include /** @name Error Codes */ /*@{*/ @@ -70,6 +71,12 @@ struct lockdownd_pair_record { /** A pair record holding device, host and root certificates along the host_id */ typedef struct lockdownd_pair_record *lockdownd_pair_record_t; +struct lockdownd_service_descriptor { + uint16_t port; + uint8_t ssl_enabled; +}; +typedef struct lockdownd_service_descriptor *lockdownd_service_descriptor_t; + /* Interface */ lockdownd_error_t lockdownd_client_new(idevice_t device, lockdownd_client_t *client, const char *label); lockdownd_error_t lockdownd_client_new_with_handshake(idevice_t device, lockdownd_client_t *client, const char *label); @@ -79,7 +86,7 @@ lockdownd_error_t lockdownd_query_type(lockdownd_client_t client, char **type); lockdownd_error_t lockdownd_get_value(lockdownd_client_t client, const char *domain, const char *key, plist_t *value); lockdownd_error_t lockdownd_set_value(lockdownd_client_t client, const char *domain, const char *key, plist_t value); lockdownd_error_t lockdownd_remove_value(lockdownd_client_t client, const char *domain, const char *key); -lockdownd_error_t lockdownd_start_service(lockdownd_client_t client, const char *service, uint16_t *port); +lockdownd_error_t lockdownd_start_service(lockdownd_client_t client, const char *identifier, lockdownd_service_descriptor_t *service); lockdownd_error_t lockdownd_start_session(lockdownd_client_t client, const char *host_id, char **session_id, int *ssl_enabled); lockdownd_error_t lockdownd_stop_session(lockdownd_client_t client, const char *session_id); lockdownd_error_t lockdownd_send(lockdownd_client_t client, plist_t plist); @@ -98,6 +105,7 @@ lockdownd_error_t lockdownd_get_device_udid(lockdownd_client_t control, char **u lockdownd_error_t lockdownd_get_device_name(lockdownd_client_t client, char **device_name); lockdownd_error_t lockdownd_get_sync_data_classes(lockdownd_client_t client, char ***classes, int *count); lockdownd_error_t lockdownd_data_classes_free(char **classes); +lockdownd_error_t lockdownd_service_descriptor_free(lockdownd_service_descriptor_t service); #ifdef __cplusplus } diff --git a/include/libimobiledevice/misagent.h b/include/libimobiledevice/misagent.h index 7aa609b..3adfd9d 100644 --- a/include/libimobiledevice/misagent.h +++ b/include/libimobiledevice/misagent.h @@ -28,6 +28,7 @@ extern "C" { #endif #include +#include /** @name Error Codes */ /*@{*/ @@ -47,7 +48,7 @@ typedef struct misagent_client_private misagent_client_private; typedef misagent_client_private *misagent_client_t; /**< The client handle. */ /* Interface */ -misagent_error_t misagent_client_new(idevice_t device, uint16_t port, misagent_client_t *client); +misagent_error_t misagent_client_new(idevice_t device, lockdownd_service_descriptor_t service, misagent_client_t *client); misagent_error_t misagent_client_free(misagent_client_t client); misagent_error_t misagent_install(misagent_client_t client, plist_t profile); diff --git a/include/libimobiledevice/mobile_image_mounter.h b/include/libimobiledevice/mobile_image_mounter.h index 04c65d5..a9f500d 100644 --- a/include/libimobiledevice/mobile_image_mounter.h +++ b/include/libimobiledevice/mobile_image_mounter.h @@ -28,6 +28,7 @@ extern "C" { #endif #include +#include /** @name Error Codes */ /*@{*/ @@ -46,7 +47,7 @@ typedef struct mobile_image_mounter_client_private mobile_image_mounter_client_p typedef mobile_image_mounter_client_private *mobile_image_mounter_client_t; /**< The client handle. */ /* Interface */ -mobile_image_mounter_error_t mobile_image_mounter_new(idevice_t device, uint16_t port, mobile_image_mounter_client_t *client); +mobile_image_mounter_error_t mobile_image_mounter_new(idevice_t device, lockdownd_service_descriptor_t service, mobile_image_mounter_client_t *client); mobile_image_mounter_error_t mobile_image_mounter_free(mobile_image_mounter_client_t client); mobile_image_mounter_error_t mobile_image_mounter_lookup_image(mobile_image_mounter_client_t client, const char *image_type, plist_t *result); mobile_image_mounter_error_t mobile_image_mounter_mount_image(mobile_image_mounter_client_t client, const char *image_path, const char *image_signature, uint16_t signature_length, const char *image_type, plist_t *result); diff --git a/include/libimobiledevice/mobilebackup.h b/include/libimobiledevice/mobilebackup.h index 8f31cc4..358103d 100644 --- a/include/libimobiledevice/mobilebackup.h +++ b/include/libimobiledevice/mobilebackup.h @@ -28,6 +28,7 @@ extern "C" { #endif #include +#include /** @name Error Codes */ /*@{*/ @@ -53,7 +54,7 @@ typedef enum { MB_RESTORE_PRESERVE_CAMERA_ROLL = 1 << 2 } mobilebackup_flags_t; -mobilebackup_error_t mobilebackup_client_new(idevice_t device, uint16_t port, mobilebackup_client_t * client); +mobilebackup_error_t mobilebackup_client_new(idevice_t device, lockdownd_service_descriptor_t service, mobilebackup_client_t * client); mobilebackup_error_t mobilebackup_client_free(mobilebackup_client_t client); mobilebackup_error_t mobilebackup_receive(mobilebackup_client_t client, plist_t *plist); mobilebackup_error_t mobilebackup_send(mobilebackup_client_t client, plist_t plist); diff --git a/include/libimobiledevice/mobilebackup2.h b/include/libimobiledevice/mobilebackup2.h index 6557f42..215c339 100644 --- a/include/libimobiledevice/mobilebackup2.h +++ b/include/libimobiledevice/mobilebackup2.h @@ -28,6 +28,7 @@ extern "C" { #endif #include +#include /** @name Error Codes */ /*@{*/ @@ -48,7 +49,7 @@ typedef int16_t mobilebackup2_error_t; typedef struct mobilebackup2_client_private mobilebackup2_client_private; typedef mobilebackup2_client_private *mobilebackup2_client_t; /**< The client handle. */ -mobilebackup2_error_t mobilebackup2_client_new(idevice_t device, uint16_t port, mobilebackup2_client_t * client); +mobilebackup2_error_t mobilebackup2_client_new(idevice_t device, lockdownd_service_descriptor_t service, mobilebackup2_client_t * client); mobilebackup2_error_t mobilebackup2_client_free(mobilebackup2_client_t client); mobilebackup2_error_t mobilebackup2_send_message(mobilebackup2_client_t client, const char *message, plist_t options); mobilebackup2_error_t mobilebackup2_receive_message(mobilebackup2_client_t client, plist_t *msg_plist, char **dlmessage); diff --git a/include/libimobiledevice/mobilesync.h b/include/libimobiledevice/mobilesync.h index cfab8d9..ef1f4df 100644 --- a/include/libimobiledevice/mobilesync.h +++ b/include/libimobiledevice/mobilesync.h @@ -29,6 +29,7 @@ extern "C" { #endif #include +#include /** @name Error Codes */ /*@{*/ @@ -65,7 +66,7 @@ typedef struct { typedef mobilesync_anchors *mobilesync_anchors_t; /**< Anchors used by the device and computer. */ /* Interface */ -mobilesync_error_t mobilesync_client_new(idevice_t device, uint16_t port, mobilesync_client_t * client); +mobilesync_error_t mobilesync_client_new(idevice_t device, lockdownd_service_descriptor_t service, mobilesync_client_t * client); mobilesync_error_t mobilesync_client_free(mobilesync_client_t client); mobilesync_error_t mobilesync_receive(mobilesync_client_t client, plist_t *plist); diff --git a/include/libimobiledevice/notification_proxy.h b/include/libimobiledevice/notification_proxy.h index 43c479d..3f883e5 100644 --- a/include/libimobiledevice/notification_proxy.h +++ b/include/libimobiledevice/notification_proxy.h @@ -28,6 +28,7 @@ extern "C" { #endif #include +#include /** @name Error Codes */ /*@{*/ @@ -90,7 +91,7 @@ typedef np_client_private *np_client_t; /**< The client handle. */ typedef void (*np_notify_cb_t) (const char *notification, void *user_data); /* Interface */ -np_error_t np_client_new(idevice_t device, uint16_t port, np_client_t *client); +np_error_t np_client_new(idevice_t device, lockdownd_service_descriptor_t service, np_client_t *client); np_error_t np_client_free(np_client_t client); np_error_t np_post_notification(np_client_t client, const char *notification); np_error_t np_observe_notification(np_client_t client, const char *notification); diff --git a/include/libimobiledevice/sbservices.h b/include/libimobiledevice/sbservices.h index 08cb740..55d8b93 100644 --- a/include/libimobiledevice/sbservices.h +++ b/include/libimobiledevice/sbservices.h @@ -28,6 +28,7 @@ extern "C" { #endif #include +#include /** @name Error Codes */ /*@{*/ @@ -57,7 +58,7 @@ typedef struct sbservices_client_private sbservices_client_private; typedef sbservices_client_private *sbservices_client_t; /**< The client handle. */ /* Interface */ -sbservices_error_t sbservices_client_new(idevice_t device, uint16_t port, sbservices_client_t *client); +sbservices_error_t sbservices_client_new(idevice_t device, lockdownd_service_descriptor_t service, sbservices_client_t *client); sbservices_error_t sbservices_client_free(sbservices_client_t client); sbservices_error_t sbservices_get_icon_state(sbservices_client_t client, plist_t *state, const char *format_version); sbservices_error_t sbservices_set_icon_state(sbservices_client_t client, plist_t newstate); diff --git a/include/libimobiledevice/screenshotr.h b/include/libimobiledevice/screenshotr.h index b3669ee..b9497d0 100644 --- a/include/libimobiledevice/screenshotr.h +++ b/include/libimobiledevice/screenshotr.h @@ -29,6 +29,7 @@ extern "C" { #endif #include +#include /** @name Error Codes */ /*@{*/ @@ -47,7 +48,7 @@ typedef int16_t screenshotr_error_t; typedef struct screenshotr_client_private screenshotr_client_private; typedef screenshotr_client_private *screenshotr_client_t; /**< The client handle. */ -screenshotr_error_t screenshotr_client_new(idevice_t device, uint16_t port, screenshotr_client_t * client); +screenshotr_error_t screenshotr_client_new(idevice_t device, lockdownd_service_descriptor_t service, screenshotr_client_t * client); screenshotr_error_t screenshotr_client_free(screenshotr_client_t client); screenshotr_error_t screenshotr_take_screenshot(screenshotr_client_t client, char **imgdata, uint64_t *imgsize); diff --git a/include/libimobiledevice/webinspector.h b/include/libimobiledevice/webinspector.h index d499d72..ed9faad 100644 --- a/include/libimobiledevice/webinspector.h +++ b/include/libimobiledevice/webinspector.h @@ -28,6 +28,7 @@ extern "C" { #endif #include +#include #define WEBINSPECTOR_SERVICE_NAME "com.apple.webinspector" @@ -47,7 +48,7 @@ typedef int16_t webinspector_error_t; typedef struct webinspector_client_private webinspector_client_private; typedef webinspector_client_private *webinspector_client_t; /**< The client handle. */ -webinspector_error_t webinspector_client_new(idevice_t device, uint16_t port, webinspector_client_t * client); +webinspector_error_t webinspector_client_new(idevice_t device, lockdownd_service_descriptor_t service, webinspector_client_t * client); webinspector_error_t webinspector_client_free(webinspector_client_t client); webinspector_error_t webinspector_start_service(idevice_t device, webinspector_client_t * client); -- cgit v1.1-32-gdbae