From 96101a1231a4ddfeb40fd738a24e108a3a904048 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Thu, 28 Jan 2010 22:18:41 +0100 Subject: Global renames due to project rename to libimobiledevice --- include/libimobiledevice/afc.h | 117 ++++++++++++++++++++++++++ include/libimobiledevice/file_relay.h | 56 ++++++++++++ include/libimobiledevice/installation_proxy.h | 72 ++++++++++++++++ include/libimobiledevice/libimobiledevice.h | 102 ++++++++++++++++++++++ include/libimobiledevice/lockdown.h | 99 ++++++++++++++++++++++ include/libimobiledevice/mobilebackup.h | 55 ++++++++++++ include/libimobiledevice/mobilesync.h | 55 ++++++++++++ include/libimobiledevice/notification_proxy.h | 88 +++++++++++++++++++ include/libimobiledevice/sbservices.h | 56 ++++++++++++ 9 files changed, 700 insertions(+) create mode 100644 include/libimobiledevice/afc.h create mode 100644 include/libimobiledevice/file_relay.h create mode 100644 include/libimobiledevice/installation_proxy.h create mode 100644 include/libimobiledevice/libimobiledevice.h create mode 100644 include/libimobiledevice/lockdown.h create mode 100644 include/libimobiledevice/mobilebackup.h create mode 100644 include/libimobiledevice/mobilesync.h create mode 100644 include/libimobiledevice/notification_proxy.h create mode 100644 include/libimobiledevice/sbservices.h (limited to 'include/libimobiledevice') diff --git a/include/libimobiledevice/afc.h b/include/libimobiledevice/afc.h new file mode 100644 index 0000000..5b61499 --- /dev/null +++ b/include/libimobiledevice/afc.h @@ -0,0 +1,117 @@ +/** + * @file libimobiledevice/afc.h + * @brief AFC Implementation + * \internal + * + * Copyright (c) 2009 Nikias Bassen All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AFC_H +#define AFC_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* Error Codes */ +#define AFC_E_SUCCESS 0 +#define AFC_E_UNKNOWN_ERROR 1 +#define AFC_E_OP_HEADER_INVALID 2 +#define AFC_E_NO_RESOURCES 3 +#define AFC_E_READ_ERROR 4 +#define AFC_E_WRITE_ERROR 5 +#define AFC_E_UNKNOWN_PACKET_TYPE 6 +#define AFC_E_INVALID_ARGUMENT 7 +#define AFC_E_OBJECT_NOT_FOUND 8 +#define AFC_E_OBJECT_IS_DIR 9 +#define AFC_E_PERM_DENIED 10 +#define AFC_E_SERVICE_NOT_CONNECTED 11 +#define AFC_E_OP_TIMEOUT 12 +#define AFC_E_TOO_MUCH_DATA 13 +#define AFC_E_END_OF_DATA 14 +#define AFC_E_OP_NOT_SUPPORTED 15 +#define AFC_E_OBJECT_EXISTS 16 +#define AFC_E_OBJECT_BUSY 17 +#define AFC_E_NO_SPACE_LEFT 18 +#define AFC_E_OP_WOULD_BLOCK 19 +#define AFC_E_IO_ERROR 20 +#define AFC_E_OP_INTERRUPTED 21 +#define AFC_E_OP_IN_PROGRESS 22 +#define AFC_E_INTERNAL_ERROR 23 + +#define AFC_E_MUX_ERROR 30 +#define AFC_E_NO_MEM 31 +#define AFC_E_NOT_ENOUGH_DATA 32 +#define AFC_E_DIR_NOT_EMPTY 33 + +typedef int16_t afc_error_t; + +/* Flags */ +typedef enum { + AFC_FOPEN_RDONLY = 0x00000001, // r O_RDONLY + AFC_FOPEN_RW = 0x00000002, // r+ O_RDWR | O_CREAT + AFC_FOPEN_WRONLY = 0x00000003, // w O_WRONLY | O_CREAT | O_TRUNC + AFC_FOPEN_WR = 0x00000004, // w+ O_RDWR | O_CREAT | O_TRUNC + AFC_FOPEN_APPEND = 0x00000005, // a O_WRONLY | O_APPEND | O_CREAT + AFC_FOPEN_RDAPPEND = 0x00000006 // a+ O_RDWR | O_APPEND | O_CREAT +} afc_file_mode_t; + +typedef enum { + AFC_HARDLINK = 1, + AFC_SYMLINK = 2 +} afc_link_type_t; + +typedef enum { + AFC_LOCK_SH = 1 | 4, // shared lock + AFC_LOCK_EX = 2 | 4, // exclusive lock + AFC_LOCK_UN = 8 | 4 // unlock +} afc_lock_op_t; + +struct afc_client_int; +typedef struct afc_client_int *afc_client_t; + +/* Interface */ +afc_error_t afc_client_new(idevice_t device, uint16_t port, 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); +afc_error_t afc_get_file_info(afc_client_t client, const char *filename, char ***infolist); +afc_error_t afc_file_open(afc_client_t client, const char *filename, afc_file_mode_t file_mode, uint64_t *handle); +afc_error_t afc_file_close(afc_client_t client, uint64_t handle); +afc_error_t afc_file_lock(afc_client_t client, uint64_t handle, afc_lock_op_t operation); +afc_error_t afc_file_read(afc_client_t client, uint64_t handle, char *data, uint32_t length, uint32_t *bytes_read); +afc_error_t afc_file_write(afc_client_t client, uint64_t handle, const char *data, uint32_t length, uint32_t *bytes_written); +afc_error_t afc_file_seek(afc_client_t client, uint64_t handle, int64_t offset, int whence); +afc_error_t afc_file_tell(afc_client_t client, uint64_t handle, uint64_t *position); +afc_error_t afc_file_truncate(afc_client_t client, uint64_t handle, uint64_t newsize); +afc_error_t afc_remove_path(afc_client_t client, const char *path); +afc_error_t afc_rename_path(afc_client_t client, const char *from, const char *to); +afc_error_t afc_make_directory(afc_client_t client, const char *dir); +afc_error_t afc_truncate(afc_client_t client, const char *path, uint64_t newsize); +afc_error_t afc_make_link(afc_client_t client, afc_link_type_t linktype, const char *target, const char *linkname); +afc_error_t afc_set_file_time(afc_client_t client, const char *path, uint64_t mtime); + +/* Helper functions */ +afc_error_t afc_get_device_info_key(afc_client_t client, const char *key, char **value); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/libimobiledevice/file_relay.h b/include/libimobiledevice/file_relay.h new file mode 100644 index 0000000..268eed8 --- /dev/null +++ b/include/libimobiledevice/file_relay.h @@ -0,0 +1,56 @@ +/** + * @file libimobiledevice/file_relay.h + * @brief file_relay Implementation + * \internal + * + * Copyright (c) 2010 Nikias Bassen All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef IFILE_RELAY_H +#define IFILE_RELAY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* Error Codes */ +#define FILE_RELAY_E_SUCCESS 0 +#define FILE_RELAY_E_INVALID_ARG -1 +#define FILE_RELAY_E_PLIST_ERROR -2 +#define FILE_RELAY_E_MUX_ERROR -3 +#define FILE_RELAY_E_INVALID_SOURCE -4 +#define FILE_RELAY_E_STAGING_EMPTY -5 + +#define FILE_RELAY_E_UNKNOWN_ERROR -256 + +typedef int16_t file_relay_error_t; + +struct file_relay_client_int; +typedef struct file_relay_client_int *file_relay_client_t; + +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_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); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/libimobiledevice/installation_proxy.h b/include/libimobiledevice/installation_proxy.h new file mode 100644 index 0000000..22e76b1 --- /dev/null +++ b/include/libimobiledevice/installation_proxy.h @@ -0,0 +1,72 @@ +/** + * @file libimobiledevice/installation_proxy.h + * @brief Implementation to talk to the installation proxy on a device + * \internal + * + * Copyright (c) 2009 Nikias Bassen All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef INSTALLATION_PROXY_H +#define INSTALLATION_PROXY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* Error Codes */ +#define INSTPROXY_E_SUCCESS 0 +#define INSTPROXY_E_INVALID_ARG -1 +#define INSTPROXY_E_PLIST_ERROR -2 +#define INSTPROXY_E_CONN_FAILED -3 +#define INSTPROXY_E_OP_IN_PROGRESS -4 +#define INSTPROXY_E_OP_FAILED -5 + +#define INSTPROXY_E_UNKNOWN_ERROR -256 + +typedef int16_t instproxy_error_t; + +struct instproxy_client_int; +typedef struct instproxy_client_int *instproxy_client_t; + +typedef void (*instproxy_status_cb_t) (const char *operation, plist_t status); + +/* Interface */ +instproxy_error_t instproxy_client_new(idevice_t device, uint16_t port, 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); +instproxy_error_t instproxy_install(instproxy_client_t client, const char *pkg_path, plist_t client_options, instproxy_status_cb_t status_cb); +instproxy_error_t instproxy_upgrade(instproxy_client_t client, const char *pkg_path, plist_t client_options, instproxy_status_cb_t status_cb); +instproxy_error_t instproxy_uninstall(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb); + +instproxy_error_t instproxy_lookup_archives(instproxy_client_t client, plist_t client_options, plist_t *result); +instproxy_error_t instproxy_archive(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb); +instproxy_error_t instproxy_restore(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb); +instproxy_error_t instproxy_remove_archive(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb); + +plist_t instproxy_client_options_new(); +void instproxy_client_options_add(plist_t client_options, ...) G_GNUC_NULL_TERMINATED; +void instproxy_client_options_free(plist_t client_options); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/libimobiledevice/libimobiledevice.h b/include/libimobiledevice/libimobiledevice.h new file mode 100644 index 0000000..87b078a --- /dev/null +++ b/include/libimobiledevice/libimobiledevice.h @@ -0,0 +1,102 @@ +/** + * @file libimobiledevice/libimobiledevice.h + * @brief Common code and device handling + * \internal + * + * Copyright (c) 2008 Jonathan Beck All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef LIBIMOBILEDEVICE_H +#define LIBIMOBILEDEVICE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include + +/* Error Codes */ +#define IDEVICE_E_SUCCESS 0 +#define IDEVICE_E_INVALID_ARG -1 +#define IDEVICE_E_UNKNOWN_ERROR -2 +#define IDEVICE_E_NO_DEVICE -3 +#define IDEVICE_E_NOT_ENOUGH_DATA -4 +#define IDEVICE_E_BAD_HEADER -5 +#define IDEVICE_E_SSL_ERROR -6 + +typedef int16_t idevice_error_t; + +struct idevice_int; +typedef struct idevice_int *idevice_t; + +struct idevice_connection_int; +typedef struct idevice_connection_int *idevice_connection_t; + +/* generic */ +void idevice_set_debug_level(int level); + +/* discovery (events/asynchronous) */ +// event type +enum idevice_event_type { + IDEVICE_DEVICE_ADD = 1, + IDEVICE_DEVICE_REMOVE +}; + +// event data structure +typedef struct { + enum idevice_event_type event; + const char *uuid; + int conn_type; +} idevice_event_t; + +// event callback function prototype +typedef void (*idevice_event_cb_t) (const idevice_event_t *event, void *user_data); + +// functions +idevice_error_t idevice_event_subscribe(idevice_event_cb_t callback, void *user_data); +idevice_error_t idevice_event_unsubscribe(); + +/* discovery (synchronous) */ +idevice_error_t idevice_get_device_list(char ***devices, int *count); +idevice_error_t idevice_device_list_free(char **devices); + +/* device structure creation and destruction */ +idevice_error_t idevice_new(idevice_t *device, const char *uuid); +idevice_error_t idevice_free(idevice_t device); + +/* connection/disconnection */ +idevice_error_t idevice_connect(idevice_t device, uint16_t port, idevice_connection_t *connection); +idevice_error_t idevice_disconnect(idevice_connection_t connection); + +/* communication */ +idevice_error_t idevice_connection_send(idevice_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes); +idevice_error_t idevice_connection_receive_timeout(idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout); +idevice_error_t idevice_connection_receive(idevice_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes); + +/* misc */ +idevice_error_t idevice_get_handle(idevice_t device, uint32_t *handle); +idevice_error_t idevice_get_uuid(idevice_t device, char **uuid); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/include/libimobiledevice/lockdown.h b/include/libimobiledevice/lockdown.h new file mode 100644 index 0000000..49c708d --- /dev/null +++ b/include/libimobiledevice/lockdown.h @@ -0,0 +1,99 @@ +/** + * @file libimobiledevice/lockdown.h + * @brief Communcation with the lockdown device daemon + * \internal + * + * Copyright (c) 2008 Zach C. All Rights Reserved. + * Copyright (c) 2009 Martin S. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef LOCKDOWN_H +#define LOCKDOWN_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* Error Codes */ +#define LOCKDOWN_E_SUCCESS 0 +#define LOCKDOWN_E_INVALID_ARG -1 +#define LOCKDOWN_E_INVALID_CONF -2 +#define LOCKDOWN_E_PLIST_ERROR -3 +#define LOCKDOWN_E_PAIRING_FAILED -4 +#define LOCKDOWN_E_SSL_ERROR -5 +#define LOCKDOWN_E_DICT_ERROR -6 +#define LOCKDOWN_E_START_SERVICE_FAILED -7 +#define LOCKDOWN_E_NOT_ENOUGH_DATA -8 +#define LOCKDOWN_E_SET_VALUE_PROHIBITED -9 +#define LOCKDOWN_E_GET_VALUE_PROHIBITED -10 +#define LOCKDOWN_E_REMOVE_VALUE_PROHIBITED -11 +#define LOCKDOWN_E_MUX_ERROR -12 +#define LOCKDOWN_E_ACTIVATION_FAILED -13 +#define LOCKDOWN_E_PASSWORD_PROTECTED -14 +#define LOCKDOWN_E_NO_RUNNING_SESSION -15 +#define LOCKDOWN_E_INVALID_HOST_ID -16 +#define LOCKDOWN_E_INVALID_SERVICE -17 + +#define LOCKDOWN_E_UNKNOWN_ERROR -256 + +typedef int16_t lockdownd_error_t; + +struct lockdownd_client_int; +typedef struct lockdownd_client_int *lockdownd_client_t; + +struct lockdownd_pair_record { + char *device_certificate; + char *host_certificate; + char *host_id; + char *root_certificate; +}; +typedef struct lockdownd_pair_record *lockdownd_pair_record_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); +lockdownd_error_t lockdownd_client_free(lockdownd_client_t client); + +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_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); +lockdownd_error_t lockdownd_receive(lockdownd_client_t client, plist_t *plist); +lockdownd_error_t lockdownd_pair(lockdownd_client_t client, lockdownd_pair_record_t pair_record); +lockdownd_error_t lockdownd_validate_pair(lockdownd_client_t client, lockdownd_pair_record_t pair_record); +lockdownd_error_t lockdownd_unpair(lockdownd_client_t client, lockdownd_pair_record_t pair_record); +lockdownd_error_t lockdownd_activate(lockdownd_client_t client, plist_t activation_record); +lockdownd_error_t lockdownd_deactivate(lockdownd_client_t client); +lockdownd_error_t lockdownd_enter_recovery(lockdownd_client_t client); +lockdownd_error_t lockdownd_goodbye(lockdownd_client_t client); + +/* Helper */ +void lockdownd_client_set_label(lockdownd_client_t client, const char *label); +lockdownd_error_t lockdownd_get_device_uuid(lockdownd_client_t control, char **uuid); +lockdownd_error_t lockdownd_get_device_name(lockdownd_client_t client, char **device_name); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/libimobiledevice/mobilebackup.h b/include/libimobiledevice/mobilebackup.h new file mode 100644 index 0000000..e51d4c1 --- /dev/null +++ b/include/libimobiledevice/mobilebackup.h @@ -0,0 +1,55 @@ +/** + * @file libimobiledevice/mobilebackup.h + * @brief MobileBackup Implementation + * \internal + * + * Copyright (c) 2009 Martin Szulecki All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef IMOBILEBACKUP_H +#define IMOBILEBACKUP_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* Error Codes */ +#define MOBILEBACKUP_E_SUCCESS 0 +#define MOBILEBACKUP_E_INVALID_ARG -1 +#define MOBILEBACKUP_E_PLIST_ERROR -2 +#define MOBILEBACKUP_E_MUX_ERROR -3 +#define MOBILEBACKUP_E_BAD_VERSION -4 + +#define MOBILEBACKUP_E_UNKNOWN_ERROR -256 + +typedef int16_t mobilebackup_error_t; + +struct mobilebackup_client_int; +typedef struct mobilebackup_client_int *mobilebackup_client_t; + +mobilebackup_error_t mobilebackup_client_new(idevice_t device, uint16_t port, 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); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/libimobiledevice/mobilesync.h b/include/libimobiledevice/mobilesync.h new file mode 100644 index 0000000..349b6a3 --- /dev/null +++ b/include/libimobiledevice/mobilesync.h @@ -0,0 +1,55 @@ +/** + * @file libimobiledevice/mobilesync.h + * @brief MobileSync Implementation + * \internal + * + * Copyright (c) 2009 Jonathan Beck All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef IMOBILESYNC_H +#define IMOBILESYNC_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* Error Codes */ +#define MOBILESYNC_E_SUCCESS 0 +#define MOBILESYNC_E_INVALID_ARG -1 +#define MOBILESYNC_E_PLIST_ERROR -2 +#define MOBILESYNC_E_MUX_ERROR -3 +#define MOBILESYNC_E_BAD_VERSION -4 + +#define MOBILESYNC_E_UNKNOWN_ERROR -256 + +typedef int16_t mobilesync_error_t; + +struct mobilesync_client_int; +typedef struct mobilesync_client_int *mobilesync_client_t; + +mobilesync_error_t mobilesync_client_new(idevice_t device, uint16_t port, 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); +mobilesync_error_t mobilesync_send(mobilesync_client_t client, plist_t plist); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/libimobiledevice/notification_proxy.h b/include/libimobiledevice/notification_proxy.h new file mode 100644 index 0000000..adbb4cc --- /dev/null +++ b/include/libimobiledevice/notification_proxy.h @@ -0,0 +1,88 @@ +/** + * @file libimobiledevice/notification_proxy.h + * @brief Implementation to talk to the notification proxy on a device + * \internal + * + * Copyright (c) 2009 Nikias Bassen All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef NOTIFICATION_PROXY_H +#define NOTIFICATION_PROXY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* Error Codes */ +#define NP_E_SUCCESS 0 +#define NP_E_INVALID_ARG -1 +#define NP_E_PLIST_ERROR -2 +#define NP_E_CONN_FAILED -3 + +#define NP_E_UNKNOWN_ERROR -256 + +typedef int16_t np_error_t; + +/* Notification IDs for use with post_notification (client --> device) */ +#define NP_SYNC_WILL_START "com.apple.itunes-mobdev.syncWillStart" +#define NP_SYNC_DID_START "com.apple.itunes-mobdev.syncDidStart" +#define NP_SYNC_DID_FINISH "com.apple.itunes-mobdev.syncDidFinish" +#define NP_SYNC_LOCK_REQUEST "com.apple.itunes-mobdev.syncLockRequest" + +/* Notification IDs for use with observe_notification (device --> client) */ +#define NP_SYNC_CANCEL_REQUEST "com.apple.itunes-client.syncCancelRequest" +#define NP_SYNC_SUSPEND_REQUEST "com.apple.itunes-client.syncSuspendRequest" +#define NP_SYNC_RESUME_REQUEST "com.apple.itunes-client.syncResumeRequest" +#define NP_PHONE_NUMBER_CHANGED "com.apple.mobile.lockdown.phone_number_changed" +#define NP_DEVICE_NAME_CHANGED "com.apple.mobile.lockdown.device_name_changed" +#define NP_TIMEZONE_CHANGED "com.apple.mobile.lockdown.timezone_changed" +#define NP_TRUSTED_HOST_ATTACHED "com.apple.mobile.lockdown.trusted_host_attached" +#define NP_HOST_DETACHED "com.apple.mobile.lockdown.host_detached" +#define NP_HOST_ATTACHED "com.apple.mobile.lockdown.host_attached" +#define NP_REGISTRATION_FAILED "com.apple.mobile.lockdown.registration_failed" +#define NP_ACTIVATION_STATE "com.apple.mobile.lockdown.activation_state" +#define NP_BRICK_STATE "com.apple.mobile.lockdown.brick_state" +#define NP_DS_DOMAIN_CHANGED "com.apple.mobile.data_sync.domain_changed" +#define NP_BACKUP_DOMAIN_CHANGED "com.apple.mobile.backup.domain_changed" +#define NP_APP_INSTALLED "com.apple.mobile.application_installed" +#define NP_APP_UNINSTALLED "com.apple.mobile.application_uninstalled" +#define NP_DEV_IMAGE_MOUNTED "com.apple.mobile.developer_image_mounted" +#define NP_ATTEMPTACTIVATION "com.apple.springboard.attemptactivation" +#define NP_ITDBPREP_DID_END "com.apple.itdbprep.notification.didEnd" +#define NP_LANGUAGE_CHANGED "com.apple.language.changed" +#define NP_ADDRESS_BOOK_PREF_CHANGED "com.apple.AddressBook.PreferenceChanged" + +struct np_client_int; +typedef struct np_client_int *np_client_t; + +typedef void (*np_notify_cb_t) (const char *notification); + +/* Interface */ +np_error_t np_client_new(idevice_t device, uint16_t port, 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); +np_error_t np_observe_notifications(np_client_t client, const char **notification_spec); +np_error_t np_set_notify_callback(np_client_t client, np_notify_cb_t notify_cb); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/libimobiledevice/sbservices.h b/include/libimobiledevice/sbservices.h new file mode 100644 index 0000000..921d6be --- /dev/null +++ b/include/libimobiledevice/sbservices.h @@ -0,0 +1,56 @@ +/** + * @file libimobiledevice/sbservices.h + * @brief Implementation to talk to com.apple.springboardservices on a device + * \internal + * + * Copyright (c) 2009 Nikias Bassen All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SB_SERVICES_H +#define SB_SERVICES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* Error Codes */ +#define SBSERVICES_E_SUCCESS 0 +#define SBSERVICES_E_INVALID_ARG -1 +#define SBSERVICES_E_PLIST_ERROR -2 +#define SBSERVICES_E_CONN_FAILED -3 + +#define SBSERVICES_E_UNKNOWN_ERROR -256 + +typedef int16_t sbservices_error_t; + +struct sbservices_client_int; +typedef struct sbservices_client_int *sbservices_client_t; + +/* Interface */ +sbservices_error_t sbservices_client_new(idevice_t device, uint16_t port, 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); +sbservices_error_t sbservices_set_icon_state(sbservices_client_t client, plist_t newstate); +sbservices_error_t sbservices_get_icon_pngdata(sbservices_client_t client, const char *bundleId, char **pngdata, uint64_t *pngsize); + +#ifdef __cplusplus +} +#endif + +#endif -- cgit v1.1-32-gdbae