forked from jkcoxson/idevice
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlockdown.cpp
More file actions
65 lines (56 loc) · 1.69 KB
/
Copy pathlockdown.cpp
File metadata and controls
65 lines (56 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Jackson Coxson
#include <idevice++/bindings.hpp>
#include <idevice++/ffi.hpp>
#include <idevice++/lockdown.hpp>
#include <idevice++/provider.hpp>
namespace IdeviceFFI {
Result<Lockdown, FfiError> Lockdown::connect(Provider& provider) {
LockdowndClientHandle* out = nullptr;
FfiError e(::lockdownd_connect(provider.raw(), &out));
if (e) {
provider.release();
return Err(e);
}
return Ok(Lockdown::adopt(out));
}
Result<Lockdown, FfiError> Lockdown::from_socket(Idevice&& socket) {
LockdowndClientHandle* out = nullptr;
FfiError e(::lockdownd_new(socket.raw(), &out));
if (e) {
return Err(e);
}
socket.release();
return Ok(Lockdown::adopt(out));
}
Result<void, FfiError> Lockdown::start_session(const PairingFile& pf) {
FfiError e(::lockdownd_start_session(handle_.get(), pf.raw()));
if (e) {
return Err(e);
}
return Ok();
}
Result<std::pair<uint16_t, bool>, FfiError> Lockdown::start_service(const std::string& identifier) {
uint16_t port = 0;
bool ssl = false;
FfiError e(::lockdownd_start_service(handle_.get(), identifier.c_str(), &port, &ssl));
if (e) {
return Err(e);
}
return Ok(std::make_pair(port, ssl));
}
Result<plist_t, FfiError> Lockdown::get_value(const char* key, const char* domain) {
plist_t out = nullptr;
FfiError e(::lockdownd_get_value(handle_.get(), key, domain, &out));
if (e) {
return Err(e);
}
return Ok(out);
}
Result<void, FfiError> Lockdown::enter_recovery() {
FfiError e(::lockdownd_enter_recovery(handle_.get()));
if (e) {
return Err(e);
}
return Ok();
}
} // namespace IdeviceFFI