Add property_list_client_get_service_client() and service_get_connection() functions

This allows for custom service implementations to easier switch to non-plist
communication after the service has been started.
diff --git a/include/libimobiledevice/property_list_service.h b/include/libimobiledevice/property_list_service.h
index 5205551..3f6ebad 100644
--- a/include/libimobiledevice/property_list_service.h
+++ b/include/libimobiledevice/property_list_service.h
@@ -29,6 +29,7 @@
 #endif
 
 #include <libimobiledevice/lockdown.h>
+#include <libimobiledevice/service.h>
 
 /** Error Codes */
 typedef enum {
@@ -147,8 +148,8 @@
  *     should be enabled.
  *
  * @return PROPERTY_LIST_SERVICE_E_SUCCESS on success,
- *     PROPERTY_LIST_SERVICE_E_INVALID_ARG if client or client->connection is
- *     NULL, PROPERTY_LIST_SERVICE_E_SSL_ERROR when SSL could not be enabled,
+ *     PROPERTY_LIST_SERVICE_E_INVALID_ARG if one or more of the arguments are invalid,
+ *     PROPERTY_LIST_SERVICE_E_SSL_ERROR when SSL could not be enabled,
  *     or PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR otherwise.
  */
 property_list_service_error_t property_list_service_enable_ssl(property_list_service_client_t client);
@@ -160,11 +161,22 @@
  *     should be disabled.
  *
  * @return PROPERTY_LIST_SERVICE_E_SUCCESS on success,
- *     PROPERTY_LIST_SERVICE_E_INVALID_ARG if client or client->connection is
- *     NULL, or PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR otherwise.
+ *     PROPERTY_LIST_SERVICE_E_INVALID_ARG if one or more of the arguments are invalid,
+ *     or PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR otherwise.
  */
 property_list_service_error_t property_list_service_disable_ssl(property_list_service_client_t client);
 
+/**
+ * Return a handle to the parent #service_client_t of the given property list service client.
+ *
+ * @param client The property list service client
+ * @param service_client Pointer to be assigned to the parent #service_client_t
+ *
+ * @return PROPERTY_LIST_SERVICE_E_SUCCESS on success,
+ *     PROPERTY_LIST_SERVICE_E_INVALID_ARG if one or more of the arguments are invalid.
+ */
+property_list_service_error_t property_list_service_get_service_client(property_list_service_client_t client, service_client_t *service_client);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/include/libimobiledevice/service.h b/include/libimobiledevice/service.h
index 6842054..28b6db6 100644
--- a/include/libimobiledevice/service.h
+++ b/include/libimobiledevice/service.h
@@ -184,6 +184,16 @@
  */
 service_error_t service_disable_bypass_ssl(service_client_t client, uint8_t sslBypass);
 
+/**
+ * Return a handle to the parent #idevice_connection_t of the given service client.
+ *
+ * @param client The service client
+ * @param connection Pointer to be assigned to the #idevice_connection_t.
+ *
+ * @return SERVICE_E_SUCCESS on success,
+ *     SERVICE_E_INVALID_ARG if one or more of the arguments are invalid.
+ */
+service_error_t service_get_connection(service_client_t client, idevice_connection_t *connection);
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/property_list_service.c b/src/property_list_service.c
index 7b5c738..4654b6e 100644
--- a/src/property_list_service.c
+++ b/src/property_list_service.c
@@ -286,3 +286,10 @@
 	return service_to_property_list_service_error(service_disable_ssl(client->parent));
 }
 
+LIBIMOBILEDEVICE_API property_list_service_error_t property_list_service_get_service_client(property_list_service_client_t client, service_client_t *service_client)
+{
+	if (!client || !client->parent || !service_client)
+		return PROPERTY_LIST_SERVICE_E_INVALID_ARG;
+	*service_client = client->parent;
+	return PROPERTY_LIST_SERVICE_E_SUCCESS;
+}
diff --git a/src/service.c b/src/service.c
index 0928bcd..6c9d109 100644
--- a/src/service.c
+++ b/src/service.c
@@ -198,3 +198,10 @@
 	return idevice_to_service_error(idevice_connection_disable_bypass_ssl(client->connection, sslBypass));
 }
 
+LIBIMOBILEDEVICE_API service_error_t service_get_connection(service_client_t client, idevice_connection_t *connection)
+{
+	if (!client || !client->connection || !connection)
+		return SERVICE_E_INVALID_ARG;
+	*connection = client->connection;
+	return SERVICE_E_SUCCESS;
+}