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