diff options
Diffstat (limited to 'src/heartbeat.c')
| -rw-r--r-- | src/heartbeat.c | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/src/heartbeat.c b/src/heartbeat.c index e03b44e..7654dd0 100644 --- a/src/heartbeat.c +++ b/src/heartbeat.c | |||
| @@ -58,18 +58,6 @@ static heartbeat_error_t heartbeat_error(property_list_service_error_t err) | |||
| 58 | return HEARTBEAT_E_UNKNOWN_ERROR; | 58 | return HEARTBEAT_E_UNKNOWN_ERROR; |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | /** | ||
| 62 | * Connects to the heartbeat service on the specified device. | ||
| 63 | * | ||
| 64 | * @param device The device to connect to. | ||
| 65 | * @param service The service descriptor returned by lockdownd_start_service. | ||
| 66 | * @param client Pointer that will point to a newly allocated | ||
| 67 | * heartbeat_client_t upon successful return. Must be freed using | ||
| 68 | * heartbeat_client_free() after use. | ||
| 69 | * | ||
| 70 | * @return HEARTBEAT_E_SUCCESS on success, HEARTBEAT_E_INVALID_ARG when | ||
| 71 | * client is NULL, or an HEARTBEAT_E_* error code otherwise. | ||
| 72 | */ | ||
| 73 | heartbeat_error_t heartbeat_client_new(idevice_t device, lockdownd_service_descriptor_t service, heartbeat_client_t * client) | 61 | heartbeat_error_t heartbeat_client_new(idevice_t device, lockdownd_service_descriptor_t service, heartbeat_client_t * client) |
| 74 | { | 62 | { |
| 75 | *client = NULL; | 63 | *client = NULL; |
| @@ -97,19 +85,6 @@ heartbeat_error_t heartbeat_client_new(idevice_t device, lockdownd_service_descr | |||
| 97 | return 0; | 85 | return 0; |
| 98 | } | 86 | } |
| 99 | 87 | ||
| 100 | /** | ||
| 101 | * Starts a new heartbeat service on the specified device and connects to it. | ||
| 102 | * | ||
| 103 | * @param device The device to connect to. | ||
| 104 | * @param client Pointer that will point to a newly allocated | ||
| 105 | * heartbeat_client_t upon successful return. Must be freed using | ||
| 106 | * heartbeat_client_free() after use. | ||
| 107 | * @param label The label to use for communication. Usually the program name. | ||
| 108 | * Pass NULL to disable sending the label in requests to lockdownd. | ||
| 109 | * | ||
| 110 | * @return HEARTBEAT_E_SUCCESS on success, or an HEARTBEAT_E_* error | ||
| 111 | * code otherwise. | ||
| 112 | */ | ||
| 113 | heartbeat_error_t heartbeat_client_start_service(idevice_t device, heartbeat_client_t * client, const char* label) | 88 | heartbeat_error_t heartbeat_client_start_service(idevice_t device, heartbeat_client_t * client, const char* label) |
| 114 | { | 89 | { |
| 115 | heartbeat_error_t err = HEARTBEAT_E_UNKNOWN_ERROR; | 90 | heartbeat_error_t err = HEARTBEAT_E_UNKNOWN_ERROR; |
| @@ -117,15 +92,6 @@ heartbeat_error_t heartbeat_client_start_service(idevice_t device, heartbeat_cli | |||
| 117 | return err; | 92 | return err; |
| 118 | } | 93 | } |
| 119 | 94 | ||
| 120 | /** | ||
| 121 | * Disconnects a heartbeat client from the device and frees up the | ||
| 122 | * heartbeat client data. | ||
| 123 | * | ||
| 124 | * @param client The heartbeat client to disconnect and free. | ||
| 125 | * | ||
| 126 | * @return HEARTBEAT_E_SUCCESS on success, HEARTBEAT_E_INVALID_ARG when | ||
| 127 | * client is NULL, or an HEARTBEAT_E_* error code otherwise. | ||
| 128 | */ | ||
| 129 | heartbeat_error_t heartbeat_client_free(heartbeat_client_t client) | 95 | heartbeat_error_t heartbeat_client_free(heartbeat_client_t client) |
| 130 | { | 96 | { |
| 131 | if (!client) | 97 | if (!client) |
| @@ -137,15 +103,6 @@ heartbeat_error_t heartbeat_client_free(heartbeat_client_t client) | |||
| 137 | return err; | 103 | return err; |
| 138 | } | 104 | } |
| 139 | 105 | ||
| 140 | /** | ||
| 141 | * Sends a plist to the service. | ||
| 142 | * | ||
| 143 | * @param client The heartbeat client | ||
| 144 | * @param plist The plist to send | ||
| 145 | * | ||
| 146 | * @return HEARTBEAT_E_SUCCESS on success, | ||
| 147 | * HEARTBEAT_E_INVALID_ARG when client or plist is NULL | ||
| 148 | */ | ||
| 149 | heartbeat_error_t heartbeat_send(heartbeat_client_t client, plist_t plist) | 106 | heartbeat_error_t heartbeat_send(heartbeat_client_t client, plist_t plist) |
| 150 | { | 107 | { |
| 151 | heartbeat_error_t res = HEARTBEAT_E_UNKNOWN_ERROR; | 108 | heartbeat_error_t res = HEARTBEAT_E_UNKNOWN_ERROR; |
| @@ -161,35 +118,11 @@ heartbeat_error_t heartbeat_send(heartbeat_client_t client, plist_t plist) | |||
| 161 | return res; | 118 | return res; |
| 162 | } | 119 | } |
| 163 | 120 | ||
| 164 | /** | ||
| 165 | * Receives a plist from the service. | ||
| 166 | * | ||
| 167 | * @param client The heartbeat client | ||
| 168 | * @param plist The plist to store the received data | ||
| 169 | * | ||
| 170 | * @return HEARTBEAT_E_SUCCESS on success, | ||
| 171 | * HEARTBEAT_E_INVALID_ARG when client or plist is NULL | ||
| 172 | */ | ||
| 173 | heartbeat_error_t heartbeat_receive(heartbeat_client_t client, plist_t * plist) | 121 | heartbeat_error_t heartbeat_receive(heartbeat_client_t client, plist_t * plist) |
| 174 | { | 122 | { |
| 175 | return heartbeat_receive_with_timeout(client, plist, 1000); | 123 | return heartbeat_receive_with_timeout(client, plist, 1000); |
| 176 | } | 124 | } |
| 177 | 125 | ||
| 178 | /** | ||
| 179 | * Receives a plist using the given heartbeat client. | ||
| 180 | * | ||
| 181 | * @param client The heartbeat client to use for receiving | ||
| 182 | * @param plist pointer to a plist_t that will point to the received plist | ||
| 183 | * upon successful return | ||
| 184 | * @param timeout Maximum time in milliseconds to wait for data. | ||
| 185 | * | ||
| 186 | * @return HEARTBEAT_E_SUCCESS on success, | ||
| 187 | * HEARTBEAT_E_INVALID_ARG when client or *plist is NULL, | ||
| 188 | * HEARTBEAT_E_PLIST_ERROR when the received data cannot be | ||
| 189 | * converted to a plist, HEARTBEAT_E_MUX_ERROR when a | ||
| 190 | * communication error occurs, or HEARTBEAT_E_UNKNOWN_ERROR | ||
| 191 | * when an unspecified error occurs. | ||
| 192 | */ | ||
| 193 | heartbeat_error_t heartbeat_receive_with_timeout(heartbeat_client_t client, plist_t * plist, uint32_t timeout_ms) | 126 | heartbeat_error_t heartbeat_receive_with_timeout(heartbeat_client_t client, plist_t * plist, uint32_t timeout_ms) |
| 194 | { | 127 | { |
| 195 | heartbeat_error_t res = HEARTBEAT_E_UNKNOWN_ERROR; | 128 | heartbeat_error_t res = HEARTBEAT_E_UNKNOWN_ERROR; |
