summaryrefslogtreecommitdiffstats
path: root/include/libiphone
diff options
context:
space:
mode:
Diffstat (limited to 'include/libiphone')
-rw-r--r--include/libiphone/afc.h103
-rw-r--r--include/libiphone/libiphone.h41
-rw-r--r--include/libiphone/lockdown.h58
-rw-r--r--include/libiphone/mobilesync.h55
-rw-r--r--include/libiphone/notification_proxy.h57
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 @@
+/**
+ * @file libiphone/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
@@ -7,6 +29,39 @@ extern "C" {
#include <libiphone/libiphone.h>
+/* 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
@@ -21,31 +76,35 @@ 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;
-//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);
+/* 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);
+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_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, 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 fa26d14..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.
*
@@ -32,46 +33,34 @@ extern "C" {
#include <plist/plist.h>
#include <usbmuxd.h>
-//general errors
+/* Error Codes */
#define IPHONE_E_SUCCESS 0
#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
-
-//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
+#define IPHONE_E_NOT_ENOUGH_DATA -4
+#define IPHONE_E_BAD_HEADER -5
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)
-#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(int level);
+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);
-uint32_t iphone_get_device_handle(iphone_device_t device);
+iphone_error_t iphone_device_free(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
}
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 @@
-/*
- * 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
@@ -27,25 +30,44 @@ extern "C" {
#include <libiphone/libiphone.h>
+/* 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, 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);
+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
}
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 @@
+/**
+ * @file libiphone/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 <libiphone/libiphone.h>
+
+/* 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(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
+}
+#endif
+
+#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 @@
+/**
+ * @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.
+ *
+ * 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
@@ -7,16 +29,21 @@ extern "C" {
#include <libiphone/libiphone.h>
-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"
@@ -26,18 +53,20 @@ 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 );
-
-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
}