From abb74bcae219c25cffb7e30db6a34c69dcd92f0a Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Mon, 6 Jul 2009 19:38:00 +0200 Subject: API cleanup for AFC Signed-off-by: Martin Szulecki --- include/Makefile.am | 2 +- include/libiphone/afc.h | 54 +++++++++++++++++++++++++++++++++++++++++++ include/libiphone/libiphone.h | 40 -------------------------------- 3 files changed, 55 insertions(+), 41 deletions(-) create mode 100644 include/libiphone/afc.h (limited to 'include') diff --git a/include/Makefile.am b/include/Makefile.am index a5f8766..4c17261 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1 +1 @@ -nobase_include_HEADERS = libiphone/libiphone.h +nobase_include_HEADERS = libiphone/libiphone.h libiphone/afc.h diff --git a/include/libiphone/afc.h b/include/libiphone/afc.h new file mode 100644 index 0000000..2a0bbad --- /dev/null +++ b/include/libiphone/afc.h @@ -0,0 +1,54 @@ +#ifndef AFC_H +#define AFC_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +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; + +struct afc_client_int; +typedef struct afc_client_int *afc_client_t; + +//afc related functions +iphone_error_t afc_new_client ( iphone_device_t device, int dst_port, afc_client_t *client ); +iphone_error_t afc_free_client ( afc_client_t client ); +int afc_get_afcerror ( afc_client_t client ); +int afc_get_errno ( afc_client_t client ); + +iphone_error_t afc_get_devinfo ( afc_client_t client, char ***infos ); +iphone_error_t afc_get_dir_list ( afc_client_t client, const char *dir, char ***list); + +iphone_error_t afc_get_file_info ( afc_client_t client, const char *filename, char ***infolist ); +iphone_error_t afc_open_file ( afc_client_t client, const char *filename, afc_file_mode_t file_mode, uint64_t *handle ); +iphone_error_t afc_close_file ( afc_client_t client, uint64_t handle); +iphone_error_t afc_lock_file ( afc_client_t client, uint64_t handle, int operation); +iphone_error_t afc_read_file ( afc_client_t client, uint64_t handle, char *data, int length, uint32_t *bytes); +iphone_error_t afc_write_file ( afc_client_t client, uint64_t handle, const char *data, int length, uint32_t *bytes); +iphone_error_t afc_seek_file ( afc_client_t client, uint64_t handle, int64_t offset, int whence); +iphone_error_t afc_truncate_file ( afc_client_t client, uint64_t handle, uint64_t newsize); +iphone_error_t afc_delete_file ( afc_client_t client, const char *path); +iphone_error_t afc_rename_file ( afc_client_t client, const char *from, const char *to); +iphone_error_t afc_mkdir ( afc_client_t client, const char *dir); +iphone_error_t afc_truncate ( afc_client_t client, const char *path, off_t newsize); +iphone_error_t afc_make_link ( afc_client_t client, afc_link_type_t linktype, const char *target, const char *linkname); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h index 463efa7..3f5d86c 100644 --- a/include/libiphone/libiphone.h +++ b/include/libiphone/libiphone.h @@ -54,29 +54,12 @@ extern "C" { typedef int16_t iphone_error_t; -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 -} iphone_afc_file_mode_t; - -typedef enum { - IPHONE_AFC_HARDLINK = 1, - IPHONE_AFC_SYMLINK = 2 -} iphone_afc_link_type_t; - struct iphone_device_int; typedef struct iphone_device_int *iphone_device_t; struct iphone_lckd_client_int; typedef struct iphone_lckd_client_int *iphone_lckd_client_t; -struct iphone_afc_client_int; -typedef struct iphone_afc_client_int *iphone_afc_client_t; - struct iphone_msync_client_int; typedef struct iphone_msync_client_int *iphone_msync_client_t; @@ -111,29 +94,6 @@ iphone_error_t iphone_lckd_recv ( iphone_lckd_client_t client, plist_t* plist); iphone_error_t iphone_lckd_send ( iphone_lckd_client_t client, plist_t plist); -//afc related functions -iphone_error_t iphone_afc_new_client ( iphone_device_t device, int dst_port, iphone_afc_client_t *client ); -iphone_error_t iphone_afc_free_client ( iphone_afc_client_t client ); -int iphone_afc_get_afcerror ( iphone_afc_client_t client ); -int iphone_afc_get_errno ( iphone_afc_client_t client ); - -iphone_error_t iphone_afc_get_devinfo ( iphone_afc_client_t client, char ***infos ); -iphone_error_t iphone_afc_get_dir_list ( iphone_afc_client_t client, const char *dir, char ***list); - -iphone_error_t iphone_afc_get_file_info ( iphone_afc_client_t client, const char *filename, char ***infolist ); -iphone_error_t iphone_afc_open_file ( iphone_afc_client_t client, const char *filename, iphone_afc_file_mode_t file_mode, uint64_t *handle ); -iphone_error_t iphone_afc_close_file ( iphone_afc_client_t client, uint64_t handle); -iphone_error_t iphone_afc_lock_file ( iphone_afc_client_t client, uint64_t handle, int operation); -iphone_error_t iphone_afc_read_file ( iphone_afc_client_t client, uint64_t handle, char *data, int length, uint32_t *bytes); -iphone_error_t iphone_afc_write_file ( iphone_afc_client_t client, uint64_t handle, const char *data, int length, uint32_t *bytes); -iphone_error_t iphone_afc_seek_file ( iphone_afc_client_t client, uint64_t handle, int64_t offset, int whence); -iphone_error_t iphone_afc_truncate_file ( iphone_afc_client_t client, uint64_t handle, uint64_t newsize); -iphone_error_t iphone_afc_delete_file ( iphone_afc_client_t client, const char *path); -iphone_error_t iphone_afc_rename_file ( iphone_afc_client_t client, const char *from, const char *to); -iphone_error_t iphone_afc_mkdir ( iphone_afc_client_t client, const char *dir); -iphone_error_t iphone_afc_truncate(iphone_afc_client_t client, const char *path, off_t newsize); -iphone_error_t iphone_afc_make_link ( iphone_afc_client_t client, iphone_afc_link_type_t linktype, const char *target, const char *linkname); - iphone_error_t iphone_msync_new_client(iphone_device_t device, int dst_port, iphone_msync_client_t * client); -- cgit v1.1-32-gdbae From a1e2fec59eb7d0d2a3adbd4691b3ea2ee1302921 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Mon, 6 Jul 2009 19:46:35 +0200 Subject: API cleanup for NotificationProxy Signed-off-by: Martin Szulecki --- include/Makefile.am | 2 +- include/libiphone/libiphone.h | 33 ------------------------ include/libiphone/notification_proxy.h | 46 ++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 34 deletions(-) create mode 100644 include/libiphone/notification_proxy.h (limited to 'include') diff --git a/include/Makefile.am b/include/Makefile.am index 4c17261..d8ae1e4 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1 +1 @@ -nobase_include_HEADERS = libiphone/libiphone.h libiphone/afc.h +nobase_include_HEADERS = libiphone/libiphone.h libiphone/afc.h libiphone/notification_proxy.h diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h index 3f5d86c..456f000 100644 --- a/include/libiphone/libiphone.h +++ b/include/libiphone/libiphone.h @@ -63,9 +63,6 @@ typedef struct iphone_lckd_client_int *iphone_lckd_client_t; struct iphone_msync_client_int; typedef struct iphone_msync_client_int *iphone_msync_client_t; -struct iphone_np_client_int; -typedef struct iphone_np_client_int *iphone_np_client_t; - //debug related functions #define DBGMASK_ALL 0xFFFF #define DBGMASK_NONE 0x0000 @@ -102,36 +99,6 @@ iphone_error_t iphone_msync_free_client(iphone_msync_client_t client); iphone_error_t iphone_msync_recv(iphone_msync_client_t client, plist_t * plist); iphone_error_t iphone_msync_send(iphone_msync_client_t client, plist_t plist); -// NotificationProxy related -// notifications 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" - -// notifications 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_ATTEMPTACTIVATION "com.apple.springboard.attemptactivation" -#define NP_DS_DOMAIN_CHANGED "com.apple.mobile.data_sync.domain_changed" -#define NP_APP_INSTALLED "com.apple.mobile.application_installed" -#define NP_APP_UNINSTALLED "com.apple.mobile.application_uninstalled" - -iphone_error_t iphone_np_new_client ( iphone_device_t device, int dst_port, iphone_np_client_t *client ); -iphone_error_t iphone_np_free_client ( iphone_np_client_t client ); - -iphone_error_t iphone_np_post_notification ( iphone_np_client_t client, const char *notification ); - -iphone_error_t iphone_np_observe_notification ( iphone_np_client_t client, const char *notification ); -iphone_error_t iphone_np_observe_notifications ( iphone_np_client_t client, const char **notification_spec ); -iphone_error_t iphone_np_get_notification ( iphone_np_client_t client, char **notification ); - -typedef void (*iphone_np_notify_cb_t) ( const char *notification ); - -iphone_error_t iphone_np_set_notify_callback ( iphone_np_client_t client, iphone_np_notify_cb_t notify_cb ); - #ifdef __cplusplus } #endif diff --git a/include/libiphone/notification_proxy.h b/include/libiphone/notification_proxy.h new file mode 100644 index 0000000..9412b4f --- /dev/null +++ b/include/libiphone/notification_proxy.h @@ -0,0 +1,46 @@ +#ifndef NOTIFICATION_PROXY_H +#define NOTIFICATION_PROXY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +struct np_client_int; +typedef struct np_client_int *np_client_t; + +// NotificationProxy related +// notifications 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" + +// notifications 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_ATTEMPTACTIVATION "com.apple.springboard.attemptactivation" +#define NP_DS_DOMAIN_CHANGED "com.apple.mobile.data_sync.domain_changed" +#define NP_APP_INSTALLED "com.apple.mobile.application_installed" +#define NP_APP_UNINSTALLED "com.apple.mobile.application_uninstalled" + +iphone_error_t np_new_client ( iphone_device_t device, int dst_port, np_client_t *client ); +iphone_error_t np_free_client ( np_client_t client ); + +iphone_error_t np_post_notification ( np_client_t client, const char *notification ); + +iphone_error_t np_observe_notification ( np_client_t client, const char *notification ); +iphone_error_t np_observe_notifications ( np_client_t client, const char **notification_spec ); + +typedef void (*np_notify_cb_t) ( const char *notification ); + +iphone_error_t np_set_notify_callback ( np_client_t client, np_notify_cb_t notify_cb ); + +#ifdef __cplusplus +} +#endif + +#endif -- cgit v1.1-32-gdbae From 62a6f558ac7ca7a9b83c2ed810929732c02bbc9d Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Tue, 7 Jul 2009 21:02:00 +0200 Subject: Cleanup lockdown request API and fix docs, tools, bindings and exports --- include/Makefile.am | 2 +- include/libiphone/libiphone.h | 27 +++++------------------ include/libiphone/lockdown.h | 51 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 23 deletions(-) create mode 100644 include/libiphone/lockdown.h (limited to 'include') diff --git a/include/Makefile.am b/include/Makefile.am index d8ae1e4..98792de 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1 +1 @@ -nobase_include_HEADERS = libiphone/libiphone.h libiphone/afc.h libiphone/notification_proxy.h +nobase_include_HEADERS = libiphone/libiphone.h libiphone/lockdown.h libiphone/afc.h libiphone/notification_proxy.h diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h index 456f000..9e983bb 100644 --- a/include/libiphone/libiphone.h +++ b/include/libiphone/libiphone.h @@ -57,9 +57,6 @@ typedef int16_t iphone_error_t; struct iphone_device_int; typedef struct iphone_device_int *iphone_device_t; -struct iphone_lckd_client_int; -typedef struct iphone_lckd_client_int *iphone_lckd_client_t; - struct iphone_msync_client_int; typedef struct iphone_msync_client_int *iphone_msync_client_t; @@ -74,29 +71,15 @@ void iphone_set_debug_mask(uint16_t mask); void iphone_set_debug(int level); //device related functions -iphone_error_t iphone_get_device ( iphone_device_t *device ); -iphone_error_t iphone_get_device_by_uuid ( iphone_device_t *device, const char *uuid ); -iphone_error_t iphone_free_device ( iphone_device_t device ); - -uint32_t iphone_get_device_handle ( iphone_device_t device ); - -//lockdownd related functions -iphone_error_t lockdownd_get_device_uid(iphone_lckd_client_t control, char **uid); -iphone_error_t lockdownd_get_device_name ( iphone_lckd_client_t client, char **device_name ); -iphone_error_t iphone_lckd_new_client ( iphone_device_t device, iphone_lckd_client_t *client ); -iphone_error_t iphone_lckd_free_client( iphone_lckd_client_t client ); - -iphone_error_t iphone_lckd_start_service ( iphone_lckd_client_t client, const char *service, int *port ); -iphone_error_t iphone_lckd_recv ( iphone_lckd_client_t client, plist_t* plist); -iphone_error_t iphone_lckd_send ( iphone_lckd_client_t client, plist_t plist); - - +iphone_error_t iphone_get_device(iphone_device_t *device); +iphone_error_t iphone_get_device_by_uuid(iphone_device_t *device, const char *uuid); +iphone_error_t iphone_free_device(iphone_device_t device); +uint32_t iphone_get_device_handle(iphone_device_t device); iphone_error_t iphone_msync_new_client(iphone_device_t device, int dst_port, iphone_msync_client_t * client); iphone_error_t iphone_msync_free_client(iphone_msync_client_t client); - -iphone_error_t iphone_msync_recv(iphone_msync_client_t client, plist_t * plist); +iphone_error_t iphone_msync_recv(iphone_msync_client_t client, plist_t *plist); iphone_error_t iphone_msync_send(iphone_msync_client_t client, plist_t plist); #ifdef __cplusplus diff --git a/include/libiphone/lockdown.h b/include/libiphone/lockdown.h new file mode 100644 index 0000000..805c90b --- /dev/null +++ b/include/libiphone/lockdown.h @@ -0,0 +1,51 @@ +/* + * lockdownd.h + * + * 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 + +struct lockdownd_client_int; +typedef struct lockdownd_client_int *lockdownd_client_t; + +//lockdownd related functions +iphone_error_t lockdownd_new_client (iphone_device_t device, lockdownd_client_t *client); +iphone_error_t lockdownd_free_client(lockdownd_client_t client); +iphone_error_t lockdownd_query_type(lockdownd_client_t client); +iphone_error_t lockdownd_get_value(lockdownd_client_t client, const char *domain, const char *key, plist_t *value_node); +iphone_error_t lockdownd_start_service (lockdownd_client_t client, const char *service, int *port); +iphone_error_t lockdownd_stop_session(lockdownd_client_t client); +iphone_error_t lockdownd_send (lockdownd_client_t client, plist_t plist); +iphone_error_t lockdownd_recv (lockdownd_client_t client, plist_t *plist); +iphone_error_t lockdownd_pair(lockdownd_client_t client, char *uid, char *host_id); +iphone_error_t lockdownd_get_device_uid (lockdownd_client_t control, char **uid); +iphone_error_t lockdownd_get_device_name (lockdownd_client_t client, char **device_name); +iphone_error_t lockdownd_goodbye(lockdownd_client_t client); + +#ifdef __cplusplus +} +#endif + +#endif -- cgit v1.1-32-gdbae From a68a82800f116706354adb97da1ef0cfd3e38a52 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Tue, 14 Jul 2009 14:21:53 +0200 Subject: Cleanup mobilesync API and bindings. Move get_all_contacts() into msyncclient. --- include/Makefile.am | 6 +++++- include/libiphone/libiphone.h | 9 --------- 2 files changed, 5 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/Makefile.am b/include/Makefile.am index 98792de..df7b823 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1 +1,5 @@ -nobase_include_HEADERS = libiphone/libiphone.h libiphone/lockdown.h libiphone/afc.h libiphone/notification_proxy.h +nobase_include_HEADERS = libiphone/libiphone.h \ + libiphone/lockdown.h \ + libiphone/afc.h \ + libiphone/notification_proxy.h \ + libiphone/mobilesync.h diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h index 9e983bb..fa26d14 100644 --- a/include/libiphone/libiphone.h +++ b/include/libiphone/libiphone.h @@ -57,9 +57,6 @@ typedef int16_t iphone_error_t; struct iphone_device_int; typedef struct iphone_device_int *iphone_device_t; -struct iphone_msync_client_int; -typedef struct iphone_msync_client_int *iphone_msync_client_t; - //debug related functions #define DBGMASK_ALL 0xFFFF #define DBGMASK_NONE 0x0000 @@ -76,12 +73,6 @@ iphone_error_t iphone_get_device_by_uuid(iphone_device_t *device, const char *uu iphone_error_t iphone_free_device(iphone_device_t device); uint32_t iphone_get_device_handle(iphone_device_t device); -iphone_error_t iphone_msync_new_client(iphone_device_t device, int dst_port, - iphone_msync_client_t * client); -iphone_error_t iphone_msync_free_client(iphone_msync_client_t client); -iphone_error_t iphone_msync_recv(iphone_msync_client_t client, plist_t *plist); -iphone_error_t iphone_msync_send(iphone_msync_client_t client, plist_t plist); - #ifdef __cplusplus } #endif -- cgit v1.1-32-gdbae From 654e58d4526f48d44361dcc81d6d0a1b79663b1d Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Wed, 15 Jul 2009 16:16:40 +0200 Subject: Implement lockdown set_value, remove_value and enter_recovery request API --- include/libiphone/lockdown.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/libiphone/lockdown.h b/include/libiphone/lockdown.h index 805c90b..20ccf77 100644 --- a/include/libiphone/lockdown.h +++ b/include/libiphone/lockdown.h @@ -34,7 +34,9 @@ typedef struct lockdownd_client_int *lockdownd_client_t; iphone_error_t lockdownd_new_client (iphone_device_t device, lockdownd_client_t *client); iphone_error_t lockdownd_free_client(lockdownd_client_t client); iphone_error_t lockdownd_query_type(lockdownd_client_t client); -iphone_error_t lockdownd_get_value(lockdownd_client_t client, const char *domain, const char *key, plist_t *value_node); +iphone_error_t lockdownd_get_value(lockdownd_client_t client, const char *domain, const char *key, plist_t *value); +iphone_error_t lockdownd_set_value(lockdownd_client_t client, const char *domain, const char *key, plist_t value); +iphone_error_t lockdownd_remove_value(lockdownd_client_t client, const char *domain, const char *key); iphone_error_t lockdownd_start_service (lockdownd_client_t client, const char *service, int *port); iphone_error_t lockdownd_stop_session(lockdownd_client_t client); iphone_error_t lockdownd_send (lockdownd_client_t client, plist_t plist); @@ -42,6 +44,7 @@ iphone_error_t lockdownd_recv (lockdownd_client_t client, plist_t *plist); iphone_error_t lockdownd_pair(lockdownd_client_t client, char *uid, char *host_id); iphone_error_t lockdownd_get_device_uid (lockdownd_client_t control, char **uid); iphone_error_t lockdownd_get_device_name (lockdownd_client_t client, char **device_name); +iphone_error_t lockdownd_enter_recovery(lockdownd_client_t client); iphone_error_t lockdownd_goodbye(lockdownd_client_t client); #ifdef __cplusplus -- cgit v1.1-32-gdbae From 67a0fe9b8eb5c85348f282fee540e4fee6eedde9 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sun, 19 Jul 2009 15:29:08 +0200 Subject: Add missing mobilesync public header --- include/libiphone/mobilesync.h | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 include/libiphone/mobilesync.h (limited to 'include') diff --git a/include/libiphone/mobilesync.h b/include/libiphone/mobilesync.h new file mode 100644 index 0000000..128be45 --- /dev/null +++ b/include/libiphone/mobilesync.h @@ -0,0 +1,43 @@ +/* + * mobilesync.h + * + * 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 IMOBILESYNC_H +#define IMOBILESYNC_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +struct mobilesync_client_int; +typedef struct mobilesync_client_int *mobilesync_client_t; + +iphone_error_t mobilesync_new_client(iphone_device_t device, int dst_port, + mobilesync_client_t * client); +iphone_error_t mobilesync_free_client(mobilesync_client_t client); +iphone_error_t mobilesync_recv(mobilesync_client_t client, plist_t *plist); +iphone_error_t mobilesync_send(mobilesync_client_t client, plist_t plist); + +#ifdef __cplusplus +} +#endif + +#endif -- cgit v1.1-32-gdbae From 37f8ad0f3e64c23cd32c8c58636510f7964f1891 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Sun, 19 Jul 2009 20:07:21 +0200 Subject: New type afc_lock_op_t with allowed lock operations for afc_lock_file. Only non-blocking locks are supported via AFC. Signed-off-by: Martin Szulecki --- include/libiphone/afc.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/libiphone/afc.h b/include/libiphone/afc.h index 2a0bbad..b64510b 100644 --- a/include/libiphone/afc.h +++ b/include/libiphone/afc.h @@ -21,6 +21,12 @@ typedef enum { 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; @@ -36,7 +42,7 @@ iphone_error_t afc_get_dir_list ( afc_client_t client, const char *dir, char *** iphone_error_t afc_get_file_info ( afc_client_t client, const char *filename, char ***infolist ); iphone_error_t afc_open_file ( afc_client_t client, const char *filename, afc_file_mode_t file_mode, uint64_t *handle ); iphone_error_t afc_close_file ( afc_client_t client, uint64_t handle); -iphone_error_t afc_lock_file ( afc_client_t client, uint64_t handle, int operation); +iphone_error_t afc_lock_file ( afc_client_t client, uint64_t handle, afc_lock_op_t operation); iphone_error_t afc_read_file ( afc_client_t client, uint64_t handle, char *data, int length, uint32_t *bytes); iphone_error_t afc_write_file ( afc_client_t client, uint64_t handle, const char *data, int length, uint32_t *bytes); iphone_error_t afc_seek_file ( afc_client_t client, uint64_t handle, int64_t offset, int whence); -- cgit v1.1-32-gdbae From 4c81f3c622d80a9291f3c13de2075afd753a0e1c Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Fri, 24 Jul 2009 14:56:24 +0200 Subject: Add missing copyright to afc and notification_proxy headers --- include/libiphone/afc.h | 20 ++++++++++++++++++++ include/libiphone/notification_proxy.h | 20 ++++++++++++++++++++ 2 files changed, 40 insertions(+) (limited to 'include') diff --git a/include/libiphone/afc.h b/include/libiphone/afc.h index b64510b..af801b1 100644 --- a/include/libiphone/afc.h +++ b/include/libiphone/afc.h @@ -1,3 +1,23 @@ +/* + * afc.h + * + * 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 diff --git a/include/libiphone/notification_proxy.h b/include/libiphone/notification_proxy.h index 9412b4f..8efb483 100644 --- a/include/libiphone/notification_proxy.h +++ b/include/libiphone/notification_proxy.h @@ -1,3 +1,23 @@ +/* + * notification_proxy.h + * + * 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 -- cgit v1.1-32-gdbae From f995c63e1bc56dd2d098a06f130d55334979f38f Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Fri, 24 Jul 2009 16:35:28 +0200 Subject: Add new NP_ITDBPREP_DID_END notification signaling music db refresh --- include/libiphone/notification_proxy.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/libiphone/notification_proxy.h b/include/libiphone/notification_proxy.h index 8efb483..14d1b39 100644 --- a/include/libiphone/notification_proxy.h +++ b/include/libiphone/notification_proxy.h @@ -46,6 +46,7 @@ typedef struct np_client_int *np_client_t; #define NP_DS_DOMAIN_CHANGED "com.apple.mobile.data_sync.domain_changed" #define NP_APP_INSTALLED "com.apple.mobile.application_installed" #define NP_APP_UNINSTALLED "com.apple.mobile.application_uninstalled" +#define NP_ITDBPREP_DID_END "com.apple.itdbprep.notification.didEnd" iphone_error_t np_new_client ( iphone_device_t device, int dst_port, np_client_t *client ); iphone_error_t np_free_client ( np_client_t client ); -- cgit v1.1-32-gdbae From 601e70e8ee757b769bdc10b16e108e846a1a0b93 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Fri, 24 Jul 2009 17:46:30 +0200 Subject: Rename iphone_set_debug() to iphone_set_debug_level() and code using it --- include/libiphone/libiphone.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h index fa26d14..fef59e0 100644 --- a/include/libiphone/libiphone.h +++ b/include/libiphone/libiphone.h @@ -57,7 +57,7 @@ typedef int16_t iphone_error_t; struct iphone_device_int; typedef struct iphone_device_int *iphone_device_t; -//debug related functions +/* Debugging */ #define DBGMASK_ALL 0xFFFF #define DBGMASK_NONE 0x0000 #define DBGMASK_USBMUX (1 << 1) @@ -65,7 +65,7 @@ typedef struct iphone_device_int *iphone_device_t; #define DBGMASK_MOBILESYNC (1 << 3) void iphone_set_debug_mask(uint16_t mask); -void iphone_set_debug(int level); +void iphone_set_debug_level(int level); //device related functions iphone_error_t iphone_get_device(iphone_device_t *device); -- cgit v1.1-32-gdbae From 15e2c165ac63e225e3fbfc531da5c1f19fede569 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Fri, 24 Jul 2009 17:59:39 +0200 Subject: Remove DBGMASK_USBMUX as it is obsolete since the libusbmuxd code merge --- include/libiphone/libiphone.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h index fef59e0..b8c1c59 100644 --- a/include/libiphone/libiphone.h +++ b/include/libiphone/libiphone.h @@ -60,9 +60,8 @@ typedef struct iphone_device_int *iphone_device_t; /* Debugging */ #define DBGMASK_ALL 0xFFFF #define DBGMASK_NONE 0x0000 -#define DBGMASK_USBMUX (1 << 1) -#define DBGMASK_LOCKDOWND (1 << 2) -#define DBGMASK_MOBILESYNC (1 << 3) +#define DBGMASK_LOCKDOWND (1 << 1) +#define DBGMASK_MOBILESYNC (1 << 2) void iphone_set_debug_mask(uint16_t mask); void iphone_set_debug_level(int level); -- cgit v1.1-32-gdbae From 19a28b0ed18c8ca2f855e7d129ddcdb8c939a707 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Fri, 24 Jul 2009 23:51:53 +0200 Subject: Use iphone_device_get_uuid() not lockdown, for less overhead where possible --- include/libiphone/libiphone.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h index b8c1c59..9764a7e 100644 --- a/include/libiphone/libiphone.h +++ b/include/libiphone/libiphone.h @@ -71,6 +71,7 @@ iphone_error_t iphone_get_device(iphone_device_t *device); iphone_error_t iphone_get_device_by_uuid(iphone_device_t *device, const char *uuid); iphone_error_t iphone_free_device(iphone_device_t device); uint32_t iphone_get_device_handle(iphone_device_t device); +iphone_error_t iphone_device_get_uuid(iphone_device_t device, char **uuid); #ifdef __cplusplus } -- cgit v1.1-32-gdbae From 40a0abaa1c7f2196d40276b0689b18a04e468acd Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sat, 25 Jul 2009 02:08:12 +0200 Subject: Update MobileSync API and introduce mobilesync error codes --- include/libiphone/mobilesync.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/libiphone/mobilesync.h b/include/libiphone/mobilesync.h index 128be45..f8fa711 100644 --- a/include/libiphone/mobilesync.h +++ b/include/libiphone/mobilesync.h @@ -27,14 +27,24 @@ extern "C" { #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; -iphone_error_t mobilesync_new_client(iphone_device_t device, int dst_port, - mobilesync_client_t * client); -iphone_error_t mobilesync_free_client(mobilesync_client_t client); -iphone_error_t mobilesync_recv(mobilesync_client_t client, plist_t *plist); -iphone_error_t mobilesync_send(mobilesync_client_t client, plist_t plist); +mobilesync_error_t mobilesync_client_new(iphone_device_t device, int dst_port, mobilesync_client_t * client); +mobilesync_error_t mobilesync_client_free(mobilesync_client_t client); +mobilesync_error_t mobilesync_recv(mobilesync_client_t client, plist_t *plist); +mobilesync_error_t mobilesync_send(mobilesync_client_t client, plist_t plist); #ifdef __cplusplus } -- cgit v1.1-32-gdbae From d11abfb48218a37d9c66831ebec8b0a736d5385f Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sat, 25 Jul 2009 02:20:03 +0200 Subject: Update NotificationProxy API and introduce new error codes --- include/libiphone/notification_proxy.h | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'include') diff --git a/include/libiphone/notification_proxy.h b/include/libiphone/notification_proxy.h index 14d1b39..520ccd1 100644 --- a/include/libiphone/notification_proxy.h +++ b/include/libiphone/notification_proxy.h @@ -27,16 +27,21 @@ extern "C" { #include -struct np_client_int; -typedef struct np_client_int *np_client_t; +/* Error Codes */ +#define NP_E_SUCCESS 0 +#define NP_E_INVALID_ARG -1 +#define NP_E_PLIST_ERROR -2 + +#define NP_E_UNKNOWN_ERROR -256 + +typedef int16_t np_error_t; -// NotificationProxy related -// notifications for use with post_notification (client --> device) +/* 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" -// notifications for use with observe_notification (device --> client) +/* 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" @@ -48,17 +53,18 @@ typedef struct np_client_int *np_client_t; #define NP_APP_UNINSTALLED "com.apple.mobile.application_uninstalled" #define NP_ITDBPREP_DID_END "com.apple.itdbprep.notification.didEnd" -iphone_error_t np_new_client ( iphone_device_t device, int dst_port, np_client_t *client ); -iphone_error_t np_free_client ( np_client_t client ); - -iphone_error_t np_post_notification ( np_client_t client, const char *notification ); - -iphone_error_t np_observe_notification ( np_client_t client, const char *notification ); -iphone_error_t np_observe_notifications ( np_client_t client, const char **notification_spec ); +struct np_client_int; +typedef struct np_client_int *np_client_t; -typedef void (*np_notify_cb_t) ( const char *notification ); +typedef void (*np_notify_cb_t) (const char *notification); -iphone_error_t np_set_notify_callback ( np_client_t client, np_notify_cb_t notify_cb ); +/* Interface */ +np_error_t np_client_new(iphone_device_t device, int dst_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 } -- cgit v1.1-32-gdbae From f5e9d76ebd74999512ab73f44fabba86879b1c1f Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sat, 25 Jul 2009 02:40:25 +0200 Subject: Update lockdown API and introduce new error codes --- include/libiphone/libiphone.h | 10 +-------- include/libiphone/lockdown.h | 51 +++++++++++++++++++++++++++++-------------- 2 files changed, 36 insertions(+), 25 deletions(-) (limited to 'include') diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h index 9764a7e..895e809 100644 --- a/include/libiphone/libiphone.h +++ b/include/libiphone/libiphone.h @@ -32,7 +32,7 @@ extern "C" { #include #include -//general errors +/* Error Codes */ #define IPHONE_E_SUCCESS 0 #define IPHONE_E_INVALID_ARG -1 #define IPHONE_E_UNKNOWN_ERROR -2 @@ -41,14 +41,6 @@ extern "C" { #define IPHONE_E_NOT_ENOUGH_DATA -5 #define IPHONE_E_BAD_HEADER -6 -//lockdownd specific error -#define IPHONE_E_INVALID_CONF -7 -#define IPHONE_E_PAIRING_FAILED -8 -#define IPHONE_E_SSL_ERROR -9 -#define IPHONE_E_PLIST_ERROR -10 -#define IPHONE_E_DICT_ERROR -11 -#define IPHONE_E_START_SERVICE_FAILED -12 - //afc specific error #define IPHONE_E_AFC_ERROR -13 diff --git a/include/libiphone/lockdown.h b/include/libiphone/lockdown.h index 20ccf77..55c0cb7 100644 --- a/include/libiphone/lockdown.h +++ b/include/libiphone/lockdown.h @@ -27,25 +27,44 @@ extern "C" { #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_UNKNOWN_ERROR -256 + +typedef int16_t lockdownd_error_t; + struct lockdownd_client_int; typedef struct lockdownd_client_int *lockdownd_client_t; -//lockdownd related functions -iphone_error_t lockdownd_new_client (iphone_device_t device, lockdownd_client_t *client); -iphone_error_t lockdownd_free_client(lockdownd_client_t client); -iphone_error_t lockdownd_query_type(lockdownd_client_t client); -iphone_error_t lockdownd_get_value(lockdownd_client_t client, const char *domain, const char *key, plist_t *value); -iphone_error_t lockdownd_set_value(lockdownd_client_t client, const char *domain, const char *key, plist_t value); -iphone_error_t lockdownd_remove_value(lockdownd_client_t client, const char *domain, const char *key); -iphone_error_t lockdownd_start_service (lockdownd_client_t client, const char *service, int *port); -iphone_error_t lockdownd_stop_session(lockdownd_client_t client); -iphone_error_t lockdownd_send (lockdownd_client_t client, plist_t plist); -iphone_error_t lockdownd_recv (lockdownd_client_t client, plist_t *plist); -iphone_error_t lockdownd_pair(lockdownd_client_t client, char *uid, char *host_id); -iphone_error_t lockdownd_get_device_uid (lockdownd_client_t control, char **uid); -iphone_error_t lockdownd_get_device_name (lockdownd_client_t client, char **device_name); -iphone_error_t lockdownd_enter_recovery(lockdownd_client_t client); -iphone_error_t lockdownd_goodbye(lockdownd_client_t client); +/* Interface */ +lockdownd_error_t lockdownd_client_new(iphone_device_t device, lockdownd_client_t *client); +lockdownd_error_t lockdownd_client_free(lockdownd_client_t client); +lockdownd_error_t lockdownd_query_type(lockdownd_client_t client); +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, int *port); +lockdownd_error_t lockdownd_stop_session(lockdownd_client_t client); +lockdownd_error_t lockdownd_send(lockdownd_client_t client, plist_t plist); +lockdownd_error_t lockdownd_recv(lockdownd_client_t client, plist_t *plist); +lockdownd_error_t lockdownd_pair(lockdownd_client_t client, char *uuid, char *host_id); +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); +lockdownd_error_t lockdownd_enter_recovery(lockdownd_client_t client); +lockdownd_error_t lockdownd_goodbye(lockdownd_client_t client); #ifdef __cplusplus } -- cgit v1.1-32-gdbae From 5cb9ecc85240102402082c442d561d7350732027 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sat, 25 Jul 2009 02:54:40 +0200 Subject: Follow glib style and rename iphone_free_device to iphone_device_free --- include/libiphone/libiphone.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h index 895e809..7974526 100644 --- a/include/libiphone/libiphone.h +++ b/include/libiphone/libiphone.h @@ -58,10 +58,10 @@ typedef struct iphone_device_int *iphone_device_t; void iphone_set_debug_mask(uint16_t mask); void iphone_set_debug_level(int level); -//device related functions +/* Interface */ iphone_error_t iphone_get_device(iphone_device_t *device); iphone_error_t iphone_get_device_by_uuid(iphone_device_t *device, const char *uuid); -iphone_error_t iphone_free_device(iphone_device_t device); +iphone_error_t iphone_device_free(iphone_device_t device); uint32_t iphone_get_device_handle(iphone_device_t device); iphone_error_t iphone_device_get_uuid(iphone_device_t device, char **uuid); -- cgit v1.1-32-gdbae From 1cfc2748d38eb97100cabced3b282108898099c2 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sat, 25 Jul 2009 03:07:01 +0200 Subject: Rename iphone_get_device_handle to iphone_device_get_handle and update tools --- include/libiphone/libiphone.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h index 7974526..61820e0 100644 --- a/include/libiphone/libiphone.h +++ b/include/libiphone/libiphone.h @@ -62,7 +62,7 @@ void iphone_set_debug_level(int level); iphone_error_t iphone_get_device(iphone_device_t *device); iphone_error_t iphone_get_device_by_uuid(iphone_device_t *device, const char *uuid); iphone_error_t iphone_device_free(iphone_device_t device); -uint32_t iphone_get_device_handle(iphone_device_t device); +iphone_error_t iphone_device_get_handle(iphone_device_t device, uint32_t *handle); iphone_error_t iphone_device_get_uuid(iphone_device_t device, char **uuid); #ifdef __cplusplus -- cgit v1.1-32-gdbae From 50be30047dbb0d38fd8d61763c13ec75d2b52543 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sat, 25 Jul 2009 03:26:39 +0200 Subject: Update AFC API and use error codes from the STATUS operation response --- include/libiphone/afc.h | 72 +++++++++++++++++++++++++++++++------------ include/libiphone/libiphone.h | 8 ++--- 2 files changed, 54 insertions(+), 26 deletions(-) (limited to 'include') diff --git a/include/libiphone/afc.h b/include/libiphone/afc.h index af801b1..4b024a1 100644 --- a/include/libiphone/afc.h +++ b/include/libiphone/afc.h @@ -27,6 +27,39 @@ extern "C" { #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 + +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 @@ -50,28 +83,27 @@ typedef enum { struct afc_client_int; typedef struct afc_client_int *afc_client_t; -//afc related functions -iphone_error_t afc_new_client ( iphone_device_t device, int dst_port, afc_client_t *client ); -iphone_error_t afc_free_client ( afc_client_t client ); +/* Interface */ +afc_error_t afc_client_new(iphone_device_t device, int dst_port, afc_client_t *client); +afc_error_t afc_client_free(afc_client_t client); int afc_get_afcerror ( afc_client_t client ); int afc_get_errno ( afc_client_t client ); - -iphone_error_t afc_get_devinfo ( afc_client_t client, char ***infos ); -iphone_error_t afc_get_dir_list ( afc_client_t client, const char *dir, char ***list); - -iphone_error_t afc_get_file_info ( afc_client_t client, const char *filename, char ***infolist ); -iphone_error_t afc_open_file ( afc_client_t client, const char *filename, afc_file_mode_t file_mode, uint64_t *handle ); -iphone_error_t afc_close_file ( afc_client_t client, uint64_t handle); -iphone_error_t afc_lock_file ( afc_client_t client, uint64_t handle, afc_lock_op_t operation); -iphone_error_t afc_read_file ( afc_client_t client, uint64_t handle, char *data, int length, uint32_t *bytes); -iphone_error_t afc_write_file ( afc_client_t client, uint64_t handle, const char *data, int length, uint32_t *bytes); -iphone_error_t afc_seek_file ( afc_client_t client, uint64_t handle, int64_t offset, int whence); -iphone_error_t afc_truncate_file ( afc_client_t client, uint64_t handle, uint64_t newsize); -iphone_error_t afc_delete_file ( afc_client_t client, const char *path); -iphone_error_t afc_rename_file ( afc_client_t client, const char *from, const char *to); -iphone_error_t afc_mkdir ( afc_client_t client, const char *dir); -iphone_error_t afc_truncate ( afc_client_t client, const char *path, off_t newsize); -iphone_error_t afc_make_link ( afc_client_t client, afc_link_type_t linktype, const char *target, const char *linkname); +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_get_connection_info(afc_client_t client, 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, int length, uint32_t *bytes); +afc_error_t afc_file_write(afc_client_t client, uint64_t handle, const char *data, int length, uint32_t *bytes); +afc_error_t afc_file_seek(afc_client_t client, uint64_t handle, int64_t offset, int whence); +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, off_t newsize); +afc_error_t afc_make_link(afc_client_t client, afc_link_type_t linktype, const char *target, const char *linkname); #ifdef __cplusplus } diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h index 61820e0..014c8bf 100644 --- a/include/libiphone/libiphone.h +++ b/include/libiphone/libiphone.h @@ -37,12 +37,8 @@ extern "C" { #define IPHONE_E_INVALID_ARG -1 #define IPHONE_E_UNKNOWN_ERROR -2 #define IPHONE_E_NO_DEVICE -3 -#define IPHONE_E_TIMEOUT -4 -#define IPHONE_E_NOT_ENOUGH_DATA -5 -#define IPHONE_E_BAD_HEADER -6 - -//afc specific error -#define IPHONE_E_AFC_ERROR -13 +#define IPHONE_E_NOT_ENOUGH_DATA -4 +#define IPHONE_E_BAD_HEADER -5 typedef int16_t iphone_error_t; -- cgit v1.1-32-gdbae From 8415e1f13dfc8c31fe4d1ff695af26189297795b Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sat, 25 Jul 2009 03:46:13 +0200 Subject: Remove AFC to errno conversion and make afc_receive_data() return AFC errors --- include/libiphone/afc.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/libiphone/afc.h b/include/libiphone/afc.h index 4b024a1..18bf32d 100644 --- a/include/libiphone/afc.h +++ b/include/libiphone/afc.h @@ -86,8 +86,6 @@ typedef struct afc_client_int *afc_client_t; /* Interface */ afc_error_t afc_client_new(iphone_device_t device, int dst_port, afc_client_t *client); afc_error_t afc_client_free(afc_client_t client); -int afc_get_afcerror ( afc_client_t client ); -int afc_get_errno ( 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); -- cgit v1.1-32-gdbae From 0e255cfe381caedf0375e6834021333d971f8050 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sat, 25 Jul 2009 03:46:54 +0200 Subject: Implement afc_file_tell() and adjust afc_receive_data() to handle it --- include/libiphone/afc.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/libiphone/afc.h b/include/libiphone/afc.h index 18bf32d..08122a1 100644 --- a/include/libiphone/afc.h +++ b/include/libiphone/afc.h @@ -96,6 +96,7 @@ afc_error_t afc_file_lock(afc_client_t client, uint64_t handle, afc_lock_op_t op afc_error_t afc_file_read(afc_client_t client, uint64_t handle, char *data, int length, uint32_t *bytes); afc_error_t afc_file_write(afc_client_t client, uint64_t handle, const char *data, int length, uint32_t *bytes); 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); -- cgit v1.1-32-gdbae From da94f0ebc7232e8e9d0e629fe559b7bc93d9a1c6 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sat, 25 Jul 2009 18:12:49 +0200 Subject: Update doxygen config and allow generation of documentation --- include/libiphone/afc.h | 6 ++++-- include/libiphone/libiphone.h | 7 ++++--- include/libiphone/lockdown.h | 7 +++++-- include/libiphone/mobilesync.h | 8 +++++--- include/libiphone/notification_proxy.h | 6 ++++-- 5 files changed, 22 insertions(+), 12 deletions(-) (limited to 'include') diff --git a/include/libiphone/afc.h b/include/libiphone/afc.h index 08122a1..71730cc 100644 --- a/include/libiphone/afc.h +++ b/include/libiphone/afc.h @@ -1,5 +1,7 @@ -/* - * afc.h +/** + * @file libiphone/afc.h + * @brief AFC Implementation + * \internal * * Copyright (c) 2009 Nikias Bassen All Rights Reserved. * diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h index 014c8bf..1451f15 100644 --- a/include/libiphone/libiphone.h +++ b/include/libiphone/libiphone.h @@ -1,6 +1,7 @@ -/* - * libiphone.h - * Main include of libiphone +/** + * @file libiphone/libiphone.h + * @brief Common code and device handling + * \internal * * Copyright (c) 2008 Jonathan Beck All Rights Reserved. * diff --git a/include/libiphone/lockdown.h b/include/libiphone/lockdown.h index 55c0cb7..daa5800 100644 --- a/include/libiphone/lockdown.h +++ b/include/libiphone/lockdown.h @@ -1,6 +1,9 @@ -/* - * lockdownd.h +/** + * @file libiphone/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 diff --git a/include/libiphone/mobilesync.h b/include/libiphone/mobilesync.h index f8fa711..662036c 100644 --- a/include/libiphone/mobilesync.h +++ b/include/libiphone/mobilesync.h @@ -1,7 +1,9 @@ -/* - * mobilesync.h +/** + * @file libiphone/mobilesync.h + * @brief MobileSync Implementation + * \internal * - * Copyright (c) 2009 Martin S. All Rights Reserved. + * 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 diff --git a/include/libiphone/notification_proxy.h b/include/libiphone/notification_proxy.h index 520ccd1..66b7a80 100644 --- a/include/libiphone/notification_proxy.h +++ b/include/libiphone/notification_proxy.h @@ -1,5 +1,7 @@ -/* - * notification_proxy.h +/** + * @file libiphone/notification_proxy.h + * @brief Implementation to talk to the notification proxy on a device + * \internal * * Copyright (c) 2009 Nikias Bassen All Rights Reserved. * -- cgit v1.1-32-gdbae From 19c9750d670435ce430f0fc85a55faf127bdfbf9 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sat, 25 Jul 2009 18:23:54 +0200 Subject: Conform to protocol and add session id argument to lockdownd_stop_session() --- include/libiphone/lockdown.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/libiphone/lockdown.h b/include/libiphone/lockdown.h index daa5800..af58190 100644 --- a/include/libiphone/lockdown.h +++ b/include/libiphone/lockdown.h @@ -60,7 +60,7 @@ lockdownd_error_t lockdownd_get_value(lockdownd_client_t client, const char *dom 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, int *port); -lockdownd_error_t lockdownd_stop_session(lockdownd_client_t client); +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_recv(lockdownd_client_t client, plist_t *plist); lockdownd_error_t lockdownd_pair(lockdownd_client_t client, char *uuid, char *host_id); -- cgit v1.1-32-gdbae