diff options
Diffstat (limited to 'include/libimobiledevice/property_list_service.h')
| -rw-r--r-- | include/libimobiledevice/property_list_service.h | 184 |
1 files changed, 184 insertions, 0 deletions
diff --git a/include/libimobiledevice/property_list_service.h b/include/libimobiledevice/property_list_service.h new file mode 100644 index 0000000..e6b26a3 --- /dev/null +++ b/include/libimobiledevice/property_list_service.h | |||
| @@ -0,0 +1,184 @@ | |||
| 1 | /** | ||
| 2 | * @file libimobiledevice/property_list_service.h | ||
| 3 | * @brief Definitions for the PropertyList service | ||
| 4 | * \internal | ||
| 5 | * | ||
| 6 | * Copyright (c) 2010-2014 Martin Szulecki All Rights Reserved. | ||
| 7 | * Copyright (c) 2010-2014 Nikias Bassen, All Rights Reserved. | ||
| 8 | * | ||
| 9 | * This library is free software; you can redistribute it and/or | ||
| 10 | * modify it under the terms of the GNU Lesser General Public | ||
| 11 | * License as published by the Free Software Foundation; either | ||
| 12 | * version 2.1 of the License, or (at your option) any later version. | ||
| 13 | * | ||
| 14 | * This library is distributed in the hope that it will be useful, | ||
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 17 | * Lesser General Public License for more details. | ||
| 18 | * | ||
| 19 | * You should have received a copy of the GNU Lesser General Public | ||
| 20 | * License along with this library; if not, write to the Free Software | ||
| 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 22 | */ | ||
| 23 | |||
| 24 | #ifndef IPROPERTY_LIST_SERVICE_H | ||
| 25 | #define IPROPERTY_LIST_SERVICE_H | ||
| 26 | |||
| 27 | #ifdef __cplusplus | ||
| 28 | extern "C" { | ||
| 29 | #endif | ||
| 30 | |||
| 31 | #include <libimobiledevice/lockdown.h> | ||
| 32 | #include <libimobiledevice/service.h> | ||
| 33 | |||
| 34 | /** Error Codes */ | ||
| 35 | typedef enum { | ||
| 36 | PROPERTY_LIST_SERVICE_E_SUCCESS = 0, | ||
| 37 | PROPERTY_LIST_SERVICE_E_INVALID_ARG = -1, | ||
| 38 | PROPERTY_LIST_SERVICE_E_PLIST_ERROR = -2, | ||
| 39 | PROPERTY_LIST_SERVICE_E_MUX_ERROR = -3, | ||
| 40 | PROPERTY_LIST_SERVICE_E_SSL_ERROR = -4, | ||
| 41 | PROPERTY_LIST_SERVICE_E_RECEIVE_TIMEOUT = -5, | ||
| 42 | PROPERTY_LIST_SERVICE_E_NOT_ENOUGH_DATA = -6, | ||
| 43 | PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR = -256 | ||
| 44 | } property_list_service_error_t; | ||
| 45 | |||
| 46 | typedef struct property_list_service_client_private property_list_service_private; /**< \private */ | ||
| 47 | typedef property_list_service_private* property_list_service_client_t; /**< The client handle. */ | ||
| 48 | |||
| 49 | /* Interface */ | ||
| 50 | |||
| 51 | /** | ||
| 52 | * Creates a new property list service for the specified port. | ||
| 53 | * | ||
| 54 | * @param device The device to connect to. | ||
| 55 | * @param service The service descriptor returned by lockdownd_start_service. | ||
| 56 | * @param client Pointer that will be set to a newly allocated | ||
| 57 | * property_list_service_client_t upon successful return. | ||
| 58 | * | ||
| 59 | * @return PROPERTY_LIST_SERVICE_E_SUCCESS on success, | ||
| 60 | * PROPERTY_LIST_SERVICE_E_INVALID_ARG when one of the arguments is invalid, | ||
| 61 | * or PROPERTY_LIST_SERVICE_E_MUX_ERROR when connecting to the device failed. | ||
| 62 | */ | ||
| 63 | LIBIMOBILEDEVICE_API property_list_service_error_t property_list_service_client_new(idevice_t device, lockdownd_service_descriptor_t service, property_list_service_client_t *client); | ||
| 64 | |||
| 65 | /** | ||
| 66 | * Frees a PropertyList service. | ||
| 67 | * | ||
| 68 | * @param client The property list service to free. | ||
| 69 | * | ||
| 70 | * @return PROPERTY_LIST_SERVICE_E_SUCCESS on success, | ||
| 71 | * PROPERTY_LIST_SERVICE_E_INVALID_ARG when client is invalid, or a | ||
| 72 | * PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR when another error occurred. | ||
| 73 | */ | ||
| 74 | LIBIMOBILEDEVICE_API property_list_service_error_t property_list_service_client_free(property_list_service_client_t client); | ||
| 75 | |||
| 76 | /** | ||
| 77 | * Sends an XML plist. | ||
| 78 | * | ||
| 79 | * @param client The property list service client to use for sending. | ||
| 80 | * @param plist plist to send | ||
| 81 | * | ||
| 82 | * @return PROPERTY_LIST_SERVICE_E_SUCCESS on success, | ||
| 83 | * PROPERTY_LIST_SERVICE_E_INVALID_ARG when client or plist is NULL, | ||
| 84 | * PROPERTY_LIST_SERVICE_E_PLIST_ERROR when dict is not a valid plist, | ||
| 85 | * or PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR when an unspecified error occurs. | ||
| 86 | */ | ||
| 87 | LIBIMOBILEDEVICE_API property_list_service_error_t property_list_service_send_xml_plist(property_list_service_client_t client, plist_t plist); | ||
| 88 | |||
| 89 | /** | ||
| 90 | * Sends a binary plist. | ||
| 91 | * | ||
| 92 | * @param client The property list service client to use for sending. | ||
| 93 | * @param plist plist to send | ||
| 94 | * | ||
| 95 | * @return PROPERTY_LIST_SERVICE_E_SUCCESS on success, | ||
| 96 | * PROPERTY_LIST_SERVICE_E_INVALID_ARG when client or plist is NULL, | ||
| 97 | * PROPERTY_LIST_SERVICE_E_PLIST_ERROR when dict is not a valid plist, | ||
| 98 | * or PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR when an unspecified error occurs. | ||
| 99 | */ | ||
| 100 | LIBIMOBILEDEVICE_API property_list_service_error_t property_list_service_send_binary_plist(property_list_service_client_t client, plist_t plist); | ||
| 101 | |||
| 102 | /** | ||
| 103 | * Receives a plist using the given property list service client with specified | ||
| 104 | * timeout. | ||
| 105 | * Binary or XML plists are automatically handled. | ||
| 106 | * | ||
| 107 | * @param client The property list service client to use for receiving | ||
| 108 | * @param plist pointer to a plist_t that will point to the received plist | ||
| 109 | * upon successful return | ||
| 110 | * @param timeout Maximum time in milliseconds to wait for data. | ||
| 111 | * | ||
| 112 | * @return PROPERTY_LIST_SERVICE_E_SUCCESS on success, | ||
| 113 | * PROPERTY_LIST_SERVICE_E_INVALID_ARG when connection or *plist is NULL, | ||
| 114 | * PROPERTY_LIST_SERVICE_E_PLIST_ERROR when the received data cannot be | ||
| 115 | * converted to a plist, PROPERTY_LIST_SERVICE_E_MUX_ERROR when a | ||
| 116 | * communication error occurs, or PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR when | ||
| 117 | * an unspecified error occurs. | ||
| 118 | */ | ||
| 119 | LIBIMOBILEDEVICE_API property_list_service_error_t property_list_service_receive_plist_with_timeout(property_list_service_client_t client, plist_t *plist, unsigned int timeout); | ||
| 120 | |||
| 121 | /** | ||
| 122 | * Receives a plist using the given property list service client. | ||
| 123 | * Binary or XML plists are automatically handled. | ||
| 124 | * | ||
| 125 | * This function is like property_list_service_receive_plist_with_timeout | ||
| 126 | * using a timeout of 10 seconds. | ||
| 127 | * @see property_list_service_receive_plist_with_timeout | ||
| 128 | * | ||
| 129 | * @param client The property list service client to use for receiving | ||
| 130 | * @param plist pointer to a plist_t that will point to the received plist | ||
| 131 | * upon successful return | ||
| 132 | * | ||
| 133 | * @return PROPERTY_LIST_SERVICE_E_SUCCESS on success, | ||
| 134 | * PROPERTY_LIST_SERVICE_E_INVALID_ARG when client or *plist is NULL, | ||
| 135 | * PROPERTY_LIST_SERVICE_E_NOT_ENOUGH_DATA when not enough data | ||
| 136 | * received, PROPERTY_LIST_SERVICE_E_RECEIVE_TIMEOUT when the connection times out, | ||
| 137 | * PROPERTY_LIST_SERVICE_E_PLIST_ERROR when the received data cannot be | ||
| 138 | * converted to a plist, PROPERTY_LIST_SERVICE_E_MUX_ERROR when a | ||
| 139 | * communication error occurs, or PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR when | ||
| 140 | * an unspecified error occurs. | ||
| 141 | */ | ||
| 142 | LIBIMOBILEDEVICE_API property_list_service_error_t property_list_service_receive_plist(property_list_service_client_t client, plist_t *plist); | ||
| 143 | |||
| 144 | /** | ||
| 145 | * Enable SSL for the given property list service client. | ||
| 146 | * | ||
| 147 | * @param client The connected property list service client for which SSL | ||
| 148 | * should be enabled. | ||
| 149 | * | ||
| 150 | * @return PROPERTY_LIST_SERVICE_E_SUCCESS on success, | ||
| 151 | * PROPERTY_LIST_SERVICE_E_INVALID_ARG if one or more of the arguments are invalid, | ||
| 152 | * PROPERTY_LIST_SERVICE_E_SSL_ERROR when SSL could not be enabled, | ||
| 153 | * or PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR otherwise. | ||
| 154 | */ | ||
| 155 | LIBIMOBILEDEVICE_API property_list_service_error_t property_list_service_enable_ssl(property_list_service_client_t client); | ||
| 156 | |||
| 157 | /** | ||
| 158 | * Disable SSL for the given property list service client. | ||
| 159 | * | ||
| 160 | * @param client The connected property list service client for which SSL | ||
| 161 | * should be disabled. | ||
| 162 | * | ||
| 163 | * @return PROPERTY_LIST_SERVICE_E_SUCCESS on success, | ||
| 164 | * PROPERTY_LIST_SERVICE_E_INVALID_ARG if one or more of the arguments are invalid, | ||
| 165 | * or PROPERTY_LIST_SERVICE_E_UNKNOWN_ERROR otherwise. | ||
| 166 | */ | ||
| 167 | LIBIMOBILEDEVICE_API property_list_service_error_t property_list_service_disable_ssl(property_list_service_client_t client); | ||
| 168 | |||
| 169 | /** | ||
| 170 | * Return a handle to the parent #service_client_t of the given property list service client. | ||
| 171 | * | ||
| 172 | * @param client The property list service client | ||
| 173 | * @param service_client Pointer to be assigned to the parent #service_client_t | ||
| 174 | * | ||
| 175 | * @return PROPERTY_LIST_SERVICE_E_SUCCESS on success, | ||
| 176 | * PROPERTY_LIST_SERVICE_E_INVALID_ARG if one or more of the arguments are invalid. | ||
| 177 | */ | ||
| 178 | LIBIMOBILEDEVICE_API property_list_service_error_t property_list_service_get_service_client(property_list_service_client_t client, service_client_t *service_client); | ||
| 179 | |||
| 180 | #ifdef __cplusplus | ||
| 181 | } | ||
| 182 | #endif | ||
| 183 | |||
| 184 | #endif | ||
