ios-deploy 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 916bc5da742977785158bc9d6be72695583bf002
4
+ data.tar.gz: a8ce8ccf69f2c827d04db34b81a0db10e4aefe00
5
+ SHA512:
6
+ metadata.gz: 8ac70880d34b4851037d2170d90e3be2cafa633222dcd726ff4f6a0ff4d3d4210279c02f428c42aa7dd9a334973b9bfd465ce6ab491263750bf9e9184067d2e9
7
+ data.tar.gz: 4bb37d2324ecf6c410d8638d90a6aef0548910cd56c484b74738a453fedbe0e016c5d2563235d1f9d551565d80cd2b0505e9b40ec981fcd97fa472b9c56bef72
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Giovanni Lodi
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,12 @@
1
+ # ios-deploy
2
+
3
+ This is a mirror of the [`ios-deploy`](https://github.com/phonegap/ios-deploy) project from the [PhoneGap](http://phonegap.com/) community. All the credit, goes to them.
4
+
5
+ `ios-deploy` is distributed via [`npm`](https://www.npmjs.com), but iOS developer, as far as my experience goes, mainly use [RubyGems](rubygems.org), because of [CocoaPods](http://cocoapods.org/) being distributed through it.
6
+
7
+ For this reason an iOS project probably already has a `Podfile` and a `Gemfile`, and having to add a `package.json` for the sake of one tool seemed too much.
8
+
9
+ If you're thinking "_this kind of stuff feel wrong..._", well you're right! It is wrong, it's an hack of matrioscas, but it solves a need I had.
10
+
11
+ You can read more on how this came up on this [tech-journal post](http://mokagio.github.io/tech-journal...), and feel free to tweet me [@mokagio](https://twitter.com/mokagio)
12
+
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,6 @@
1
+ absolute_pwd = File.expand_path(File.dirname(__FILE__))
2
+ command = "#{absolute_pwd}/../node_modules/ios-deploy/ios-deploy"
3
+ ARGV.each do |parameter|
4
+ command += " #{parameter}"
5
+ end
6
+ exec command
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ios-deploy/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ios-deploy"
8
+ spec.version = IosDeploy::VERSION
9
+ spec.authors = ["Giovanni Lodi"]
10
+ spec.email = ["giovanni.lodi42@gmail.com"]
11
+ spec.summary = %q{Mirror of the node module ios-deploy}
12
+ spec.description = %q{launch iOS apps iOS devices from the command line (Xcode 6)\nInstall and debug iOS apps without using Xcode. Designed to work on un-jailbroken devices.}
13
+ spec.homepage = "https://github.com/mokagio/ios-deploy-gem"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
@@ -0,0 +1,5 @@
1
+ require "ios-deploy/version"
2
+
3
+ module IosDeploy
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,3 @@
1
+ module IosDeploy
2
+ VERSION = "1.3.2"
3
+ end
@@ -0,0 +1,6 @@
1
+ demo
2
+ demo.app
3
+ ios-deploy
4
+ ios-deploy.dSYM
5
+ /.DS_Store
6
+ *~
@@ -0,0 +1,31 @@
1
+ ## Contributing to ios-deploy
2
+
3
+ Github url:
4
+
5
+ https://github.com/phonegap/ios-deploy
6
+
7
+ Git clone url:
8
+
9
+ https://github.com/phonegap/ios-deploy.git
10
+
11
+ ## Filing an issue
12
+
13
+ Please run the commands below in your Terminal.app and include it in the issue:
14
+
15
+ ```
16
+ 1. sw_vers -productVersion
17
+ 2. ios-deploy -V
18
+ 3. xcodebuild -version
19
+ 4. xcode-select --print-path
20
+ 5. gcc --version
21
+ 6. lldb --version
22
+
23
+ ```
24
+ Also include **command line arguments** you used for ios-deploy.
25
+
26
+
27
+ ## Sending a Pull Request
28
+
29
+ Please **create a topic branch** for your issue before submitting your pull request. You will be asked to re-submit if your pull request contains unrelated commits.
30
+
31
+ Please elaborate regarding the problem the pull request is supposed to solve, and perhaps also link to any relevant issues the pull request is trying to fix.
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>get-task-allow</key>
6
+ <true/>
7
+ </dict>
8
+ </plist>
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleName</key>
6
+ <string>demo</string>
7
+ <key>CFBundleSupportedPlatforms</key>
8
+ <array>
9
+ <string>iPhoneOS</string>
10
+ </array>
11
+ <key>CFBundleExecutable</key>
12
+ <string>demo</string>
13
+ <key>CFBundleVersion</key>
14
+ <string>1.0</string>
15
+ <key>CFBundleIdentifier</key>
16
+ <string>demo</string>
17
+ <key>CFBundleResourceSpecification</key>
18
+ <string>ResourceRules.plist</string>
19
+ <key>LSRequiresIPhoneOS</key>
20
+ <true/>
21
+ <key>CFBundleDisplayName</key>
22
+ <string>demo</string>
23
+ </dict>
24
+ </plist>
@@ -0,0 +1,2 @@
1
+ ios-deploy is available under the provisions of the GNU General Public License,
2
+ version 3 (or later), available here: http://www.gnu.org/licenses/gpl-3.0.html
@@ -0,0 +1,35 @@
1
+ IOS_SDK_VERSION = 7.1
2
+
3
+ IOS_CC = gcc -ObjC
4
+ DEVICE_SUPPORT = $(shell xcode-select --print-path)/Platforms/iPhoneOS.platform/DeviceSupport
5
+ IOS_SDK = $(shell xcode-select --print-path)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$(IOS_SDK_VERSION).sdk
6
+
7
+ all: clean ios-deploy
8
+
9
+ demo.app: demo Info.plist
10
+ mkdir -p demo.app
11
+ cp demo demo.app/
12
+ cp Info.plist ResourceRules.plist demo.app/
13
+ codesign -f -s "iPhone Developer" --entitlements Entitlements.plist demo.app
14
+
15
+ demo: demo.c
16
+ $(IOS_CC) -g -arch armv7 -isysroot $(IOS_SDK) -framework CoreFoundation -o demo demo.c
17
+
18
+ ios-deploy: clean ios-deploy.c
19
+ $(IOS_CC) -g -o ios-deploy -framework Foundation -framework CoreFoundation -framework MobileDevice -F/System/Library/PrivateFrameworks ios-deploy.c
20
+
21
+ symlink:
22
+ cd $(DEVICE_SUPPORT); ln -sfn "`find . -type d -maxdepth 1 -exec basename {} \; | tail -1`" Latest
23
+
24
+ install: symlink ios-deploy
25
+ mkdir -p $(prefix)/bin
26
+ cp ios-deploy $(prefix)/bin
27
+
28
+ uninstall:
29
+ rm $(prefix)/bin/ios-deploy
30
+
31
+ debug: all
32
+ ./ios-deploy --debug --bundle demo.app
33
+
34
+ clean:
35
+ rm -rf *.app demo ios-deploy
@@ -0,0 +1,496 @@
1
+ /* ----------------------------------------------------------------------------
2
+ * MobileDevice.h - interface to MobileDevice.framework
3
+ * $LastChangedDate: 2007-07-09 18:59:29 -0700 (Mon, 09 Jul 2007) $
4
+ *
5
+ * Copied from http://iphonesvn.halifrag.com/svn/iPhone/
6
+ * With modifications from Allen Porter and Scott Turner
7
+ *
8
+ * ------------------------------------------------------------------------- */
9
+
10
+ #ifndef MOBILEDEVICE_H
11
+ #define MOBILEDEVICE_H
12
+
13
+ #ifdef __cplusplus
14
+ extern "C" {
15
+ #endif
16
+
17
+ #if defined(WIN32)
18
+ #include <CoreFoundation.h>
19
+ typedef unsigned int mach_error_t;
20
+ #elif defined(__APPLE__)
21
+ #include <CoreFoundation/CoreFoundation.h>
22
+ #include <mach/error.h>
23
+ #endif
24
+
25
+ /* Error codes */
26
+ #define MDERR_APPLE_MOBILE (err_system(0x3a))
27
+ #define MDERR_IPHONE (err_sub(0))
28
+
29
+ /* Apple Mobile (AM*) errors */
30
+ #define MDERR_OK ERR_SUCCESS
31
+ #define MDERR_SYSCALL (ERR_MOBILE_DEVICE | 0x01)
32
+ #define MDERR_OUT_OF_MEMORY (ERR_MOBILE_DEVICE | 0x03)
33
+ #define MDERR_QUERY_FAILED (ERR_MOBILE_DEVICE | 0x04)
34
+ #define MDERR_INVALID_ARGUMENT (ERR_MOBILE_DEVICE | 0x0b)
35
+ #define MDERR_DICT_NOT_LOADED (ERR_MOBILE_DEVICE | 0x25)
36
+
37
+ /* Apple File Connection (AFC*) errors */
38
+ #define MDERR_AFC_OUT_OF_MEMORY 0x03
39
+
40
+ /* USBMux errors */
41
+ #define MDERR_USBMUX_ARG_NULL 0x16
42
+ #define MDERR_USBMUX_FAILED 0xffffffff
43
+
44
+ /* Messages passed to device notification callbacks: passed as part of
45
+ * am_device_notification_callback_info. */
46
+ #define ADNCI_MSG_CONNECTED 1
47
+ #define ADNCI_MSG_DISCONNECTED 2
48
+ #define ADNCI_MSG_UNKNOWN 3
49
+
50
+ #define AMD_IPHONE_PRODUCT_ID 0x1290
51
+ #define AMD_IPHONE_SERIAL "3391002d9c804d105e2c8c7d94fc35b6f3d214a3"
52
+
53
+ /* Services, found in /System/Library/Lockdown/Services.plist */
54
+ #define AMSVC_AFC CFSTR("com.apple.afc")
55
+ #define AMSVC_BACKUP CFSTR("com.apple.mobilebackup")
56
+ #define AMSVC_CRASH_REPORT_COPY CFSTR("com.apple.crashreportcopy")
57
+ #define AMSVC_DEBUG_IMAGE_MOUNT CFSTR("com.apple.mobile.debug_image_mount")
58
+ #define AMSVC_NOTIFICATION_PROXY CFSTR("com.apple.mobile.notification_proxy")
59
+ #define AMSVC_PURPLE_TEST CFSTR("com.apple.purpletestr")
60
+ #define AMSVC_SOFTWARE_UPDATE CFSTR("com.apple.mobile.software_update")
61
+ #define AMSVC_SYNC CFSTR("com.apple.mobilesync")
62
+ #define AMSVC_SCREENSHOT CFSTR("com.apple.screenshotr")
63
+ #define AMSVC_SYSLOG_RELAY CFSTR("com.apple.syslog_relay")
64
+ #define AMSVC_SYSTEM_PROFILER CFSTR("com.apple.mobile.system_profiler")
65
+
66
+ typedef unsigned int afc_error_t;
67
+ typedef unsigned int usbmux_error_t;
68
+ typedef unsigned int service_conn_t;
69
+
70
+ struct am_recovery_device;
71
+
72
+ typedef struct am_device_notification_callback_info {
73
+ struct am_device *dev; /* 0 device */
74
+ unsigned int msg; /* 4 one of ADNCI_MSG_* */
75
+ } __attribute__ ((packed)) am_device_notification_callback_info;
76
+
77
+ /* The type of the device restore notification callback functions.
78
+ * TODO: change to correct type. */
79
+ typedef void (*am_restore_device_notification_callback)(struct
80
+ am_recovery_device *);
81
+
82
+ /* This is a CoreFoundation object of class AMRecoveryModeDevice. */
83
+ typedef struct am_recovery_device {
84
+ unsigned char unknown0[8]; /* 0 */
85
+ am_restore_device_notification_callback callback; /* 8 */
86
+ void *user_info; /* 12 */
87
+ unsigned char unknown1[12]; /* 16 */
88
+ unsigned int readwrite_pipe; /* 28 */
89
+ unsigned char read_pipe; /* 32 */
90
+ unsigned char write_ctrl_pipe; /* 33 */
91
+ unsigned char read_unknown_pipe; /* 34 */
92
+ unsigned char write_file_pipe; /* 35 */
93
+ unsigned char write_input_pipe; /* 36 */
94
+ } __attribute__ ((packed)) am_recovery_device;
95
+
96
+ /* A CoreFoundation object of class AMRestoreModeDevice. */
97
+ typedef struct am_restore_device {
98
+ unsigned char unknown[32];
99
+ int port;
100
+ } __attribute__ ((packed)) am_restore_device;
101
+
102
+ /* The type of the device notification callback function. */
103
+ typedef void(*am_device_notification_callback)(struct
104
+ am_device_notification_callback_info *, void* arg);
105
+
106
+ /* The type of the _AMDDeviceAttached function.
107
+ * TODO: change to correct type. */
108
+ typedef void *amd_device_attached_callback;
109
+
110
+
111
+ typedef struct am_device {
112
+ unsigned char unknown0[16]; /* 0 - zero */
113
+ unsigned int device_id; /* 16 */
114
+ unsigned int product_id; /* 20 - set to AMD_IPHONE_PRODUCT_ID */
115
+ char *serial; /* 24 - set to AMD_IPHONE_SERIAL */
116
+ unsigned int unknown1; /* 28 */
117
+ unsigned char unknown2[4]; /* 32 */
118
+ unsigned int lockdown_conn; /* 36 */
119
+ unsigned char unknown3[8]; /* 40 */
120
+ } __attribute__ ((packed)) am_device;
121
+
122
+ typedef struct am_device_notification {
123
+ unsigned int unknown0; /* 0 */
124
+ unsigned int unknown1; /* 4 */
125
+ unsigned int unknown2; /* 8 */
126
+ am_device_notification_callback callback; /* 12 */
127
+ unsigned int unknown3; /* 16 */
128
+ } __attribute__ ((packed)) am_device_notification;
129
+
130
+ typedef struct afc_connection {
131
+ unsigned int handle; /* 0 */
132
+ unsigned int unknown0; /* 4 */
133
+ unsigned char unknown1; /* 8 */
134
+ unsigned char padding[3]; /* 9 */
135
+ unsigned int unknown2; /* 12 */
136
+ unsigned int unknown3; /* 16 */
137
+ unsigned int unknown4; /* 20 */
138
+ unsigned int fs_block_size; /* 24 */
139
+ unsigned int sock_block_size; /* 28: always 0x3c */
140
+ unsigned int io_timeout; /* 32: from AFCConnectionOpen, usu. 0 */
141
+ void *afc_lock; /* 36 */
142
+ unsigned int context; /* 40 */
143
+ } __attribute__ ((packed)) afc_connection;
144
+
145
+ typedef struct afc_directory {
146
+ unsigned char unknown[0]; /* size unknown */
147
+ } __attribute__ ((packed)) afc_directory;
148
+
149
+ typedef struct afc_dictionary {
150
+ unsigned char unknown[0]; /* size unknown */
151
+ } __attribute__ ((packed)) afc_dictionary;
152
+
153
+ typedef unsigned long long afc_file_ref;
154
+
155
+ typedef struct usbmux_listener_1 { /* offset value in iTunes */
156
+ unsigned int unknown0; /* 0 1 */
157
+ unsigned char *unknown1; /* 4 ptr, maybe device? */
158
+ amd_device_attached_callback callback; /* 8 _AMDDeviceAttached */
159
+ unsigned int unknown3; /* 12 */
160
+ unsigned int unknown4; /* 16 */
161
+ unsigned int unknown5; /* 20 */
162
+ } __attribute__ ((packed)) usbmux_listener_1;
163
+
164
+ typedef struct usbmux_listener_2 {
165
+ unsigned char unknown0[4144];
166
+ } __attribute__ ((packed)) usbmux_listener_2;
167
+
168
+ typedef struct am_bootloader_control_packet {
169
+ unsigned char opcode; /* 0 */
170
+ unsigned char length; /* 1 */
171
+ unsigned char magic[2]; /* 2: 0x34, 0x12 */
172
+ unsigned char payload[0]; /* 4 */
173
+ } __attribute__ ((packed)) am_bootloader_control_packet;
174
+
175
+ /* ----------------------------------------------------------------------------
176
+ * Public routines
177
+ * ------------------------------------------------------------------------- */
178
+
179
+ void AMDSetLogLevel(int level);
180
+
181
+ /* Registers a notification with the current run loop. The callback gets
182
+ * copied into the notification struct, as well as being registered with the
183
+ * current run loop. dn_unknown3 gets copied into unknown3 in the same.
184
+ * (Maybe dn_unknown3 is a user info parameter that gets passed as an arg to
185
+ * the callback?) unused0 and unused1 are both 0 when iTunes calls this.
186
+ * In iTunes the callback is located from $3db78e-$3dbbaf.
187
+ *
188
+ * Returns:
189
+ * MDERR_OK if successful
190
+ * MDERR_SYSCALL if CFRunLoopAddSource() failed
191
+ * MDERR_OUT_OF_MEMORY if we ran out of memory
192
+ */
193
+
194
+ mach_error_t AMDeviceNotificationSubscribe(am_device_notification_callback
195
+ callback, unsigned int unused0, unsigned int unused1, void* //unsigned int
196
+ dn_unknown3, struct am_device_notification **notification);
197
+
198
+ /* Connects to the iPhone. Pass in the am_device structure that the
199
+ * notification callback will give to you.
200
+ *
201
+ * Returns:
202
+ * MDERR_OK if successfully connected
203
+ * MDERR_SYSCALL if setsockopt() failed
204
+ * MDERR_QUERY_FAILED if the daemon query failed
205
+ * MDERR_INVALID_ARGUMENT if USBMuxConnectByPort returned 0xffffffff
206
+ */
207
+
208
+ mach_error_t AMDeviceConnect(struct am_device *device);
209
+
210
+ /* Calls PairingRecordPath() on the given device, than tests whether the path
211
+ * which that function returns exists. During the initial connect, the path
212
+ * returned by that function is '/', and so this returns 1.
213
+ *
214
+ * Returns:
215
+ * 0 if the path did not exist
216
+ * 1 if it did
217
+ */
218
+
219
+ int AMDeviceIsPaired(struct am_device *device);
220
+
221
+ /* iTunes calls this function immediately after testing whether the device is
222
+ * paired. It creates a pairing file and establishes a Lockdown connection.
223
+ *
224
+ * Returns:
225
+ * MDERR_OK if successful
226
+ * MDERR_INVALID_ARGUMENT if the supplied device is null
227
+ * MDERR_DICT_NOT_LOADED if the load_dict() call failed
228
+ */
229
+
230
+ mach_error_t AMDeviceValidatePairing(struct am_device *device);
231
+
232
+ /* Creates a Lockdown session and adjusts the device structure appropriately
233
+ * to indicate that the session has been started. iTunes calls this function
234
+ * after validating pairing.
235
+ *
236
+ * Returns:
237
+ * MDERR_OK if successful
238
+ * MDERR_INVALID_ARGUMENT if the Lockdown conn has not been established
239
+ * MDERR_DICT_NOT_LOADED if the load_dict() call failed
240
+ */
241
+
242
+ mach_error_t AMDeviceStartSession(struct am_device *device);
243
+
244
+ /* Starts a service and returns a handle that can be used in order to further
245
+ * access the service. You should stop the session and disconnect before using
246
+ * the service. iTunes calls this function after starting a session. It starts
247
+ * the service and the SSL connection. unknown may safely be
248
+ * NULL (it is when iTunes calls this), but if it is not, then it will be
249
+ * filled upon function exit. service_name should be one of the AMSVC_*
250
+ * constants. If the service is AFC (AMSVC_AFC), then the handle is the handle
251
+ * that will be used for further AFC* calls.
252
+ *
253
+ * Returns:
254
+ * MDERR_OK if successful
255
+ * MDERR_SYSCALL if the setsockopt() call failed
256
+ * MDERR_INVALID_ARGUMENT if the Lockdown conn has not been established
257
+ */
258
+
259
+ mach_error_t AMDeviceStartService(struct am_device *device, CFStringRef
260
+ service_name, service_conn_t *handle, unsigned int *
261
+ unknown);
262
+
263
+ mach_error_t AMDeviceStartHouseArrestService(struct am_device *device, CFStringRef identifier, void *unknown, service_conn_t *handle, unsigned int *what);
264
+
265
+ /* Stops a session. You should do this before accessing services.
266
+ *
267
+ * Returns:
268
+ * MDERR_OK if successful
269
+ * MDERR_INVALID_ARGUMENT if the Lockdown conn has not been established
270
+ */
271
+
272
+ mach_error_t AMDeviceStopSession(struct am_device *device);
273
+
274
+ /* Opens an Apple File Connection. You must start the appropriate service
275
+ * first with AMDeviceStartService(). In iTunes, io_timeout is 0.
276
+ *
277
+ * Returns:
278
+ * MDERR_OK if successful
279
+ * MDERR_AFC_OUT_OF_MEMORY if malloc() failed
280
+ */
281
+
282
+ afc_error_t AFCConnectionOpen(service_conn_t handle, unsigned int io_timeout,
283
+ struct afc_connection **conn);
284
+
285
+ /* Pass in a pointer to an afc_device_info structure. It will be filled. */
286
+ afc_error_t AFCDeviceInfoOpen(afc_connection *conn, struct
287
+ afc_dictionary **info);
288
+
289
+ /* Turns debug mode on if the environment variable AFCDEBUG is set to a numeric
290
+ * value, or if the file '/AFCDEBUG' is present and contains a value. */
291
+ void AFCPlatformInit();
292
+
293
+ /* Opens a directory on the iPhone. Pass in a pointer in dir to be filled in.
294
+ * Note that this normally only accesses the iTunes sandbox/partition as the
295
+ * root, which is /var/root/Media. Pathnames are specified with '/' delimiters
296
+ * as in Unix style.
297
+ *
298
+ * Returns:
299
+ * MDERR_OK if successful
300
+ */
301
+
302
+ afc_error_t AFCDirectoryOpen(afc_connection *conn, const char *path,
303
+ struct afc_directory **dir);
304
+
305
+ /* Acquires the next entry in a directory previously opened with
306
+ * AFCDirectoryOpen(). When dirent is filled with a NULL value, then the end
307
+ * of the directory has been reached. '.' and '..' will be returned as the
308
+ * first two entries in each directory except the root; you may want to skip
309
+ * over them.
310
+ *
311
+ * Returns:
312
+ * MDERR_OK if successful, even if no entries remain
313
+ */
314
+
315
+ afc_error_t AFCDirectoryRead(afc_connection *conn/*unsigned int unused*/, struct afc_directory *dir,
316
+ char **dirent);
317
+
318
+ afc_error_t AFCDirectoryClose(afc_connection *conn, struct afc_directory *dir);
319
+ afc_error_t AFCDirectoryCreate(afc_connection *conn, const char *dirname);
320
+ afc_error_t AFCRemovePath(afc_connection *conn, const char *dirname);
321
+ afc_error_t AFCRenamePath(afc_connection *conn, const char *from, const char *to);
322
+ afc_error_t AFCLinkPath(afc_connection *conn, long long int linktype, const char *target, const char *linkname);
323
+
324
+ /* Returns the context field of the given AFC connection. */
325
+ unsigned int AFCConnectionGetContext(afc_connection *conn);
326
+
327
+ /* Returns the fs_block_size field of the given AFC connection. */
328
+ unsigned int AFCConnectionGetFSBlockSize(afc_connection *conn);
329
+
330
+ /* Returns the io_timeout field of the given AFC connection. In iTunes this is
331
+ * 0. */
332
+ unsigned int AFCConnectionGetIOTimeout(afc_connection *conn);
333
+
334
+ /* Returns the sock_block_size field of the given AFC connection. */
335
+ unsigned int AFCConnectionGetSocketBlockSize(afc_connection *conn);
336
+
337
+ /* Closes the given AFC connection. */
338
+ afc_error_t AFCConnectionClose(afc_connection *conn);
339
+
340
+ /* Registers for device notifications related to the restore process. unknown0
341
+ * is zero when iTunes calls this. In iTunes,
342
+ * the callbacks are located at:
343
+ * 1: $3ac68e-$3ac6b1, calls $3ac542(unknown1, arg, 0)
344
+ * 2: $3ac66a-$3ac68d, calls $3ac542(unknown1, 0, arg)
345
+ * 3: $3ac762-$3ac785, calls $3ac6b2(unknown1, arg, 0)
346
+ * 4: $3ac73e-$3ac761, calls $3ac6b2(unknown1, 0, arg)
347
+ */
348
+
349
+ unsigned int AMRestoreRegisterForDeviceNotifications(
350
+ am_restore_device_notification_callback dfu_connect_callback,
351
+ am_restore_device_notification_callback recovery_connect_callback,
352
+ am_restore_device_notification_callback dfu_disconnect_callback,
353
+ am_restore_device_notification_callback recovery_disconnect_callback,
354
+ unsigned int unknown0,
355
+ void *user_info);
356
+
357
+ /* Causes the restore functions to spit out (unhelpful) progress messages to
358
+ * the file specified by the given path. iTunes always calls this right before
359
+ * restoring with a path of
360
+ * "$HOME/Library/Logs/iPhone Updater Logs/iPhoneUpdater X.log", where X is an
361
+ * unused number.
362
+ */
363
+
364
+ unsigned int AMRestoreEnableFileLogging(char *path);
365
+
366
+ /* Initializes a new option dictionary to default values. Pass the constant
367
+ * kCFAllocatorDefault as the allocator. The option dictionary looks as
368
+ * follows:
369
+ * {
370
+ * NORImageType => 'production',
371
+ * AutoBootDelay => 0,
372
+ * KernelCacheType => 'Release',
373
+ * UpdateBaseband => true,
374
+ * DFUFileType => 'RELEASE',
375
+ * SystemImageType => 'User',
376
+ * CreateFilesystemPartitions => true,
377
+ * FlashNOR => true,
378
+ * RestoreBootArgs => 'rd=md0 nand-enable-reformat=1 -progress'
379
+ * BootImageType => 'User'
380
+ * }
381
+ *
382
+ * Returns:
383
+ * the option dictionary if successful
384
+ * NULL if out of memory
385
+ */
386
+
387
+ CFMutableDictionaryRef AMRestoreCreateDefaultOptions(CFAllocatorRef allocator);
388
+
389
+ /* ----------------------------------------------------------------------------
390
+ * Less-documented public routines
391
+ * ------------------------------------------------------------------------- */
392
+
393
+ /* mode 2 = read, mode 3 = write */
394
+ afc_error_t AFCFileRefOpen(afc_connection *conn, const char *path,
395
+ unsigned long long mode, afc_file_ref *ref);
396
+ afc_error_t AFCFileRefSeek(afc_connection *conn, afc_file_ref ref,
397
+ unsigned long long offset1, unsigned long long offset2);
398
+ afc_error_t AFCFileRefRead(afc_connection *conn, afc_file_ref ref,
399
+ void *buf, size_t *len);
400
+ afc_error_t AFCFileRefSetFileSize(afc_connection *conn, afc_file_ref ref,
401
+ unsigned long long offset);
402
+ afc_error_t AFCFileRefWrite(afc_connection *conn, afc_file_ref ref,
403
+ const void *buf, size_t len);
404
+ afc_error_t AFCFileRefClose(afc_connection *conn, afc_file_ref ref);
405
+
406
+ afc_error_t AFCFileInfoOpen(afc_connection *conn, const char *path, struct
407
+ afc_dictionary **info);
408
+ afc_error_t AFCKeyValueRead(struct afc_dictionary *dict, char **key, char **
409
+ val);
410
+ afc_error_t AFCKeyValueClose(struct afc_dictionary *dict);
411
+
412
+ unsigned int AMRestorePerformRecoveryModeRestore(struct am_recovery_device *
413
+ rdev, CFDictionaryRef opts, void *callback, void *user_info);
414
+ unsigned int AMRestorePerformRestoreModeRestore(struct am_restore_device *
415
+ rdev, CFDictionaryRef opts, void *callback, void *user_info);
416
+
417
+ struct am_restore_device *AMRestoreModeDeviceCreate(unsigned int unknown0,
418
+ unsigned int connection_id, unsigned int unknown1);
419
+
420
+ unsigned int AMRestoreCreatePathsForBundle(CFStringRef restore_bundle_path,
421
+ CFStringRef kernel_cache_type, CFStringRef boot_image_type, unsigned int
422
+ unknown0, CFStringRef *firmware_dir_path, CFStringRef *
423
+ kernelcache_restore_path, unsigned int unknown1, CFStringRef *
424
+ ramdisk_path);
425
+
426
+ unsigned int AMDeviceGetConnectionID(struct am_device *device);
427
+ mach_error_t AMDeviceEnterRecovery(struct am_device *device);
428
+ mach_error_t AMDeviceDisconnect(struct am_device *device);
429
+ mach_error_t AMDeviceRetain(struct am_device *device);
430
+ mach_error_t AMDeviceRelease(struct am_device *device);
431
+ CFStringRef AMDeviceCopyValue(struct am_device *device, unsigned int, CFStringRef cfstring);
432
+ CFStringRef AMDeviceCopyDeviceIdentifier(struct am_device *device);
433
+
434
+ typedef void (*notify_callback)(CFStringRef notification, void *data);
435
+
436
+ mach_error_t AMDPostNotification(service_conn_t socket, CFStringRef notification, CFStringRef userinfo);
437
+ mach_error_t AMDObserveNotification(void *socket, CFStringRef notification);
438
+ mach_error_t AMDListenForNotifications(void *socket, notify_callback cb, void *data);
439
+ mach_error_t AMDShutdownNotificationProxy(void *socket);
440
+
441
+ /*edits by geohot*/
442
+ mach_error_t AMDeviceDeactivate(struct am_device *device);
443
+ mach_error_t AMDeviceActivate(struct am_device *device, CFMutableDictionaryRef);
444
+ /*end*/
445
+
446
+ void *AMDeviceSerialize(struct am_device *device);
447
+ void AMDAddLogFileDescriptor(int fd);
448
+ //kern_return_t AMDeviceSendMessage(service_conn_t socket, void *unused, CFPropertyListRef plist);
449
+ //kern_return_t AMDeviceReceiveMessage(service_conn_t socket, CFDictionaryRef options, CFPropertyListRef * result);
450
+
451
+ typedef int (*am_device_install_application_callback)(CFDictionaryRef, int);
452
+
453
+ mach_error_t AMDeviceInstallApplication(service_conn_t socket, CFStringRef path, CFDictionaryRef options, am_device_install_application_callback callback, void *user);
454
+ mach_error_t AMDeviceTransferApplication(service_conn_t socket, CFStringRef path, CFDictionaryRef options, am_device_install_application_callback callbackj, void *user);
455
+
456
+ int AMDeviceSecureUninstallApplication(int unknown0, struct am_device *device, CFStringRef bundle_id, int unknown1, void *callback, int callback_arg);
457
+
458
+ /* ----------------------------------------------------------------------------
459
+ * Semi-private routines
460
+ * ------------------------------------------------------------------------- */
461
+
462
+ /* Pass in a usbmux_listener_1 structure and a usbmux_listener_2 structure
463
+ * pointer, which will be filled with the resulting usbmux_listener_2.
464
+ *
465
+ * Returns:
466
+ * MDERR_OK if completed successfully
467
+ * MDERR_USBMUX_ARG_NULL if one of the arguments was NULL
468
+ * MDERR_USBMUX_FAILED if the listener was not created successfully
469
+ */
470
+
471
+ usbmux_error_t USBMuxListenerCreate(struct usbmux_listener_1 *esi_fp8, struct
472
+ usbmux_listener_2 **eax_fp12);
473
+
474
+ /* ----------------------------------------------------------------------------
475
+ * Less-documented semi-private routines
476
+ * ------------------------------------------------------------------------- */
477
+
478
+ usbmux_error_t USBMuxListenerHandleData(void *);
479
+
480
+ /* ----------------------------------------------------------------------------
481
+ * Private routines - here be dragons
482
+ * ------------------------------------------------------------------------- */
483
+
484
+ /* AMRestorePerformRestoreModeRestore() calls this function with a dictionary
485
+ * in order to perform certain special restore operations
486
+ * (RESTORED_OPERATION_*). It is thought that this function might enable
487
+ * significant access to the phone. */
488
+
489
+ typedef unsigned int (*t_performOperation)(struct am_restore_device *rdev,
490
+ CFDictionaryRef op); // __attribute__ ((regparm(2)));
491
+
492
+ #ifdef __cplusplus
493
+ }
494
+ #endif
495
+
496
+ #endif