diff options
| author | 2009-07-26 19:34:22 -0700 | |
|---|---|---|
| committer | 2009-07-26 19:34:22 -0700 | |
| commit | eea538c94f01f8054f69f059614f19400187a472 (patch) | |
| tree | 209a12dc8c8eaece15b8153d15e689c8c2147ab6 /include/libiphone | |
| parent | 8ebfd7d8eea89bb27e4e6dbb1f37fd90d98b439c (diff) | |
| parent | 19c9750d670435ce430f0fc85a55faf127bdfbf9 (diff) | |
| download | libimobiledevice-eea538c94f01f8054f69f059614f19400187a472.tar.gz libimobiledevice-eea538c94f01f8054f69f059614f19400187a472.tar.bz2 | |
Merge commit 'martin-s/martin'
[#46 state:resolved]
Diffstat (limited to 'include/libiphone')
| -rw-r--r-- | include/libiphone/afc.h | 103 | ||||
| -rw-r--r-- | include/libiphone/libiphone.h | 41 | ||||
| -rw-r--r-- | include/libiphone/lockdown.h | 58 | ||||
| -rw-r--r-- | include/libiphone/mobilesync.h | 55 | ||||
| -rw-r--r-- | include/libiphone/notification_proxy.h | 57 |
5 files changed, 234 insertions, 80 deletions
diff --git a/include/libiphone/afc.h b/include/libiphone/afc.h index 2a0bbad..71730cc 100644 --- a/include/libiphone/afc.h +++ b/include/libiphone/afc.h | |||
| @@ -1,3 +1,25 @@ | |||
| 1 | /** | ||
| 2 | * @file libiphone/afc.h | ||
| 3 | * @brief AFC Implementation | ||
| 4 | * \internal | ||
| 5 | * | ||
| 6 | * Copyright (c) 2009 Nikias Bassen All Rights Reserved. | ||
| 7 | * | ||
| 8 | * This library is free software; you can redistribute it and/or | ||
| 9 | * modify it under the terms of the GNU Lesser General Public | ||
| 10 | * License as published by the Free Software Foundation; either | ||
| 11 | * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | * | ||
| 13 | * This library is distributed in the hope that it will be useful, | ||
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | * Lesser General Public License for more details. | ||
| 17 | * | ||
| 18 | * You should have received a copy of the GNU Lesser General Public | ||
| 19 | * License along with this library; if not, write to the Free Software | ||
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | */ | ||
| 22 | |||
| 1 | #ifndef AFC_H | 23 | #ifndef AFC_H |
| 2 | #define AFC_H | 24 | #define AFC_H |
| 3 | 25 | ||
| @@ -7,6 +29,39 @@ extern "C" { | |||
| 7 | 29 | ||
| 8 | #include <libiphone/libiphone.h> | 30 | #include <libiphone/libiphone.h> |
| 9 | 31 | ||
| 32 | /* Error Codes */ | ||
| 33 | #define AFC_E_SUCCESS 0 | ||
| 34 | #define AFC_E_UNKNOWN_ERROR 1 | ||
| 35 | #define AFC_E_OP_HEADER_INVALID 2 | ||
| 36 | #define AFC_E_NO_RESOURCES 3 | ||
| 37 | #define AFC_E_READ_ERROR 4 | ||
| 38 | #define AFC_E_WRITE_ERROR 5 | ||
| 39 | #define AFC_E_UNKNOWN_PACKET_TYPE 6 | ||
| 40 | #define AFC_E_INVALID_ARGUMENT 7 | ||
| 41 | #define AFC_E_OBJECT_NOT_FOUND 8 | ||
| 42 | #define AFC_E_OBJECT_IS_DIR 9 | ||
| 43 | #define AFC_E_PERM_DENIED 10 | ||
| 44 | #define AFC_E_SERVICE_NOT_CONNECTED 11 | ||
| 45 | #define AFC_E_OP_TIMEOUT 12 | ||
| 46 | #define AFC_E_TOO_MUCH_DATA 13 | ||
| 47 | #define AFC_E_END_OF_DATA 14 | ||
| 48 | #define AFC_E_OP_NOT_SUPPORTED 15 | ||
| 49 | #define AFC_E_OBJECT_EXISTS 16 | ||
| 50 | #define AFC_E_OBJECT_BUSY 17 | ||
| 51 | #define AFC_E_NO_SPACE_LEFT 18 | ||
| 52 | #define AFC_E_OP_WOULD_BLOCK 19 | ||
| 53 | #define AFC_E_IO_ERROR 20 | ||
| 54 | #define AFC_E_OP_INTERRUPTED 21 | ||
| 55 | #define AFC_E_OP_IN_PROGRESS 22 | ||
| 56 | #define AFC_E_INTERNAL_ERROR 23 | ||
| 57 | |||
| 58 | #define AFC_E_MUX_ERROR 30 | ||
| 59 | #define AFC_E_NO_MEM 31 | ||
| 60 | #define AFC_E_NOT_ENOUGH_DATA 32 | ||
| 61 | |||
| 62 | typedef int16_t afc_error_t; | ||
| 63 | |||
| 64 | /* Flags */ | ||
| 10 | typedef enum { | 65 | typedef enum { |
| 11 | AFC_FOPEN_RDONLY = 0x00000001, // r O_RDONLY | 66 | AFC_FOPEN_RDONLY = 0x00000001, // r O_RDONLY |
| 12 | AFC_FOPEN_RW = 0x00000002, // r+ O_RDWR | O_CREAT | 67 | AFC_FOPEN_RW = 0x00000002, // r+ O_RDWR | O_CREAT |
| @@ -21,31 +76,35 @@ typedef enum { | |||
| 21 | AFC_SYMLINK = 2 | 76 | AFC_SYMLINK = 2 |
| 22 | } afc_link_type_t; | 77 | } afc_link_type_t; |
| 23 | 78 | ||
| 79 | typedef enum { | ||
| 80 | AFC_LOCK_SH = 1 | 4, // shared lock | ||
| 81 | AFC_LOCK_EX = 2 | 4, // exclusive lock | ||
| 82 | AFC_LOCK_UN = 8 | 4 // unlock | ||
| 83 | } afc_lock_op_t; | ||
| 84 | |||
| 24 | struct afc_client_int; | 85 | struct afc_client_int; |
| 25 | typedef struct afc_client_int *afc_client_t; | 86 | typedef struct afc_client_int *afc_client_t; |
| 26 | 87 | ||
| 27 | //afc related functions | 88 | /* Interface */ |
| 28 | iphone_error_t afc_new_client ( iphone_device_t device, int dst_port, afc_client_t *client ); | 89 | afc_error_t afc_client_new(iphone_device_t device, int dst_port, afc_client_t *client); |
| 29 | iphone_error_t afc_free_client ( afc_client_t client ); | 90 | afc_error_t afc_client_free(afc_client_t client); |
| 30 | int afc_get_afcerror ( afc_client_t client ); | 91 | afc_error_t afc_get_device_info(afc_client_t client, char ***infos); |
| 31 | int afc_get_errno ( afc_client_t client ); | 92 | afc_error_t afc_read_directory(afc_client_t client, const char *dir, char ***list); |
| 32 | 93 | afc_error_t afc_get_file_info(afc_client_t client, const char *filename, char ***infolist); | |
| 33 | iphone_error_t afc_get_devinfo ( afc_client_t client, char ***infos ); | 94 | afc_error_t afc_get_connection_info(afc_client_t client, char ***infolist); |
| 34 | iphone_error_t afc_get_dir_list ( afc_client_t client, const char *dir, char ***list); | 95 | afc_error_t afc_file_open(afc_client_t client, const char *filename, afc_file_mode_t file_mode, uint64_t *handle); |
| 35 | 96 | afc_error_t afc_file_close(afc_client_t client, uint64_t handle); | |
| 36 | iphone_error_t afc_get_file_info ( afc_client_t client, const char *filename, char ***infolist ); | 97 | afc_error_t afc_file_lock(afc_client_t client, uint64_t handle, afc_lock_op_t operation); |
| 37 | iphone_error_t afc_open_file ( afc_client_t client, const char *filename, afc_file_mode_t file_mode, uint64_t *handle ); | 98 | afc_error_t afc_file_read(afc_client_t client, uint64_t handle, char *data, int length, uint32_t *bytes); |
| 38 | iphone_error_t afc_close_file ( afc_client_t client, uint64_t handle); | 99 | afc_error_t afc_file_write(afc_client_t client, uint64_t handle, const char *data, int length, uint32_t *bytes); |
| 39 | iphone_error_t afc_lock_file ( afc_client_t client, uint64_t handle, int operation); | 100 | afc_error_t afc_file_seek(afc_client_t client, uint64_t handle, int64_t offset, int whence); |
| 40 | iphone_error_t afc_read_file ( afc_client_t client, uint64_t handle, char *data, int length, uint32_t *bytes); | 101 | afc_error_t afc_file_tell(afc_client_t client, uint64_t handle, uint64_t *position); |
| 41 | iphone_error_t afc_write_file ( afc_client_t client, uint64_t handle, const char *data, int length, uint32_t *bytes); | 102 | afc_error_t afc_file_truncate(afc_client_t client, uint64_t handle, uint64_t newsize); |
| 42 | iphone_error_t afc_seek_file ( afc_client_t client, uint64_t handle, int64_t offset, int whence); | 103 | afc_error_t afc_remove_path(afc_client_t client, const char *path); |
| 43 | iphone_error_t afc_truncate_file ( afc_client_t client, uint64_t handle, uint64_t newsize); | 104 | afc_error_t afc_rename_path(afc_client_t client, const char *from, const char *to); |
| 44 | iphone_error_t afc_delete_file ( afc_client_t client, const char *path); | 105 | afc_error_t afc_make_directory(afc_client_t client, const char *dir); |
| 45 | iphone_error_t afc_rename_file ( afc_client_t client, const char *from, const char *to); | 106 | afc_error_t afc_truncate(afc_client_t client, const char *path, off_t newsize); |
| 46 | iphone_error_t afc_mkdir ( afc_client_t client, const char *dir); | 107 | afc_error_t afc_make_link(afc_client_t client, afc_link_type_t linktype, const char *target, const char *linkname); |
| 47 | iphone_error_t afc_truncate ( afc_client_t client, const char *path, off_t newsize); | ||
| 48 | iphone_error_t afc_make_link ( afc_client_t client, afc_link_type_t linktype, const char *target, const char *linkname); | ||
| 49 | 108 | ||
| 50 | #ifdef __cplusplus | 109 | #ifdef __cplusplus |
| 51 | } | 110 | } |
diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h index fa26d14..1451f15 100644 --- a/include/libiphone/libiphone.h +++ b/include/libiphone/libiphone.h | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* | 1 | /** |
| 2 | * libiphone.h | 2 | * @file libiphone/libiphone.h |
| 3 | * Main include of libiphone | 3 | * @brief Common code and device handling |
| 4 | * \internal | ||
| 4 | * | 5 | * |
| 5 | * Copyright (c) 2008 Jonathan Beck All Rights Reserved. | 6 | * Copyright (c) 2008 Jonathan Beck All Rights Reserved. |
| 6 | * | 7 | * |
| @@ -32,46 +33,34 @@ extern "C" { | |||
| 32 | #include <plist/plist.h> | 33 | #include <plist/plist.h> |
| 33 | #include <usbmuxd.h> | 34 | #include <usbmuxd.h> |
| 34 | 35 | ||
| 35 | //general errors | 36 | /* Error Codes */ |
| 36 | #define IPHONE_E_SUCCESS 0 | 37 | #define IPHONE_E_SUCCESS 0 |
| 37 | #define IPHONE_E_INVALID_ARG -1 | 38 | #define IPHONE_E_INVALID_ARG -1 |
| 38 | #define IPHONE_E_UNKNOWN_ERROR -2 | 39 | #define IPHONE_E_UNKNOWN_ERROR -2 |
| 39 | #define IPHONE_E_NO_DEVICE -3 | 40 | #define IPHONE_E_NO_DEVICE -3 |
| 40 | #define IPHONE_E_TIMEOUT -4 | 41 | #define IPHONE_E_NOT_ENOUGH_DATA -4 |
| 41 | #define IPHONE_E_NOT_ENOUGH_DATA -5 | 42 | #define IPHONE_E_BAD_HEADER -5 |
| 42 | #define IPHONE_E_BAD_HEADER -6 | ||
| 43 | |||
| 44 | //lockdownd specific error | ||
| 45 | #define IPHONE_E_INVALID_CONF -7 | ||
| 46 | #define IPHONE_E_PAIRING_FAILED -8 | ||
| 47 | #define IPHONE_E_SSL_ERROR -9 | ||
| 48 | #define IPHONE_E_PLIST_ERROR -10 | ||
| 49 | #define IPHONE_E_DICT_ERROR -11 | ||
| 50 | #define IPHONE_E_START_SERVICE_FAILED -12 | ||
| 51 | |||
| 52 | //afc specific error | ||
| 53 | #define IPHONE_E_AFC_ERROR -13 | ||
| 54 | 43 | ||
| 55 | typedef int16_t iphone_error_t; | 44 | typedef int16_t iphone_error_t; |
| 56 | 45 | ||
| 57 | struct iphone_device_int; | 46 | struct iphone_device_int; |
| 58 | typedef struct iphone_device_int *iphone_device_t; | 47 | typedef struct iphone_device_int *iphone_device_t; |
| 59 | 48 | ||
| 60 | //debug related functions | 49 | /* Debugging */ |
| 61 | #define DBGMASK_ALL 0xFFFF | 50 | #define DBGMASK_ALL 0xFFFF |
| 62 | #define DBGMASK_NONE 0x0000 | 51 | #define DBGMASK_NONE 0x0000 |
| 63 | #define DBGMASK_USBMUX (1 << 1) | 52 | #define DBGMASK_LOCKDOWND (1 << 1) |
| 64 | #define DBGMASK_LOCKDOWND (1 << 2) | 53 | #define DBGMASK_MOBILESYNC (1 << 2) |
| 65 | #define DBGMASK_MOBILESYNC (1 << 3) | ||
| 66 | 54 | ||
| 67 | void iphone_set_debug_mask(uint16_t mask); | 55 | void iphone_set_debug_mask(uint16_t mask); |
| 68 | void iphone_set_debug(int level); | 56 | void iphone_set_debug_level(int level); |
| 69 | 57 | ||
| 70 | //device related functions | 58 | /* Interface */ |
| 71 | iphone_error_t iphone_get_device(iphone_device_t *device); | 59 | iphone_error_t iphone_get_device(iphone_device_t *device); |
| 72 | iphone_error_t iphone_get_device_by_uuid(iphone_device_t *device, const char *uuid); | 60 | iphone_error_t iphone_get_device_by_uuid(iphone_device_t *device, const char *uuid); |
| 73 | iphone_error_t iphone_free_device(iphone_device_t device); | 61 | iphone_error_t iphone_device_free(iphone_device_t device); |
| 74 | uint32_t iphone_get_device_handle(iphone_device_t device); | 62 | iphone_error_t iphone_device_get_handle(iphone_device_t device, uint32_t *handle); |
| 63 | iphone_error_t iphone_device_get_uuid(iphone_device_t device, char **uuid); | ||
| 75 | 64 | ||
| 76 | #ifdef __cplusplus | 65 | #ifdef __cplusplus |
| 77 | } | 66 | } |
diff --git a/include/libiphone/lockdown.h b/include/libiphone/lockdown.h index 20ccf77..af58190 100644 --- a/include/libiphone/lockdown.h +++ b/include/libiphone/lockdown.h | |||
| @@ -1,6 +1,9 @@ | |||
| 1 | /* | 1 | /** |
| 2 | * lockdownd.h | 2 | * @file libiphone/lockdown.h |
| 3 | * @brief Communcation with the lockdown device daemon | ||
| 4 | * \internal | ||
| 3 | * | 5 | * |
| 6 | * Copyright (c) 2008 Zach C. All Rights Reserved. | ||
| 4 | * Copyright (c) 2009 Martin S. All Rights Reserved. | 7 | * Copyright (c) 2009 Martin S. All Rights Reserved. |
| 5 | * | 8 | * |
| 6 | * This library is free software; you can redistribute it and/or | 9 | * This library is free software; you can redistribute it and/or |
| @@ -27,25 +30,44 @@ extern "C" { | |||
| 27 | 30 | ||
| 28 | #include <libiphone/libiphone.h> | 31 | #include <libiphone/libiphone.h> |
| 29 | 32 | ||
| 33 | /* Error Codes */ | ||
| 34 | #define LOCKDOWN_E_SUCCESS 0 | ||
| 35 | #define LOCKDOWN_E_INVALID_ARG -1 | ||
| 36 | #define LOCKDOWN_E_INVALID_CONF -2 | ||
| 37 | #define LOCKDOWN_E_PLIST_ERROR -3 | ||
| 38 | #define LOCKDOWN_E_PAIRING_FAILED -4 | ||
| 39 | #define LOCKDOWN_E_SSL_ERROR -5 | ||
| 40 | #define LOCKDOWN_E_DICT_ERROR -6 | ||
| 41 | #define LOCKDOWN_E_START_SERVICE_FAILED -7 | ||
| 42 | #define LOCKDOWN_E_NOT_ENOUGH_DATA -8 | ||
| 43 | #define LOCKDOWN_E_SET_VALUE_PROHIBITED -9 | ||
| 44 | #define LOCKDOWN_E_GET_VALUE_PROHIBITED -10 | ||
| 45 | #define LOCKDOWN_E_REMOVE_VALUE_PROHIBITED -11 | ||
| 46 | #define LOCKDOWN_E_MUX_ERROR -12 | ||
| 47 | |||
| 48 | #define LOCKDOWN_E_UNKNOWN_ERROR -256 | ||
| 49 | |||
| 50 | typedef int16_t lockdownd_error_t; | ||
| 51 | |||
| 30 | struct lockdownd_client_int; | 52 | struct lockdownd_client_int; |
| 31 | typedef struct lockdownd_client_int *lockdownd_client_t; | 53 | typedef struct lockdownd_client_int *lockdownd_client_t; |
| 32 | 54 | ||
| 33 | //lockdownd related functions | 55 | /* Interface */ |
| 34 | iphone_error_t lockdownd_new_client (iphone_device_t device, lockdownd_client_t *client); | 56 | lockdownd_error_t lockdownd_client_new(iphone_device_t device, lockdownd_client_t *client); |
| 35 | iphone_error_t lockdownd_free_client(lockdownd_client_t client); | 57 | lockdownd_error_t lockdownd_client_free(lockdownd_client_t client); |
| 36 | iphone_error_t lockdownd_query_type(lockdownd_client_t client); | 58 | lockdownd_error_t lockdownd_query_type(lockdownd_client_t client); |
| 37 | iphone_error_t lockdownd_get_value(lockdownd_client_t client, const char *domain, const char *key, plist_t *value); | 59 | lockdownd_error_t lockdownd_get_value(lockdownd_client_t client, const char *domain, const char *key, plist_t *value); |
| 38 | iphone_error_t lockdownd_set_value(lockdownd_client_t client, const char *domain, const char *key, plist_t value); | 60 | lockdownd_error_t lockdownd_set_value(lockdownd_client_t client, const char *domain, const char *key, plist_t value); |
| 39 | iphone_error_t lockdownd_remove_value(lockdownd_client_t client, const char *domain, const char *key); | 61 | lockdownd_error_t lockdownd_remove_value(lockdownd_client_t client, const char *domain, const char *key); |
| 40 | iphone_error_t lockdownd_start_service (lockdownd_client_t client, const char *service, int *port); | 62 | lockdownd_error_t lockdownd_start_service(lockdownd_client_t client, const char *service, int *port); |
| 41 | iphone_error_t lockdownd_stop_session(lockdownd_client_t client); | 63 | lockdownd_error_t lockdownd_stop_session(lockdownd_client_t client, const char *session_id); |
| 42 | iphone_error_t lockdownd_send (lockdownd_client_t client, plist_t plist); | 64 | lockdownd_error_t lockdownd_send(lockdownd_client_t client, plist_t plist); |
| 43 | iphone_error_t lockdownd_recv (lockdownd_client_t client, plist_t *plist); | 65 | lockdownd_error_t lockdownd_recv(lockdownd_client_t client, plist_t *plist); |
| 44 | iphone_error_t lockdownd_pair(lockdownd_client_t client, char *uid, char *host_id); | 66 | lockdownd_error_t lockdownd_pair(lockdownd_client_t client, char *uuid, char *host_id); |
| 45 | iphone_error_t lockdownd_get_device_uid (lockdownd_client_t control, char **uid); | 67 | lockdownd_error_t lockdownd_get_device_uuid(lockdownd_client_t control, char **uuid); |
| 46 | iphone_error_t lockdownd_get_device_name (lockdownd_client_t client, char **device_name); | 68 | lockdownd_error_t lockdownd_get_device_name(lockdownd_client_t client, char **device_name); |
| 47 | iphone_error_t lockdownd_enter_recovery(lockdownd_client_t client); | 69 | lockdownd_error_t lockdownd_enter_recovery(lockdownd_client_t client); |
| 48 | iphone_error_t lockdownd_goodbye(lockdownd_client_t client); | 70 | lockdownd_error_t lockdownd_goodbye(lockdownd_client_t client); |
| 49 | 71 | ||
| 50 | #ifdef __cplusplus | 72 | #ifdef __cplusplus |
| 51 | } | 73 | } |
diff --git a/include/libiphone/mobilesync.h b/include/libiphone/mobilesync.h new file mode 100644 index 0000000..662036c --- /dev/null +++ b/include/libiphone/mobilesync.h | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | /** | ||
| 2 | * @file libiphone/mobilesync.h | ||
| 3 | * @brief MobileSync Implementation | ||
| 4 | * \internal | ||
| 5 | * | ||
| 6 | * Copyright (c) 2009 Jonathan Beck All Rights Reserved. | ||
| 7 | * | ||
| 8 | * This library is free software; you can redistribute it and/or | ||
| 9 | * modify it under the terms of the GNU Lesser General Public | ||
| 10 | * License as published by the Free Software Foundation; either | ||
| 11 | * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | * | ||
| 13 | * This library is distributed in the hope that it will be useful, | ||
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | * Lesser General Public License for more details. | ||
| 17 | * | ||
| 18 | * You should have received a copy of the GNU Lesser General Public | ||
| 19 | * License along with this library; if not, write to the Free Software | ||
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | */ | ||
| 22 | |||
| 23 | #ifndef IMOBILESYNC_H | ||
| 24 | #define IMOBILESYNC_H | ||
| 25 | |||
| 26 | #ifdef __cplusplus | ||
| 27 | extern "C" { | ||
| 28 | #endif | ||
| 29 | |||
| 30 | #include <libiphone/libiphone.h> | ||
| 31 | |||
| 32 | /* Error Codes */ | ||
| 33 | #define MOBILESYNC_E_SUCCESS 0 | ||
| 34 | #define MOBILESYNC_E_INVALID_ARG -1 | ||
| 35 | #define MOBILESYNC_E_PLIST_ERROR -2 | ||
| 36 | #define MOBILESYNC_E_MUX_ERROR -3 | ||
| 37 | #define MOBILESYNC_E_BAD_VERSION -4 | ||
| 38 | |||
| 39 | #define MOBILESYNC_E_UNKNOWN_ERROR -256 | ||
| 40 | |||
| 41 | typedef int16_t mobilesync_error_t; | ||
| 42 | |||
| 43 | struct mobilesync_client_int; | ||
| 44 | typedef struct mobilesync_client_int *mobilesync_client_t; | ||
| 45 | |||
| 46 | mobilesync_error_t mobilesync_client_new(iphone_device_t device, int dst_port, mobilesync_client_t * client); | ||
| 47 | mobilesync_error_t mobilesync_client_free(mobilesync_client_t client); | ||
| 48 | mobilesync_error_t mobilesync_recv(mobilesync_client_t client, plist_t *plist); | ||
| 49 | mobilesync_error_t mobilesync_send(mobilesync_client_t client, plist_t plist); | ||
| 50 | |||
| 51 | #ifdef __cplusplus | ||
| 52 | } | ||
| 53 | #endif | ||
| 54 | |||
| 55 | #endif | ||
diff --git a/include/libiphone/notification_proxy.h b/include/libiphone/notification_proxy.h index 9412b4f..66b7a80 100644 --- a/include/libiphone/notification_proxy.h +++ b/include/libiphone/notification_proxy.h | |||
| @@ -1,3 +1,25 @@ | |||
| 1 | /** | ||
| 2 | * @file libiphone/notification_proxy.h | ||
| 3 | * @brief Implementation to talk to the notification proxy on a device | ||
| 4 | * \internal | ||
| 5 | * | ||
| 6 | * Copyright (c) 2009 Nikias Bassen All Rights Reserved. | ||
| 7 | * | ||
| 8 | * This library is free software; you can redistribute it and/or | ||
| 9 | * modify it under the terms of the GNU Lesser General Public | ||
| 10 | * License as published by the Free Software Foundation; either | ||
| 11 | * version 2.1 of the License, or (at your option) any later version. | ||
| 12 | * | ||
| 13 | * This library is distributed in the hope that it will be useful, | ||
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | * Lesser General Public License for more details. | ||
| 17 | * | ||
| 18 | * You should have received a copy of the GNU Lesser General Public | ||
| 19 | * License along with this library; if not, write to the Free Software | ||
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 21 | */ | ||
| 22 | |||
| 1 | #ifndef NOTIFICATION_PROXY_H | 23 | #ifndef NOTIFICATION_PROXY_H |
| 2 | #define NOTIFICATION_PROXY_H | 24 | #define NOTIFICATION_PROXY_H |
| 3 | 25 | ||
| @@ -7,16 +29,21 @@ extern "C" { | |||
| 7 | 29 | ||
| 8 | #include <libiphone/libiphone.h> | 30 | #include <libiphone/libiphone.h> |
| 9 | 31 | ||
| 10 | struct np_client_int; | 32 | /* Error Codes */ |
| 11 | typedef struct np_client_int *np_client_t; | 33 | #define NP_E_SUCCESS 0 |
| 34 | #define NP_E_INVALID_ARG -1 | ||
| 35 | #define NP_E_PLIST_ERROR -2 | ||
| 36 | |||
| 37 | #define NP_E_UNKNOWN_ERROR -256 | ||
| 38 | |||
| 39 | typedef int16_t np_error_t; | ||
| 12 | 40 | ||
| 13 | // NotificationProxy related | 41 | /* Notification IDs for use with post_notification (client --> device) */ |
| 14 | // notifications for use with post_notification (client --> device) | ||
| 15 | #define NP_SYNC_WILL_START "com.apple.itunes-mobdev.syncWillStart" | 42 | #define NP_SYNC_WILL_START "com.apple.itunes-mobdev.syncWillStart" |
| 16 | #define NP_SYNC_DID_START "com.apple.itunes-mobdev.syncDidStart" | 43 | #define NP_SYNC_DID_START "com.apple.itunes-mobdev.syncDidStart" |
| 17 | #define NP_SYNC_DID_FINISH "com.apple.itunes-mobdev.syncDidFinish" | 44 | #define NP_SYNC_DID_FINISH "com.apple.itunes-mobdev.syncDidFinish" |
| 18 | 45 | ||
| 19 | // notifications for use with observe_notification (device --> client) | 46 | /* Notification IDs for use with observe_notification (device --> client) */ |
| 20 | #define NP_SYNC_CANCEL_REQUEST "com.apple.itunes-client.syncCancelRequest" | 47 | #define NP_SYNC_CANCEL_REQUEST "com.apple.itunes-client.syncCancelRequest" |
| 21 | #define NP_SYNC_SUSPEND_REQUEST "com.apple.itunes-client.syncSuspendRequest" | 48 | #define NP_SYNC_SUSPEND_REQUEST "com.apple.itunes-client.syncSuspendRequest" |
| 22 | #define NP_SYNC_RESUME_REQUEST "com.apple.itunes-client.syncResumeRequest" | 49 | #define NP_SYNC_RESUME_REQUEST "com.apple.itunes-client.syncResumeRequest" |
| @@ -26,18 +53,20 @@ typedef struct np_client_int *np_client_t; | |||
| 26 | #define NP_DS_DOMAIN_CHANGED "com.apple.mobile.data_sync.domain_changed" | 53 | #define NP_DS_DOMAIN_CHANGED "com.apple.mobile.data_sync.domain_changed" |
| 27 | #define NP_APP_INSTALLED "com.apple.mobile.application_installed" | 54 | #define NP_APP_INSTALLED "com.apple.mobile.application_installed" |
| 28 | #define NP_APP_UNINSTALLED "com.apple.mobile.application_uninstalled" | 55 | #define NP_APP_UNINSTALLED "com.apple.mobile.application_uninstalled" |
| 56 | #define NP_ITDBPREP_DID_END "com.apple.itdbprep.notification.didEnd" | ||
| 29 | 57 | ||
| 30 | iphone_error_t np_new_client ( iphone_device_t device, int dst_port, np_client_t *client ); | 58 | struct np_client_int; |
| 31 | iphone_error_t np_free_client ( np_client_t client ); | 59 | typedef struct np_client_int *np_client_t; |
| 32 | |||
| 33 | iphone_error_t np_post_notification ( np_client_t client, const char *notification ); | ||
| 34 | |||
| 35 | iphone_error_t np_observe_notification ( np_client_t client, const char *notification ); | ||
| 36 | iphone_error_t np_observe_notifications ( np_client_t client, const char **notification_spec ); | ||
| 37 | 60 | ||
| 38 | typedef void (*np_notify_cb_t) ( const char *notification ); | 61 | typedef void (*np_notify_cb_t) (const char *notification); |
| 39 | 62 | ||
| 40 | iphone_error_t np_set_notify_callback ( np_client_t client, np_notify_cb_t notify_cb ); | 63 | /* Interface */ |
| 64 | np_error_t np_client_new(iphone_device_t device, int dst_port, np_client_t *client); | ||
| 65 | np_error_t np_client_free(np_client_t client); | ||
| 66 | np_error_t np_post_notification(np_client_t client, const char *notification); | ||
| 67 | np_error_t np_observe_notification(np_client_t client, const char *notification); | ||
| 68 | np_error_t np_observe_notifications(np_client_t client, const char **notification_spec); | ||
| 69 | np_error_t np_set_notify_callback(np_client_t client, np_notify_cb_t notify_cb); | ||
| 41 | 70 | ||
| 42 | #ifdef __cplusplus | 71 | #ifdef __cplusplus |
| 43 | } | 72 | } |
