diff options
Diffstat (limited to 'swig')
| -rw-r--r-- | swig/iphone.i | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/swig/iphone.i b/swig/iphone.i index fb16208..a0fe340 100644 --- a/swig/iphone.i +++ b/swig/iphone.i | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | /* Includes the header in the wrapper code */ | 4 | /* Includes the header in the wrapper code */ |
| 5 | #include <libiphone/libiphone.h> | 5 | #include <libiphone/libiphone.h> |
| 6 | #include <plist/plist.h> | 6 | #include <plist/plist.h> |
| 7 | 7 | #include "../src/utils.h" | |
| 8 | typedef struct { | 8 | typedef struct { |
| 9 | iphone_device_t dev; | 9 | iphone_device_t dev; |
| 10 | } iPhone; | 10 | } iPhone; |
| @@ -17,13 +17,10 @@ | |||
| 17 | typedef struct { | 17 | typedef struct { |
| 18 | iphone_msync_client_t client; | 18 | iphone_msync_client_t client; |
| 19 | } MobileSync; | 19 | } MobileSync; |
| 20 | //typedef struct { | ||
| 21 | // plist_t node; | ||
| 22 | //} PListNode; | ||
| 23 | %} | 20 | %} |
| 24 | /* Parse the header file to generate wrappers */ | 21 | /* Parse the header file to generate wrappers */ |
| 22 | %include "stdint.i" | ||
| 25 | %include "plist/swig/plist.i" | 23 | %include "plist/swig/plist.i" |
| 26 | //(module="libplist.PList")override module name until package path gets fixed in swig (1.3.37) | ||
| 27 | 24 | ||
| 28 | typedef struct { | 25 | typedef struct { |
| 29 | iphone_device_t dev; | 26 | iphone_device_t dev; |
| @@ -41,10 +38,9 @@ typedef struct { | |||
| 41 | %extend iPhone { // Attach these functions to struct iPhone | 38 | %extend iPhone { // Attach these functions to struct iPhone |
| 42 | iPhone() { | 39 | iPhone() { |
| 43 | iPhone* phone = (iPhone*) malloc(sizeof(iPhone)); | 40 | iPhone* phone = (iPhone*) malloc(sizeof(iPhone)); |
| 44 | if (IPHONE_E_SUCCESS == iphone_get_device ( &phone->dev )) | 41 | phone->dev = NULL; |
| 45 | return phone; | 42 | iphone_set_debug_mask(DBGMASK_LOCKDOWND | DBGMASK_MOBILESYNC); |
| 46 | free(phone); | 43 | return phone; |
| 47 | return NULL; | ||
| 48 | } | 44 | } |
| 49 | 45 | ||
| 50 | ~iPhone() { | 46 | ~iPhone() { |
| @@ -52,9 +48,16 @@ typedef struct { | |||
| 52 | free($self); | 48 | free($self); |
| 53 | } | 49 | } |
| 54 | 50 | ||
| 51 | int InitDevice() { | ||
| 52 | if (IPHONE_E_SUCCESS == iphone_get_device ( &($self->dev))) | ||
| 53 | return 1; | ||
| 54 | return 0; | ||
| 55 | } | ||
| 56 | |||
| 55 | Lockdownd* GetLockdownClient() { | 57 | Lockdownd* GetLockdownClient() { |
| 56 | Lockdownd* client = (Lockdownd*) malloc(sizeof(Lockdownd)); | 58 | Lockdownd* client = (Lockdownd*) malloc(sizeof(Lockdownd)); |
| 57 | client->client = NULL; | 59 | client->client = NULL; |
| 60 | client->dev = NULL; | ||
| 58 | if (IPHONE_E_SUCCESS == iphone_lckd_new_client ( $self->dev , &(client->client)) ) { | 61 | if (IPHONE_E_SUCCESS == iphone_lckd_new_client ( $self->dev , &(client->client)) ) { |
| 59 | client->dev = $self->dev; | 62 | client->dev = $self->dev; |
| 60 | return client; | 63 | return client; |
| @@ -69,7 +72,7 @@ typedef struct { | |||
| 69 | if (!phone) return NULL; | 72 | if (!phone) return NULL; |
| 70 | Lockdownd* client = (Lockdownd*) malloc(sizeof(Lockdownd)); | 73 | Lockdownd* client = (Lockdownd*) malloc(sizeof(Lockdownd)); |
| 71 | client->client = NULL; | 74 | client->client = NULL; |
| 72 | if (IPHONE_E_SUCCESS == iphone_lckd_new_client ( phone->dev , &client->client)) { | 75 | if (IPHONE_E_SUCCESS == iphone_lckd_new_client ( phone->dev , &(client->client))) { |
| 73 | client->dev = phone->dev; | 76 | client->dev = phone->dev; |
| 74 | return client; | 77 | return client; |
| 75 | } | 78 | } |
| @@ -101,7 +104,7 @@ typedef struct { | |||
| 101 | if (!phone) return NULL; | 104 | if (!phone) return NULL; |
| 102 | MobileSync* client = (MobileSync*) malloc(sizeof(MobileSync)); | 105 | MobileSync* client = (MobileSync*) malloc(sizeof(MobileSync)); |
| 103 | client->client = NULL; | 106 | client->client = NULL; |
| 104 | iphone_msync_new_client ( phone->dev, src_port, dst_port, &client->client); | 107 | iphone_msync_new_client ( phone->dev, src_port, dst_port, &(client->client)); |
| 105 | return client; | 108 | return client; |
| 106 | } | 109 | } |
| 107 | 110 | ||
| @@ -115,7 +118,8 @@ typedef struct { | |||
| 115 | } | 118 | } |
| 116 | 119 | ||
| 117 | PListNode* Receive() { | 120 | PListNode* Receive() { |
| 118 | PListNode* node = NULL; | 121 | PListNode* node = (PListNode*)malloc(sizeof(PListNode)); |
| 122 | node->node = NULL; | ||
| 119 | iphone_msync_recv($self->client, &(node->node)); | 123 | iphone_msync_recv($self->client, &(node->node)); |
| 120 | return node; | 124 | return node; |
| 121 | } | 125 | } |
