Esempio n. 1
0
int oss_list_multipart_uploads_parse_from_body(aos_pool_t *p, aos_list_t *bc,
    aos_list_t *upload_list, aos_string_t *key_marker,
    aos_string_t *upload_id_marker, int *truncated)
{
    int res;
    mxml_node_t *root;
    const char next_key_marker_xml_path[] = "NextKeyMarker";
    const char next_upload_id_marker_xml_path[] = "NextUploadIdMarker";
    const char truncated_xml_path[] = "IsTruncated";
    const char uploads_xml_path[] = "Upload";
    char *next_key_marker;
    char *next_upload_id_marker;

    res = get_xmldoc(bc, &root);
    if (res == AOSE_OK) {
        next_key_marker = get_xmlnode_value(p, root, next_key_marker_xml_path);
        if (next_key_marker) {
            aos_str_set(key_marker, next_key_marker);
        }

        next_upload_id_marker = get_xmlnode_value(p, root, next_upload_id_marker_xml_path);
        if (next_upload_id_marker) {
            aos_str_set(upload_id_marker, next_upload_id_marker);
        }

        *truncated = get_truncated_from_xml(p, root, truncated_xml_path);

        oss_list_multipart_uploads_contents_parse(p, root, uploads_xml_path, upload_list);

        mxmlDelete(root);
    }

    return res;
}
Esempio n. 2
0
int oss_list_multipart_uploads_parse_from_body(aos_pool_t *p, aos_list_t *bc,
    aos_list_t *upload_list, aos_string_t *key_marker,
    aos_string_t *upload_id_marker, int *truncated)
{
    int res;
    xmlDocPtr doc;
    const char next_key_marker_xml_path[] = "/ListMultipartUploadsResult/NextKeyMarker";
    const char next_upload_id_marker_xml_path[] = "/ListMultipartUploadsResult/NextUploadIdMarker";
    const char truncated_xml_path[] = "/ListMultipartUploadsResult/IsTruncated";
    const char uploads_xml_path[] = "/ListMultipartUploadsResult/Upload";
    char *next_key_marker;
    char *next_upload_id_marker;

    res = get_xmldoc(bc, &doc);
    if (res == AOSE_OK) {
        next_key_marker = get_xmlnode_value(p, doc, next_key_marker_xml_path);
        if (next_key_marker) {
            aos_str_set(key_marker, next_key_marker);
        }

        next_upload_id_marker = get_xmlnode_value(p, doc, next_upload_id_marker_xml_path);
        if (next_upload_id_marker) {
            aos_str_set(upload_id_marker, next_upload_id_marker);
        }

        *truncated = get_truncated_from_xml(p, doc, truncated_xml_path);

        oss_list_multipart_uploads_contents_parse(p, doc, uploads_xml_path, upload_list);
        xmlFreeDoc(doc);
    }

    return res;
}
Esempio n. 3
0
int oss_list_parts_parse_from_body(aos_pool_t *p, aos_list_t *bc,
    aos_list_t *part_list, aos_string_t *partnumber_marker, int *truncated)
{
    int res;
    mxml_node_t *root;
    const char next_partnumber_marker_xml_path[] = "NextPartNumberMarker";
    const char truncated_xml_path[] = "IsTruncated";
    const char parts_xml_path[] = "Part";
    char *next_partnumber_marker;

    res = get_xmldoc(bc, &root);
    if (res == AOSE_OK) {
        next_partnumber_marker = get_xmlnode_value(p, root, next_partnumber_marker_xml_path);
        if (next_partnumber_marker) {
            aos_str_set(partnumber_marker, next_partnumber_marker);
        }

        *truncated = get_truncated_from_xml(p, root, truncated_xml_path);

        oss_list_parts_contents_parse(p, root, parts_xml_path, part_list);

        mxmlDelete(root);
    }

    return res;
}
Esempio n. 4
0
int oss_list_objects_parse_from_body(aos_pool_t *p, aos_list_t *bc,
    aos_list_t *object_list, aos_list_t *common_prefix_list, aos_string_t *marker, int *truncated)
{
    int res;
    mxml_node_t *root;
    const char next_marker_xml_path[] = "NextMarker";
    const char truncated_xml_path[] = "IsTruncated";
    const char buckets_xml_path[] = "Contents";
    const char common_prefix_xml_path[] = "CommonPrefixes";
    char* next_marker;

    res = get_xmldoc(bc, &root);
    if (res == AOSE_OK) {
        next_marker = get_xmlnode_value(p, root, next_marker_xml_path);
        if (next_marker) {
            aos_str_set(marker, next_marker);
        }

        *truncated = get_truncated_from_xml(p, root, truncated_xml_path);
        
        oss_list_objects_contents_parse(p, root, buckets_xml_path, object_list);
        oss_list_objects_common_prefix_parse(p, root, common_prefix_xml_path, common_prefix_list);

        mxmlDelete(root);
    }
    
    return res;
}
Esempio n. 5
0
int oss_list_parts_parse_from_body(aos_pool_t *p, aos_list_t *bc,
    aos_list_t *part_list, aos_string_t *partnumber_marker, int *truncated)
{
    int res;
    xmlDocPtr doc;
    const char next_partnumber_marker_xml_path[] = "/ListPartsResult/NextPartNumberMarker";
    const char truncated_xml_path[] = "/ListPartsResult/IsTruncated";
    const char parts_xml_path[] = "/ListPartsResult/Part";
    char *next_partnumber_marker;

    res = get_xmldoc(bc, &doc);
    if (res == AOSE_OK) {
        next_partnumber_marker = get_xmlnode_value(p, doc, next_partnumber_marker_xml_path);
        if (next_partnumber_marker) {
            aos_str_set(partnumber_marker, next_partnumber_marker);
        }

        *truncated = get_truncated_from_xml(p, doc, truncated_xml_path);

        oss_list_parts_contents_parse(p, doc, parts_xml_path, part_list);

        xmlFreeDoc(doc);
    }

    return res;
}
Esempio n. 6
0
int oss_list_objects_parse_from_body(aos_pool_t *p, aos_list_t *bc,
    aos_list_t *object_list, aos_list_t *common_prefix_list, aos_string_t *marker, int *truncated)
{
    int res;
    xmlDocPtr doc = NULL;
    const char next_marker_xml_path[] = "/ListBucketResult/NextMarker";
    const char truncated_xml_path[] = "/ListBucketResult/IsTruncated";
    const char buckets_xml_path[] = "/ListBucketResult/Contents";
    const char common_prefix_xml_path[] = "/ListBucketResult/CommonPrefixes";
    char* next_marker;

    res = get_xmldoc(bc, &doc);
    if (res == AOSE_OK) {
        next_marker = get_xmlnode_value(p, doc, next_marker_xml_path);
        if (next_marker) {
            aos_str_set(marker, next_marker);
        }

        *truncated = get_truncated_from_xml(p, doc, truncated_xml_path);
        
        oss_list_objects_contents_parse(p, doc, buckets_xml_path, object_list);
        oss_list_objects_common_prefix_parse(p, doc, common_prefix_xml_path, common_prefix_list);
        xmlFreeDoc(doc);
    }
    
    return res;
}
Esempio n. 7
0
static int get_truncated_from_xml(aos_pool_t *p, mxml_node_t *xml_node, const char *truncated_xml_path)
{
    char *is_truncated;
    int truncated = 0;
    is_truncated = get_xmlnode_value(p, xml_node, truncated_xml_path);
    if (is_truncated) {
        truncated = strcasecmp(is_truncated, "false") == 0 ? 0 : 1;
    }
    return truncated;
}
Esempio n. 8
0
int oss_acl_parse_from_body(aos_pool_t *p, aos_list_t *bc, aos_string_t *oss_acl)
{
    int res;
    mxml_node_t *doc = NULL;
    const char xml_path[] = "Grant";
    char *acl;

    res = get_xmldoc(bc, &doc);
    if (res == AOSE_OK) {
        acl = get_xmlnode_value(p, doc, xml_path);
        if (acl) {
            aos_str_set(oss_acl, acl);
        }
        mxmlDelete(doc);
    }

    return res;
}
Esempio n. 9
0
int oss_upload_id_parse_from_body(aos_pool_t *p, aos_list_t *bc, aos_string_t *upload_id)
{
    int res;
    mxml_node_t *root;
    const char xml_path[] = "UploadId";
    char *id;

    res = get_xmldoc(bc, &root);
    if (res == AOSE_OK) {
        id = get_xmlnode_value(p, root, xml_path);
        if (id) {
            aos_str_set(upload_id, id);
        }
        mxmlDelete(root);
    }

    return res;
}
Esempio n. 10
0
int oss_acl_parse_from_body(aos_pool_t *p, aos_list_t *bc, aos_string_t *oss_acl)
{
    int res;
    xmlDocPtr doc = NULL;
    const char xml_path[] = "/AccessControlPolicy/AccessControlList/Grant";
    char *acl;

    res = get_xmldoc(bc, &doc);
    if (res == AOSE_OK) {
        acl = get_xmlnode_value(p, doc, xml_path);
        if (acl) {
            aos_str_set(oss_acl, acl);
        }
        xmlFreeDoc(doc);
    }

    return res;
}
Esempio n. 11
0
int oss_upload_id_parse_from_body(aos_pool_t *p, aos_list_t *bc, aos_string_t *upload_id)
{
    int res;
    xmlDocPtr doc;
    const char xml_path[] = "/InitiateMultipartUploadResult/UploadId";
    char *id;

    res = get_xmldoc(bc, &doc);
    if (res == AOSE_OK) {
        id = get_xmlnode_value(p, doc, xml_path);
        xmlFreeDoc(doc);
        if (id) {
            aos_str_set(upload_id, id);
        }
    }

    return res;
}