summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/AFC.h35
-rw-r--r--src/NotificationProxy.c71
-rw-r--r--src/NotificationProxy.h1
3 files changed, 53 insertions, 54 deletions
diff --git a/src/AFC.h b/src/AFC.h
index 62ec659..ae035c6 100644
--- a/src/AFC.h
+++ b/src/AFC.h
@@ -59,33 +59,32 @@ struct iphone_afc_file_int {
enum {
AFC_ERROR = 0x00000001,
AFC_SUCCESS_RESPONSE = 0x00000002,
- AFC_LIST_DIR = 0x00000003, // ReadDir
+ AFC_LIST_DIR = 0x00000003, // ReadDir
// 0x00000004 // ReadFile
// 0x00000005 // WriteFile
// 0x00000006 // WritePart
- AFC_TRUNCATE = 0x00000007, // Truncate
- AFC_DELETE = 0x00000008, // RemovePath
- AFC_MAKE_DIR = 0x00000009, // MakeDir
- AFC_GET_INFO = 0x0000000a, // GetFileInfo
- AFC_GET_DEVINFO = 0x0000000b, // GetDeviceInfo
+ AFC_TRUNCATE = 0x00000007, // Truncate
+ AFC_DELETE = 0x00000008, // RemovePath
+ AFC_MAKE_DIR = 0x00000009, // MakeDir
+ AFC_GET_INFO = 0x0000000a, // GetFileInfo
+ AFC_GET_DEVINFO = 0x0000000b, // GetDeviceInfo
// 0x0000000c // same as 5, but writes to temp file, then renames it.
- AFC_FILE_OPEN = 0x0000000d, // FileRefOpen
- AFC_FILE_HANDLE = 0x0000000e, // _unknownPacket
- AFC_READ = 0x0000000f, // FileRefRead
- AFC_WRITE = 0x00000010, // FileRefWrite
- AFC_FILE_SEEK = 0x00000011, // FileRefSeek
- AFC_FILE_TELL = 0x00000012, // FileRefTell
+ AFC_FILE_OPEN = 0x0000000d, // FileRefOpen
+ AFC_FILE_HANDLE = 0x0000000e, // _unknownPacket
+ AFC_READ = 0x0000000f, // FileRefRead
+ AFC_WRITE = 0x00000010, // FileRefWrite
+ AFC_FILE_SEEK = 0x00000011, // FileRefSeek
+ AFC_FILE_TELL = 0x00000012, // FileRefTell
// 0x00000013 // _unknownPacket
- AFC_FILE_CLOSE = 0x00000014, // FileRefClose
- AFC_FILE_TRUNCATE = 0x00000015, // FileRefSetFileSize (ftruncate)
+ AFC_FILE_CLOSE = 0x00000014, // FileRefClose
+ AFC_FILE_TRUNCATE = 0x00000015, // FileRefSetFileSize (ftruncate)
// 0x00000016 // SetFatalError
// 0x00000017 // SetConnectionOptions
- AFC_RENAME = 0x00000018, // RenamePath
+ AFC_RENAME = 0x00000018, // RenamePath
// 0x00000019 // SetFSBlockSize (0x800000)
// 0x0000001A // SetBlockSize (0x800000)
- AFC_FILE_LOCK = 0x0000001B, // FileRefLock
- AFC_MAKE_LINK = 0x0000001C // MakeLink
+ AFC_FILE_LOCK = 0x0000001B, // FileRefLock
+ AFC_MAKE_LINK = 0x0000001C // MakeLink
};
uint32 iphone_afc_get_file_handle(iphone_afc_file_t file);
-
diff --git a/src/NotificationProxy.c b/src/NotificationProxy.c
index b0c10ea..c13a547 100644
--- a/src/NotificationProxy.c
+++ b/src/NotificationProxy.c
@@ -52,7 +52,7 @@ static void np_unlock(iphone_np_client_t client)
*
* @return A handle to the newly-connected client or NULL upon error.
*/
-iphone_error_t iphone_np_new_client ( iphone_device_t device, int src_port, int dst_port, iphone_np_client_t *client )
+iphone_error_t iphone_np_new_client(iphone_device_t device, int src_port, int dst_port, iphone_np_client_t * client)
{
int ret = IPHONE_E_SUCCESS;
@@ -75,16 +75,16 @@ iphone_error_t iphone_np_new_client ( iphone_device_t device, int src_port, int
client_loc->mutex = g_mutex_new();
*client = client_loc;
- return IPHONE_E_SUCCESS;
+ return IPHONE_E_SUCCESS;
}
/** Disconnects an NP client from the phone.
*
* @param client The client to disconnect.
*/
-iphone_error_t iphone_np_free_client ( iphone_np_client_t client )
+iphone_error_t iphone_np_free_client(iphone_np_client_t client)
{
- if (!client || !client->connection )
+ if (!client || !client->connection)
return IPHONE_E_INVALID_ARG;
iphone_mux_free_client(client->connection);
@@ -101,11 +101,11 @@ iphone_error_t iphone_np_free_client ( iphone_np_client_t client )
* @param client The client to send to
* @param notification The notification Message
*/
-iphone_error_t iphone_np_post_notification( iphone_np_client_t client, const char *notification )
+iphone_error_t iphone_np_post_notification(iphone_np_client_t client, const char *notification)
{
xmlDocPtr plist;
xmlNode *dict, *key;
- char *XML_content;
+ char *XML_content;
uint32_t length;
int bytes;
iphone_error_t ret;
@@ -126,11 +126,11 @@ iphone_error_t iphone_np_post_notification( iphone_np_client_t client, const cha
nlen = htonl(length);
- memcpy(sndbuf+sndlen, &nlen, 4);
+ memcpy(sndbuf + sndlen, &nlen, 4);
sndlen += 4;
- memcpy(sndbuf+sndlen, XML_content, length);
+ memcpy(sndbuf + sndlen, XML_content, length);
sndlen += length;
-
+
xmlFree(XML_content);
xmlFreeDoc(plist);
@@ -141,11 +141,11 @@ iphone_error_t iphone_np_post_notification( iphone_np_client_t client, const cha
nlen = htonl(length);
- memcpy(sndbuf+sndlen, &nlen, 4);
- sndlen+=4;
+ memcpy(sndbuf + sndlen, &nlen, 4);
+ sndlen += 4;
- memcpy(sndbuf+sndlen, XML_content, length);
- sndlen+=length;
+ memcpy(sndbuf + sndlen, XML_content, length);
+ sndlen += length;
xmlFree(XML_content);
xmlFreeDoc(plist);
@@ -154,7 +154,7 @@ iphone_error_t iphone_np_post_notification( iphone_np_client_t client, const cha
log_debug_buffer(sndbuf, sndlen);
iphone_mux_send(client->connection, sndbuf, sndlen, &bytes);
- if (bytes <= 0) {
+ if (bytes <= 0) {
np_unlock(client);
return bytes;
}
@@ -178,29 +178,30 @@ iphone_error_t iphone_np_post_notification( iphone_np_client_t client, const cha
*
* @param client The client to send to
*/
-iphone_error_t iphone_np_observe_notification( iphone_np_client_t client )
+iphone_error_t iphone_np_observe_notification(iphone_np_client_t client)
{
xmlDocPtr plist;
xmlNode *dict, *key;
- char *XML_content;
+ char *XML_content;
uint32_t length;
int bytes;
iphone_error_t ret;
unsigned char sndbuf[4096];
int sndlen = 0;
int nlen;
- int i=0;
+ int i = 0;
char *notifications[10] = {
- "com.apple.itunes-client.syncCancelRequest",
- "com.apple.itunes-client.syncSuspendRequest",
- "com.apple.itunes-client.syncResumeRequest",
- "com.apple.mobile.lockdown.phone_number_changed",
- "com.apple.mobile.lockdown.device_name_changed",
- "com.apple.springboard.attemptactivation",
- "com.apple.mobile.data_sync.domain_changed",
- "com.apple.mobile.application_installed",
- "com.apple.mobile.application_uninstalled",
- NULL};
+ "com.apple.itunes-client.syncCancelRequest",
+ "com.apple.itunes-client.syncSuspendRequest",
+ "com.apple.itunes-client.syncResumeRequest",
+ "com.apple.mobile.lockdown.phone_number_changed",
+ "com.apple.mobile.lockdown.device_name_changed",
+ "com.apple.springboard.attemptactivation",
+ "com.apple.mobile.data_sync.domain_changed",
+ "com.apple.mobile.application_installed",
+ "com.apple.mobile.application_uninstalled",
+ NULL
+ };
sndlen = 0;
@@ -217,11 +218,11 @@ iphone_error_t iphone_np_observe_notification( iphone_np_client_t client )
xmlDocDumpMemory(plist, (xmlChar **) & XML_content, &length);
nlen = htonl(length);
- memcpy(sndbuf+sndlen, &nlen, 4);
+ memcpy(sndbuf + sndlen, &nlen, 4);
sndlen += 4;
- memcpy(sndbuf+sndlen, XML_content, length);
+ memcpy(sndbuf + sndlen, XML_content, length);
sndlen += length;
-
+
xmlFree(XML_content);
xmlFreeDoc(plist);
}
@@ -233,11 +234,11 @@ iphone_error_t iphone_np_observe_notification( iphone_np_client_t client )
nlen = htonl(length);
- memcpy(sndbuf+sndlen, &nlen, 4);
- sndlen+=4;
+ memcpy(sndbuf + sndlen, &nlen, 4);
+ sndlen += 4;
- memcpy(sndbuf+sndlen, XML_content, length);
- sndlen+=length;
+ memcpy(sndbuf + sndlen, XML_content, length);
+ sndlen += length;
xmlFree(XML_content);
xmlFreeDoc(plist);
@@ -246,7 +247,7 @@ iphone_error_t iphone_np_observe_notification( iphone_np_client_t client )
log_debug_buffer(sndbuf, sndlen);
iphone_mux_send(client->connection, sndbuf, sndlen, &bytes);
- if (bytes <= 0) {
+ if (bytes <= 0) {
np_unlock(client);
return bytes;
}
diff --git a/src/NotificationProxy.h b/src/NotificationProxy.h
index 7b47346..b2fa3d9 100644
--- a/src/NotificationProxy.h
+++ b/src/NotificationProxy.h
@@ -27,4 +27,3 @@ struct iphone_np_client_int {
iphone_umux_client_t connection;
GMutex *mutex;
};
-