本文整理汇总了C++中plist_get_node_type函数的典型用法代码示例。如果您正苦于以下问题:C++ plist_get_node_type函数的具体用法?C++ plist_get_node_type怎么用?C++ plist_get_node_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了plist_get_node_type函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:Clstroud,项目名称:libplist,代码行数:46,代码来源:plist.c
示例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;
}
开发者ID:DaZombieKiller,项目名称:libplist-cmake,代码行数:45,代码来源:Node.cpp
示例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;
}
开发者ID:optionalg,项目名称:idevicerestore,代码行数:45,代码来源:normal.c
示例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;
}
}
开发者ID:MephistoLa,项目名称:bootsigned,代码行数:18,代码来源:tss.c
示例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;
}
开发者ID:rcg4u,项目名称:idevicerestore,代码行数:44,代码来源:restore.c
示例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;
}
开发者ID:cachua1979,项目名称:libimobiledevice,代码行数:44,代码来源:lockdown.c
示例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;
}
开发者ID:0xFireball,项目名称:libiphone,代码行数:30,代码来源:device_link_service.c
示例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;
}
开发者ID:MephistoLa,项目名称:bootsigned,代码行数:42,代码来源:normal.c
示例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;
}
}
开发者ID:zweed4u,项目名称:idevicerestore,代码行数:20,代码来源:tss.c
示例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;
}
开发者ID:Tatsh,项目名称:libimobiledevice,代码行数:20,代码来源:mobileactivation.c
示例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;
}
开发者ID:backinside,项目名称:libimobiledevice,代码行数:41,代码来源:diagnostics_relay.c
示例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;
}
开发者ID:josephwinston,项目名称:forked-daapd,代码行数:21,代码来源:filescanner_itunes.c
示例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;
}
开发者ID:i3ppwn,项目名称:libimobiledevice,代码行数:34,代码来源:installation_proxy.c
示例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;
}
开发者ID:ejurgensen,项目名称:forked-daapd,代码行数:22,代码来源:filescanner_itunes.c
示例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;
}
开发者ID:ejurgensen,项目名称:forked-daapd,代码行数:23,代码来源:filescanner_itunes.c
示例16: plist_dict_to_string
static void plist_dict_to_string(plist_t node)
{
plist_dict_iter it = NULL;
char* key = NULL;
plist_t subnode = NULL;
plist_dict_new_iter(node, &it);
plist_dict_next_item(node, it, &key, &subnode);
while (subnode)
{
printf("%*s", indent_level, "");
printf("%s", key);
if (plist_get_node_type(subnode) == PLIST_ARRAY)
printf("[%d]: ", plist_array_get_size(subnode));
else
printf(": ");
free(key);
key = NULL;
plist_node_to_string(subnode);
plist_dict_next_item(node, it, &key, &subnode);
}
free(it);
}
开发者ID:abhilash0505,项目名称:iShot-iInfo,代码行数:23,代码来源:iInfo.c
示例17: plist_access_pathv
plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v)
{
plist_t current = plist;
plist_type type = PLIST_NONE;
uint32_t i = 0;
for (i = 0; i < length && current; i++)
{
type = plist_get_node_type(current);
if (type == PLIST_ARRAY)
{
uint32_t n = va_arg(v, uint32_t);
current = plist_array_get_item(current, n);
}
else if (type == PLIST_DICT)
{
const char* key = va_arg(v, const char*);
current = plist_dict_get_item(current, key);
}
}
return current;
}
开发者ID:daiwx,项目名称:libplist,代码行数:23,代码来源:plist.c
示例18: lockdownd_build_start_service_request
/**
* Internal function used by lockdownd_do_start_service to create the
* StartService request's plist.
*
* @param client The lockdownd client
* @param identifier The identifier of the service to start
* @param send_escrow_bag Should we send the device's escrow bag with the request
* @param request The request's plist on success, NULL on failure
*
* @return LOCKDOWN_E_SUCCESS on success, LOCKDOWN_E_INVALID_CONF on failure
* to read the escrow bag from the device's record (when used).
*/
static lockdownd_error_t lockdownd_build_start_service_request(lockdownd_client_t client, const char *identifier, int send_escrow_bag, plist_t *request)
{
plist_t dict = plist_new_dict();
/* create the basic request params */
plist_dict_add_label(dict, client->label);
plist_dict_set_item(dict, "Request", plist_new_string("StartService"));
plist_dict_set_item(dict, "Service", plist_new_string(identifier));
/* if needed - get the escrow bag for the device and send it with the request */
if (send_escrow_bag) {
/* get the pairing record */
plist_t pair_record = NULL;
userpref_read_pair_record(client->udid, &pair_record);
if (!pair_record) {
debug_info("ERROR: failed to read pair record for device: %s", client->udid);
plist_free(dict);
return LOCKDOWN_E_INVALID_CONF;
}
/* try to read the escrow bag from the record */
plist_t escrow_bag = plist_dict_get_item(pair_record, USERPREF_ESCROW_BAG_KEY);
if (!escrow_bag || (PLIST_DATA != plist_get_node_type(escrow_bag))) {
debug_info("ERROR: Failed to retrieve the escrow bag from the device's record");
plist_free(dict);
plist_free(pair_record);
return LOCKDOWN_E_INVALID_CONF;
}
debug_info("Adding escrow bag to StartService for %s", identifier);
plist_dict_set_item(dict, USERPREF_ESCROW_BAG_KEY, plist_copy(escrow_bag));
plist_free(pair_record);
}
*request = dict;
return LOCKDOWN_E_SUCCESS;
}
开发者ID:cachua1979,项目名称:libimobiledevice,代码行数:49,代码来源:lockdown.c
示例19: extract_raw_crash_report
static int extract_raw_crash_report(const char* filename) {
int res = 0;
plist_t report = NULL;
char* raw = NULL;
char* raw_filename = strdup(filename);
/* create filename with '.crash' extension */
char* p = strrchr(raw_filename, '.');
if ((p == NULL) || (strcmp(p, ".plist") != 0)) {
free(raw_filename);
return res;
}
strcpy(p, ".crash");
/* read plist crash report */
if (plist_read_from_filename(&report, filename)) {
plist_t description_node = plist_dict_get_item(report, "description");
if (description_node && plist_get_node_type(description_node) == PLIST_STRING) {
plist_get_string_val(description_node, &raw);
if (raw != NULL) {
/* write file */
buffer_write_to_filename(raw_filename, raw, strlen(raw));
free(raw);
res = 1;
}
}
}
if (report)
plist_free(report);
if (raw_filename)
free(raw_filename);
return res;
}
开发者ID:GotoHack,项目名称:F.C.E.-365-Firmware-Manager,代码行数:37,代码来源:idevicecrashreport.c
示例20: process_pl_items
static void
process_pl_items(plist_t items, int pl_id)
{
plist_t trk;
uint64_t itml_id;
uint32_t db_id;
uint32_t alen;
uint32_t i;
int ret;
alen = plist_array_get_size(items);
for (i = 0; i < alen; i++)
{
trk = plist_array_get_item(items, i);
if (plist_get_node_type(trk) != PLIST_DICT)
continue;
ret = get_dictval_int_from_key(trk, "Track ID", &itml_id);
if (ret < 0)
{
DPRINTF(E_WARN, L_SCAN, "No Track ID found for playlist item %u\n", i);
continue;
}
db_id = id_map_get(itml_id);
if (!db_id)
{
DPRINTF(E_INFO, L_SCAN, "Track ID %" PRIu64 " dropped\n", itml_id);
continue;
}
ret = db_pl_add_item_byid(pl_id, db_id);
if (ret < 0)
DPRINTF(E_WARN, L_SCAN, "Could not add ID %d to playlist\n", db_id);
}
}
开发者ID:josephwinston,项目名称:forked-daapd,代码行数:37,代码来源:filescanner_itunes.c
注:本文中的plist_get_node_type函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论