summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/libimobiledevice/diagnostics_relay.h3
-rw-r--r--src/diagnostics_relay.c111
2 files changed, 114 insertions, 0 deletions
diff --git a/include/libimobiledevice/diagnostics_relay.h b/include/libimobiledevice/diagnostics_relay.h
index 5a82931..c2e7d9e 100644
--- a/include/libimobiledevice/diagnostics_relay.h
+++ b/include/libimobiledevice/diagnostics_relay.h
@@ -62,6 +62,9 @@ diagnostics_relay_error_t diagnostics_relay_sleep(diagnostics_relay_client_t cli
diagnostics_relay_error_t diagnostics_relay_restart(diagnostics_relay_client_t client, int flags);
diagnostics_relay_error_t diagnostics_relay_shutdown(diagnostics_relay_client_t client, int flags);
diagnostics_relay_error_t diagnostics_relay_request_diagnostics(diagnostics_relay_client_t client, const char* type, plist_t* diagnostics);
+diagnostics_relay_error_t diagnostics_relay_query_mobilegestalt(diagnostics_relay_client_t client, plist_t keys, plist_t* result);
+diagnostics_relay_error_t diagnostics_relay_query_ioregistry_entry(diagnostics_relay_client_t client, const char* name, const char* class, plist_t* result);
+diagnostics_relay_error_t diagnostics_relay_query_ioregistry_plane(diagnostics_relay_client_t client, const char* plane, plist_t* result);
#ifdef __cplusplus
}
diff --git a/src/diagnostics_relay.c b/src/diagnostics_relay.c
index f289fd9..72a5fd7 100644
--- a/src/diagnostics_relay.c
+++ b/src/diagnostics_relay.c
@@ -364,3 +364,114 @@ diagnostics_relay_error_t diagnostics_relay_request_diagnostics(diagnostics_rela
plist_free(dict);
return ret;
}
+
+diagnostics_relay_error_t diagnostics_relay_query_mobilegestalt(diagnostics_relay_client_t client, plist_t keys, plist_t* result)
+{
+ if (!client || plist_get_node_type(keys) != PLIST_ARRAY || result == NULL)
+ return DIAGNOSTICS_RELAY_E_INVALID_ARG;
+
+ diagnostics_relay_error_t ret = DIAGNOSTICS_RELAY_E_UNKNOWN_ERROR;
+
+ plist_t dict = plist_new_dict();
+ plist_dict_insert_item(dict,"MobileGestaltKeys", plist_copy(keys));
+ plist_dict_insert_item(dict,"Request", plist_new_string("MobileGestalt"));
+ ret = diagnostics_relay_send(client, dict);
+ plist_free(dict);
+ dict = NULL;
+
+ ret = diagnostics_relay_receive(client, &dict);
+ if (!dict) {
+ return DIAGNOSTICS_RELAY_E_PLIST_ERROR;
+ }
+
+ if (diagnostics_relay_check_result(dict) == RESULT_SUCCESS) {
+ ret = DIAGNOSTICS_RELAY_E_SUCCESS;
+ }
+ if (ret != DIAGNOSTICS_RELAY_E_SUCCESS) {
+ plist_free(dict);
+ return ret;
+ }
+
+ plist_t value_node = plist_dict_get_item(dict, "Diagnostics");
+ if (value_node) {
+ *result = plist_copy(value_node);
+ }
+
+ plist_free(dict);
+ return ret;
+}
+
+diagnostics_relay_error_t diagnostics_relay_query_ioregistry_entry(diagnostics_relay_client_t client, const char* name, const char* class, plist_t* result)
+{
+ if (!client || (name == NULL && class == NULL) || result == NULL)
+ return DIAGNOSTICS_RELAY_E_INVALID_ARG;
+
+ diagnostics_relay_error_t ret = DIAGNOSTICS_RELAY_E_UNKNOWN_ERROR;
+
+ plist_t dict = plist_new_dict();
+ if (name)
+ plist_dict_insert_item(dict,"EntryName", plist_new_string(name));
+ if (class)
+ plist_dict_insert_item(dict,"EntryClass", plist_new_string(class));
+ plist_dict_insert_item(dict,"Request", plist_new_string("IORegistry"));
+ ret = diagnostics_relay_send(client, dict);
+ plist_free(dict);
+ dict = NULL;
+
+ ret = diagnostics_relay_receive(client, &dict);
+ if (!dict) {
+ return DIAGNOSTICS_RELAY_E_PLIST_ERROR;
+ }
+
+ if (diagnostics_relay_check_result(dict) == RESULT_SUCCESS) {
+ ret = DIAGNOSTICS_RELAY_E_SUCCESS;
+ }
+ if (ret != DIAGNOSTICS_RELAY_E_SUCCESS) {
+ plist_free(dict);
+ return ret;
+ }
+
+ plist_t value_node = plist_dict_get_item(dict, "Diagnostics");
+ if (value_node) {
+ *result = plist_copy(value_node);
+ }
+
+ plist_free(dict);
+ return ret;
+}
+
+diagnostics_relay_error_t diagnostics_relay_query_ioregistry_plane(diagnostics_relay_client_t client, const char* plane, plist_t* result)
+{
+ if (!client || plane == NULL || result == NULL)
+ return DIAGNOSTICS_RELAY_E_INVALID_ARG;
+
+ diagnostics_relay_error_t ret = DIAGNOSTICS_RELAY_E_UNKNOWN_ERROR;
+
+ plist_t dict = plist_new_dict();
+ plist_dict_insert_item(dict,"CurrentPlane", plist_new_string(plane));
+ plist_dict_insert_item(dict,"Request", plist_new_string("IORegistry"));
+ ret = diagnostics_relay_send(client, dict);
+ plist_free(dict);
+ dict = NULL;
+
+ ret = diagnostics_relay_receive(client, &dict);
+ if (!dict) {
+ return DIAGNOSTICS_RELAY_E_PLIST_ERROR;
+ }
+
+ if (diagnostics_relay_check_result(dict) == RESULT_SUCCESS) {
+ ret = DIAGNOSTICS_RELAY_E_SUCCESS;
+ }
+ if (ret != DIAGNOSTICS_RELAY_E_SUCCESS) {
+ plist_free(dict);
+ return ret;
+ }
+
+ plist_t value_node = plist_dict_get_item(dict, "Diagnostics");
+ if (value_node) {
+ *result = plist_copy(value_node);
+ }
+
+ plist_free(dict);
+ return ret;
+}