本文整理汇总了C++中plist_get_node_type函数的典型用法代码示例。如果您正苦于以下问题:C++ plist_get_node_type函数的具体用法?C++ plist_get_node_type怎么用?C++ plist_get_node_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了plist_get_node_type函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: plist_copy_node
static void plist_copy_node(node_t *node, void *parent_node_ptr)
{
plist_type node_type = PLIST_NONE;
plist_t newnode = NULL;
plist_data_t data = plist_get_data(node);
plist_data_t newdata = plist_new_plist_data();
assert(data); // plist should always have data
memcpy(newdata, data, sizeof(struct plist_data_s));
node_type = plist_get_node_type(node);
if (node_type == PLIST_DATA || node_type == PLIST_STRING || node_type == PLIST_KEY)
{
switch (node_type)
{
case PLIST_DATA:
newdata->buff = (uint8_t *) malloc(data->length);
memcpy(newdata->buff, data->buff, data->length);
break;
case PLIST_KEY:
case PLIST_STRING:
newdata->strval = strdup((char *) data->strval);
break;
default:
break;
}
}
newnode = plist_new_node(newdata);
if (*(plist_t*)parent_node_ptr)
{
node_attach(*(plist_t*)parent_node_ptr, newnode);
}
else
{
*(plist_t*)parent_node_ptr = newnode;
}
node_iterator_t *ni = node_iterator_create(node->children);
node_t *ch;
while ((ch = node_iterator_next(ni))) {
plist_copy_node(ch, &newnode);
}
node_iterator_destroy(ni);
}
示例2: plist_get_node_type
Node* Node::FromPlist(plist_t node, Node* parent)
{
Node* ret = NULL;
if (node)
{
plist_type type = plist_get_node_type(node);
switch (type)
{
case PLIST_DICT:
ret = new Dictionary(node, parent);
break;
case PLIST_ARRAY:
ret = new Array(node, parent);
break;
case PLIST_BOOLEAN:
ret = new Boolean(node, parent);
break;
case PLIST_UINT:
ret = new Integer(node, parent);
break;
case PLIST_REAL:
ret = new Real(node, parent);
break;
case PLIST_STRING:
ret = new String(node, parent);
break;
case PLIST_KEY:
ret = new Key(node, parent);
break;
case PLIST_UID:
ret = new Uid(node, parent);
break;
case PLIST_DATE:
ret = new Date(node, parent);
break;
case PLIST_DATA:
ret = new Data(node, parent);
break;
default:
plist_free(node);
break;
}
}
return ret;
}
示例3: normal_get_nonce
int normal_get_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size) {
idevice_t device = NULL;
plist_t nonce_node = NULL;
lockdownd_client_t lockdown = NULL;
idevice_error_t device_error = IDEVICE_E_SUCCESS;
lockdownd_error_t lockdown_error = IDEVICE_E_SUCCESS;
device_error = idevice_new(&device, client->udid);
if (device_error != IDEVICE_E_SUCCESS) {
return -1;
}
lockdown_error = lockdownd_client_new(device, &lockdown, "idevicerestore");
if (lockdown_error != LOCKDOWN_E_SUCCESS) {
error("ERROR: Unable to connect to lockdownd\n");
idevice_free(device);
return -1;
}
lockdown_error = lockdownd_get_value(lockdown, NULL, "ApNonce", &nonce_node);
if (lockdown_error != LOCKDOWN_E_SUCCESS) {
error("ERROR: Unable to get ApNonce from lockdownd\n");
lockdownd_client_free(lockdown);
idevice_free(device);
return -1;
}
if (!nonce_node || plist_get_node_type(nonce_node) != PLIST_DATA) {
error("ERROR: Unable to get nonce\n");
lockdownd_client_free(lockdown);
idevice_free(device);
return -1;
}
uint64_t n_size = 0;
plist_get_data_val(nonce_node, (char**)nonce, &n_size);
*nonce_size = (int)n_size;
plist_free(nonce_node);
lockdownd_client_free(lockdown);
idevice_free(device);
lockdown = NULL;
device = NULL;
return 0;
}
示例4: tss_get_ticket
int tss_get_ticket(plist_t tss, unsigned char** ticket, uint32_t* tlen) {
plist_t entry_node = plist_dict_get_item(tss, "APTicket");
if (!entry_node || plist_get_node_type(entry_node) != PLIST_DATA) {
error("ERROR: Unable to find APTicket entry in TSS response\n");
return -1;
}
char *data = NULL;
uint64_t len = 0;
plist_get_data_val(entry_node, &data, &len);
if (data) {
*tlen = (uint32_t)len;
*ticket = data;
return 0;
} else {
error("ERROR: Unable to get APTicket data from TSS response\n");
return -1;
}
}
示例5: restore_handle_data_request_msg
int restore_handle_data_request_msg(idevice_t device, restored_client_t restore, plist_t message, plist_t tss, const char* ipsw, const char* filesystem) {
char* type = NULL;
plist_t node = NULL;
// checks and see what kind of data restored is requests and pass
// the request to its own handler
node = plist_dict_get_item(message, "DataType");
if (node && PLIST_STRING == plist_get_node_type(node)) {
plist_get_string_val(node, &type);
// this request is sent when restored is ready to receive the filesystem
if (!strcmp(type, "SystemImageData")) {
restore_send_filesystem(device, filesystem);
}
else if (!strcmp(type, "KernelCache")) {
int kernelcache_size = 0;
char* kernelcache_data = NULL;
char* kernelcache_path = NULL;
if (tss_get_entry_path(tss, "KernelCache", &kernelcache_path) < 0) {
error("ERROR: Unable to find kernelcache path\n");
return -1;
}
if (get_signed_component(ipsw, tss, kernelcache_path, &kernelcache_data, &kernelcache_size) < 0) {
error("ERROR: Unable to get kernelcache file\n");
return -1;
}
restore_send_kernelcache(restore, kernelcache_data, kernelcache_size);
free(kernelcache_data);
}
else if (!strcmp(type, "NORData")) {
restore_send_nor(restore, ipsw, tss);
} else {
// Unknown DataType!!
debug("Unknown data request received\n");
}
}
return 0;
}
示例6: lockdownd_query_type
LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_query_type(lockdownd_client_t client, char **type)
{
if (!client)
return LOCKDOWN_E_INVALID_ARG;
lockdownd_error_t ret = LOCKDOWN_E_UNKNOWN_ERROR;
plist_t dict = plist_new_dict();
plist_dict_add_label(dict, client->label);
plist_dict_set_item(dict,"Request", plist_new_string("QueryType"));
debug_info("called");
ret = lockdownd_send(client, dict);
plist_free(dict);
dict = NULL;
ret = lockdownd_receive(client, &dict);
if (LOCKDOWN_E_SUCCESS != ret)
return ret;
ret = LOCKDOWN_E_UNKNOWN_ERROR;
plist_t type_node = plist_dict_get_item(dict, "Type");
if (type_node && (plist_get_node_type(type_node) == PLIST_STRING)) {
char* typestr = NULL;
plist_get_string_val(type_node, &typestr);
debug_info("success with type %s", typestr);
/* return the type if requested */
if (type != NULL) {
*type = typestr;
} else {
free(typestr);
}
ret = LOCKDOWN_E_SUCCESS;
} else {
debug_info("hmm. QueryType response does not contain a type?!");
debug_plist(dict);
}
plist_free(dict);
dict = NULL;
return ret;
}
示例7: device_link_service_send_process_message
/**
* Sends a DLMessageProcessMessage plist.
*
* @param client The device link service client to use.
* @param message PLIST_DICT to send.
*
* @return DEVICE_LINK_SERVICE_E_SUCCESS on success,
* DEVICE_LINK_SERVICE_E_INVALID_ARG if client or message is invalid or
* message is not a PLIST_DICT, or DEVICE_LINK_SERVICE_E_MUX_ERROR if
* the DLMessageProcessMessage plist could not be sent.
*/
device_link_service_error_t device_link_service_send_process_message(device_link_service_client_t client, plist_t message)
{
if (!client || !client->parent || !message)
return DEVICE_LINK_SERVICE_E_INVALID_ARG;
if (plist_get_node_type(message) != PLIST_DICT)
return DEVICE_LINK_SERVICE_E_INVALID_ARG;
plist_t array = plist_new_array();
plist_array_append_item(array, plist_new_string("DLMessageProcessMessage"));
plist_array_append_item(array, plist_copy(message));
device_link_service_error_t err = DEVICE_LINK_SERVICE_E_SUCCESS;
if (property_list_service_send_binary_plist(client->parent, array) != PROPERTY_LIST_SERVICE_E_SUCCESS) {
err = DEVICE_LINK_SERVICE_E_MUX_ERROR;
}
plist_free(array);
return err;
}
示例8: normal_get_ecid
int normal_get_ecid(struct idevicerestore_client_t* client, uint64_t* ecid) {
idevice_t device = NULL;
plist_t unique_chip_node = NULL;
lockdownd_client_t lockdown = NULL;
idevice_error_t device_error = IDEVICE_E_SUCCESS;
lockdownd_error_t lockdown_error = IDEVICE_E_SUCCESS;
device_error = idevice_new(&device, client->uuid);
if (device_error != IDEVICE_E_SUCCESS) {
return -1;
}
lockdown_error = lockdownd_client_new_with_handshake(device, &lockdown, "idevicerestore");
if (lockdown_error != LOCKDOWN_E_SUCCESS) {
error("ERROR: Unable to connect to lockdownd\n");
idevice_free(device);
return -1;
}
lockdown_error = lockdownd_get_value(lockdown, NULL, "UniqueChipID", &unique_chip_node);
if (lockdown_error != LOCKDOWN_E_SUCCESS) {
error("ERROR: Unable to get UniqueChipID from lockdownd\n");
lockdownd_client_free(lockdown);
idevice_free(device);
return -1;
}
if (!unique_chip_node || plist_get_node_type(unique_chip_node) != PLIST_UINT) {
error("ERROR: Unable to get ECID\n");
lockdownd_client_free(lockdown);
idevice_free(device);
return -1;
}
plist_get_uint_val(unique_chip_node, ecid);
plist_free(unique_chip_node);
lockdownd_client_free(lockdown);
idevice_free(device);
lockdown = NULL;
device = NULL;
return 0;
}
示例9: tss_response_get_data_by_key
static int tss_response_get_data_by_key(plist_t response, const char* name, unsigned char** buffer, unsigned int* length) {
plist_t node = plist_dict_get_item(response, name);
if (!node || plist_get_node_type(node) != PLIST_DATA) {
debug("DEBUG: %s: No entry '%s' in TSS response\n", __func__, name);
return -1;
}
char *data = NULL;
uint64_t len = 0;
plist_get_data_val(node, &data, &len);
if (data) {
*length = (unsigned int)len;
*buffer = (unsigned char*)data;
return 0;
} else {
error("ERROR: Unable to get %s data from TSS response\n", name);
return -1;
}
}
示例10: mobileactivation_check_result
static mobileactivation_error_t mobileactivation_check_result(plist_t dict, const char *command)
{
mobileactivation_error_t ret = MOBILEACTIVATION_E_UNKNOWN_ERROR;
if (!dict || plist_get_node_type(dict) != PLIST_DICT) {
return MOBILEACTIVATION_E_PLIST_ERROR;
}
plist_t err_node = plist_dict_get_item(dict, "Error");
if (!err_node) {
return MOBILEACTIVATION_E_SUCCESS;
} else {
char *errmsg = NULL;
plist_get_string_val(err_node, &errmsg);
debug_info("ERROR: %s: %s", command, errmsg);
ret = MOBILEACTIVATION_E_REQUEST_FAILED;
free(errmsg);
}
return ret;
}
示例11: diagnostics_relay_query_mobilegestalt
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;
}
int check = diagnostics_relay_check_result(dict);
if (check == RESULT_SUCCESS) {
ret = DIAGNOSTICS_RELAY_E_SUCCESS;
} else if (check == RESULT_UNKNOWN_REQUEST) {
ret = DIAGNOSTICS_RELAY_E_UNKNOWN_REQUEST;
} else {
ret = DIAGNOSTICS_RELAY_E_UNKNOWN_ERROR;
}
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;
}
示例12: get_dictval_date_from_key
static int
get_dictval_date_from_key(plist_t dict, const char *key, uint32_t *val)
{
plist_t node;
int32_t secs;
int32_t dummy;
node = plist_dict_get_item(dict, key);
if (!node)
return -1;
if (plist_get_node_type(node) != PLIST_DATE)
return -1;
plist_get_date_val(node, &secs, &dummy);
*val = (uint32_t) secs;
return 0;
}
示例13: instproxy_send_command
/**
* Send a command with specified options to the device.
* Only used internally.
*
* @param client The connected installation_proxy client.
* @param command The command to execute. Required.
* @param client_options The client options to use, as PLIST_DICT, or NULL.
* @param appid The ApplicationIdentifier to add or NULL if not required.
* @param package_path The installation package path or NULL if not required.
*
* @return INSTPROXY_E_SUCCESS on success or an INSTPROXY_E_* error value if
* an error occured.
*/
static instproxy_error_t instproxy_send_command(instproxy_client_t client, const char *command, plist_t client_options, const char *appid, const char *package_path)
{
if (!client || !command || (client_options && (plist_get_node_type(client_options) != PLIST_DICT)))
return INSTPROXY_E_INVALID_ARG;
plist_t dict = plist_new_dict();
if (appid) {
plist_dict_insert_item(dict, "ApplicationIdentifier", plist_new_string(appid));
}
if (client_options && (plist_dict_get_size(client_options) > 0)) {
plist_dict_insert_item(dict, "ClientOptions", plist_copy(client_options));
}
plist_dict_insert_item(dict, "Command", plist_new_string(command));
if (package_path) {
plist_dict_insert_item(dict, "PackagePath", plist_new_string(package_path));
}
instproxy_error_t err = instproxy_error(property_list_service_send_xml_plist(client->parent, dict));
plist_free(dict);
return err;
}
示例14: get_dictval_bool_from_key
static int
get_dictval_bool_from_key(plist_t dict, const char *key, uint8_t *val)
{
plist_t node;
node = plist_dict_get_item(dict, key);
/* Not present means false */
if (!node)
{
*val = 0;
return 0;
}
if (plist_get_node_type(node) != PLIST_BOOLEAN)
return -1;
plist_get_bool_val(node, val);
return 0;
}
示例15: get_dictval_date_from_key
static int
get_dictval_date_from_key(plist_t dict, const char *key, uint32_t *val)
{
plist_t node;
int32_t secs;
int32_t dummy;
node = plist_dict_get_item(dict, key);
if (!node)
return -1;
if (plist_get_node_type(node) != PLIST_DATE)
return -1;
// secs will be number of seconds since 01/01/2001
plist_get_date_val(node, &secs, &dummy);
// make it a Unix Timestamp by adding seconds from 1/1/1970 to 1/1/2001
*val = (uint32_t) (secs + 978307200);
return 0;
}