Ejemplo n.º 1
0
int APP_CONFIG::parse(XML_PARSER& xp, PROJECT* p) {
    memset(this, 0, sizeof(APP_CONFIG));

    while (!xp.get_tag()) {
        if (xp.match_tag("/app")) return 0;
        if (xp.parse_str("name", name, 256)) continue;
        if (xp.parse_int("max_concurrent", max_concurrent)) {
            if (max_concurrent) have_max_concurrent = true;
            continue;
        }
        if (xp.match_tag("gpu_versions")) {
            while (!xp.get_tag()) {
                if (xp.match_tag("/gpu_versions")) break;
                if (xp.parse_double("gpu_usage", gpu_gpu_usage)) continue;
                if (xp.parse_double("cpu_usage", gpu_cpu_usage)) continue;
            }
            continue;
        }
        if (log_flags.unparsed_xml) {
            msg_printf(p, MSG_INFO,
                "Unparsed line in app_info.xml: %s",
                xp.parsed_tag
            );
        }
        xp.skip_unexpected(log_flags.unparsed_xml, "APP_CONFIG::parse");
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 2
0
int parse_zip_output(XML_PARSER& xp) {
    char buf[256];
    while (!xp.get_tag()) {
        if (xp.match_tag("/zip_output")) {
            return 0;
        }
        if (xp.parse_string("zipfilename", zip_filename)) {
            continue;
        }
        if (xp.parse_str("filename", buf, sizeof(buf))) {
            regexp* rp;
            int retval = re_comp_w(&rp, buf);
            if (retval) {
                fprintf(stderr, "re_comp_w() failed: %d\n", retval);
                exit(1);
            }
            zip_patterns.push_back(rp);
            continue;
        }
        fprintf(stderr,
            "%s unexpected tag in job.xml: %s\n",
            boinc_msg_prefix(buf, sizeof(buf)), xp.parsed_tag
        );
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 3
0
int APP_CONFIGS::parse(XML_PARSER& xp, PROJECT* p) {
    app_configs.clear();
    if (!xp.parse_start("app_config")) return ERR_XML_PARSE;
    while (!xp.get_tag()) {
        if (xp.match_tag("/app_config")) return 0;
        if (xp.match_tag("app")) {
            APP_CONFIG ac;
            int retval = ac.parse(xp, p);
            if (!retval) {
                app_configs.push_back(ac);
            }
            continue;
        }
        if (xp.match_tag("app_version")) {
            APP_VERSION_CONFIG avc;
            int retval = avc.parse(xp, p);
            if (!retval) {
                app_version_configs.push_back(avc);
            }
            continue;
        }
        if (log_flags.unparsed_xml) {
            msg_printf(p, MSG_INFO,
                "Unparsed line in app_info.xml: %s",
                xp.parsed_tag
            );
        }
        xp.skip_unexpected(log_flags.unparsed_xml, "APP_CONFIGS::parse");
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 4
0
int APP_VERSION_CONFIG::parse(
    XML_PARSER& xp, MSG_VEC& mv, LOG_FLAGS& log_flags
) {
    char buf[1024];
    memset(this, 0, sizeof(APP_VERSION_CONFIG));

    while (!xp.get_tag()) {
        if (!xp.is_tag) {
            sprintf(buf, "unexpected text '%s' in app_config.xml", xp.parsed_tag);
            mv.push_back(string(buf));
            return ERR_XML_PARSE;
        }
        if (xp.match_tag("/app_version")) return 0;
        if (xp.parse_str("app_name", app_name, 256)) continue;
        if (xp.parse_str("plan_class", plan_class, 256)) continue;
        if (xp.parse_str("cmdline", cmdline, 256)) continue;
        if (xp.parse_double("avg_ncpus", avg_ncpus)) continue;
        if (xp.parse_double("ngpus", ngpus)) continue;
        if (log_flags.unparsed_xml) {
            sprintf(buf, "Unparsed line in app_config.xml: %s", xp.parsed_tag);
            mv.push_back(string(buf));
        }
        xp.skip_unexpected(log_flags.unparsed_xml, "APP_VERSION_CONFIG::parse");
    }
    mv.push_back(string("Missing </app_version> in app_config.xml"));
    return ERR_XML_PARSE;
}
Ejemplo n.º 5
0
int APP_CONFIG::parse(XML_PARSER& xp, MSG_VEC& mv, LOG_FLAGS& log_flags) {
    char buf[1024];
    memset(this, 0, sizeof(APP_CONFIG));

    while (!xp.get_tag()) {
        if (xp.match_tag("/app")) return 0;
        if (xp.parse_str("name", name, 256)) continue;
        if (xp.parse_int("max_concurrent", max_concurrent)) {
            if (max_concurrent) have_max_concurrent = true;
            continue;
        }
        if (xp.match_tag("gpu_versions")) {
            int retval = parse_gpu_versions(xp, mv, log_flags);
            if (retval) return retval;
            continue;
        }
        if (xp.parse_bool("fraction_done_exact", fraction_done_exact)) {
            continue;
        }
        if (xp.parse_bool("report_results_immediately", report_results_immediately)) {
            continue;
        }

        // unparsed XML not considered an error; maybe it should be?
        //
        if (log_flags.unparsed_xml) {
            sprintf(buf, "Unparsed line in app_config.xml: %s", xp.parsed_tag);
            mv.push_back(string(buf));
        }
        xp.skip_unexpected(log_flags.unparsed_xml, "APP_CONFIG::parse");
    }
    mv.push_back(string("Missing </app> in app_config.xml"));
    return ERR_XML_PARSE;
}
Ejemplo n.º 6
0
// This is to parse our own XML.
// parse_rss() parses an RSS feed item.
//
int NOTICE::parse(XML_PARSER& xp) {
    clear();
    while (!xp.get_tag()) {
        if (!xp.is_tag) continue;
        if (xp.match_tag("/notice")) {
            if (strcasestr(description.c_str(), "youtube.com")) {
                is_youtube_video = true;
            }
            return 0;
        }
        if (xp.parse_int("seqno", seqno)) continue;
        if (xp.parse_str("title", title, sizeof(title))) continue;
        if (xp.parse_string("description", description)) {
            xml_unescape(description);   // 2nd pass
            continue;
        }
        if (xp.parse_double("create_time", create_time)) continue;
        if (xp.parse_double("arrival_time", arrival_time)) continue;
        if (xp.parse_bool("is_private", is_private)) continue;
        if (xp.parse_str("category", category, sizeof(category))) continue;
        if (xp.parse_str("link", link, sizeof(link))) continue;
        if (xp.parse_str("project_name", project_name, sizeof(project_name))) continue;
        if (xp.parse_str("guid", guid, sizeof(guid))) continue;
        if (xp.parse_str("feed_url", feed_url, sizeof(feed_url))) continue;
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 7
0
int PROXY_INFO::parse(XML_PARSER& xp) {
    memset(this, 0, sizeof(PROXY_INFO));
    while (!xp.get_tag()) {
        if (xp.match_tag("/proxy_info")) {
            present = false;
            if (strlen(http_server_name)) present = true;
            if (strlen(socks_server_name)) present = true;
            return 0;
        }
        if (xp.parse_bool("use_http_proxy", use_http_proxy)) continue;
        if (xp.parse_bool("use_socks_proxy", use_socks_proxy)) continue;
        if (xp.parse_bool("use_http_auth", use_http_auth)) continue;
        if (xp.parse_str("socks_server_name", socks_server_name, sizeof(socks_server_name))) continue;
        if (xp.parse_int("socks_server_port", socks_server_port)) continue;
        if (xp.parse_str("http_server_name", http_server_name, sizeof(http_server_name))) continue;
        if (xp.parse_int("http_server_port", http_server_port)) continue;
        if (xp.parse_str("socks5_user_name", socks5_user_name,sizeof(socks5_user_name))) continue;
        if (xp.parse_str("socks5_user_passwd", socks5_user_passwd,sizeof(socks5_user_passwd))) continue;
        if (xp.parse_bool("socks5_remote_dns", socks5_remote_dns)) continue;
        if (xp.parse_str("http_user_name", http_user_name,sizeof(http_user_name))) continue;
        if (xp.parse_str("http_user_passwd", http_user_passwd,sizeof(http_user_passwd))) continue;
        if (xp.parse_str("no_proxy", noproxy_hosts, sizeof(noproxy_hosts))) continue;
        if (xp.parse_bool("no_autodetect", no_autodetect)) continue;
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 8
0
int ACTIVE_TASK_SET::parse(XML_PARSER& xp) {
    while (!xp.get_tag()) {
        if (xp.match_tag("/active_task_set")) return 0;
        else if (xp.match_tag("active_task")) {
#ifdef SIM
            ACTIVE_TASK at;
            at.parse(xp);
#else
            ACTIVE_TASK* atp = new ACTIVE_TASK;
            int retval = atp->parse(xp);
            if (!retval) {
                if (slot_taken(atp->slot)) {
                    msg_printf(atp->result->project, MSG_INTERNAL_ERROR,
                        "slot %d in use; discarding result %s",
                        atp->slot, atp->result->name
                    );
                    retval = ERR_XML_PARSE;
                }
            }
            if (!retval) active_tasks.push_back(atp);
            else delete atp;
#endif
        } else {
            if (log_flags.unparsed_xml) {
                msg_printf(NULL, MSG_INFO,
                    "[unparsed_xml] ACTIVE_TASK_SET::parse(): unrecognized %s\n", xp.parsed_tag
                );
            }
        }
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 9
0
int APP_CONFIG::parse_gpu_versions(
    XML_PARSER& xp, MSG_VEC& mv, LOG_FLAGS& log_flags
) {
    double x;
    char buf[1024];
    while (!xp.get_tag()) {
        if (xp.match_tag("/gpu_versions")) return 0;
        else if (xp.parse_double("gpu_usage", x)) {
            if (x <= 0) {
                mv.push_back(string("gpu_usage must be positive in app_config.xml"));
            } else {
                gpu_gpu_usage = x;
            }
            continue;
        }
        else if (xp.parse_double("cpu_usage", x)) {
            if (x < 0) {
                mv.push_back(string("cpu_usage must be non-negative in app_config.xml"));
            } else {
                gpu_cpu_usage = x;
            }
            continue;
        }
        if (log_flags.unparsed_xml) {
            sprintf(buf, "Unparsed line in app_config.xml: %s", xp.parsed_tag);
            mv.push_back(string(buf));
        }
    }
    mv.push_back(string("Missing </gpu_versions> in app_config.xml"));
    return ERR_XML_PARSE;
}
Ejemplo n.º 10
0
// parse a <result> element from scheduling server.
//
int RESULT::parse_server(XML_PARSER& xp) {
    FILE_REF file_ref;

    clear();
    while (!xp.get_tag()) {
        if (xp.match_tag("/result")) return 0;
        if (xp.parse_str("name", name, sizeof(name))) continue;
        if (xp.parse_str("wu_name", wu_name, sizeof(wu_name))) continue;
        if (xp.parse_double("report_deadline", report_deadline)) continue;
        if (xp.parse_str("platform", platform, sizeof(platform))) continue;
        if (xp.parse_str("plan_class", plan_class, sizeof(plan_class))) continue;
        if (xp.parse_int("version_num", version_num)) continue;
        if (xp.match_tag("file_ref")) {
            file_ref.parse(xp);
            output_files.push_back(file_ref);
            continue;
        }
        if (xp.parse_bool("report_immediately", report_immediately)) continue;
        if (log_flags.unparsed_xml) {
            msg_printf(0, MSG_INFO,
                "[unparsed_xml] RESULT::parse(): unrecognized: %s\n",
                xp.parsed_tag
            );
        }
        xp.skip_unexpected();
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 11
0
int JOB_LIMITS::parse(XML_PARSER& xp, const char* end_tag) {
    while (!xp.get_tag()) {
        if (!xp.is_tag) {
            continue;
        }
        if (xp.match_tag(end_tag)) {
            return 0;
        }
        if (xp.match_tag("project")) {
            project_limits.parse(xp, "/project");
            continue;
        }
        if (xp.match_tag("app")) {
            JOB_LIMIT jl;
            jl.parse(xp, "/app");
            if (!strlen(jl.app_name)) {
                log_messages.printf(MSG_NORMAL, "missing app name\n");
                continue;
            }
            app_limits.push_back(jl);
            continue;
        }
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 12
0
int COPROC::parse(XML_PARSER& xp) {
    char buf[256];
    strcpy(type, "");
    clear();
    for (int i=0; i<MAX_COPROC_INSTANCES; i++) {
        device_nums[i] = i;
    }
    while (!xp.get_tag()) {
        if (!xp.is_tag) continue;
        if (xp.match_tag("/coproc")) {
            if (!strlen(type)) return ERR_XML_PARSE;
            clear_usage();
            return 0;
        }
        if (xp.parse_str("type", type, sizeof(type))) continue;
        if (xp.parse_int("count", count)) continue;
        if (xp.parse_double("req_secs", req_secs)) continue;
        if (xp.parse_double("req_instances", req_instances)) continue;
        if (xp.parse_double("peak_flops", peak_flops)) continue;
        if (xp.parse_str("device_nums", buf, sizeof(buf))) {
            int i=0;
            char* p = strtok(buf, " ");
            while (p && i<MAX_COPROC_INSTANCES) {
                device_nums[i++] = atoi(p);
                p = strtok(NULL, " ");
            }
            continue;
        }
        if (xp.parse_bool("non_gpu", non_gpu)) continue;
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 13
0
int JOB_LIMIT::parse(XML_PARSER& xp, const char* end_tag) {
    while (!xp.get_tag()) {
        if (!xp.is_tag) {
            continue;
        }
        if (xp.match_tag(end_tag)) {
            return 0;
        }
        if (xp.parse_str("app_name", app_name, sizeof(app_name))) {
            continue;
        }
        if (xp.match_tag("total_limit")) {
            total.parse(xp, "/total_limit");
            continue;
        }
        if (xp.match_tag("cpu_limit")) {
            proc_type_limits[0].parse(xp, "/cpu_limit");
            continue;
        }
        if (xp.match_tag("gpu_limit")) {
            proc_type_limits[1].parse(xp, "/gpu_limit");
            for (int i=2; i<NPROC_TYPES; i++) {
                proc_type_limits[i] = proc_type_limits[1];
            }
            continue;
        }
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 14
0
int FILE_REF::parse(XML_PARSER& xp) {
    bool temp;

    strcpy(file_name, "");
    strcpy(open_name, "");
    main_program = false;
    copy_file = false;
    optional = false;
    while (!xp.get_tag()) {
        if (xp.match_tag("/file_ref")) return 0;
        if (xp.parse_str("file_name", file_name, sizeof(file_name))) continue;
        if (xp.parse_str("open_name", open_name, sizeof(open_name))) continue;
        if (xp.parse_bool("main_program", main_program)) continue;
        if (xp.parse_bool("copy_file", copy_file)) continue;
        if (xp.parse_bool("optional", optional)) continue;
        if (xp.parse_bool("no_validate", temp)) continue;
        if (log_flags.unparsed_xml) {
            msg_printf(0, MSG_INFO,
                "[unparsed_xml] FILE_REF::parse(): unrecognized: '%s'\n",
                xp.parsed_tag
            );
        }
        xp.skip_unexpected();
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 15
0
// parse a feed descriptor (in scheduler reply or feed list file)
//
int RSS_FEED::parse_desc(XML_PARSER& xp) {
    strcpy(url, "");
    poll_interval = 0;
    next_poll_time = 0;
    while (!xp.get_tag()) {
        if (!xp.is_tag) continue;
        if (xp.match_tag("/rss_feed")) {
            if (!poll_interval || !strlen(url)) {
                if (log_flags.notice_debug) {
                    msg_printf(0, MSG_INFO,
                        "[notice] URL or poll interval missing in sched reply feed"
                    );
                }
                return ERR_XML_PARSE;
            }
            safe_strcpy(url_base, url);
            char* p = strchr(url_base, '?');
            if (p) *p = 0;
            return 0;
        }
        if (xp.parse_str("url", url, sizeof(url))) {
            xml_unescape(url);
        }
        if (xp.parse_double("poll_interval", poll_interval)) continue;
        if (xp.parse_double("next_poll_time", next_poll_time)) continue;
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 16
0
int CLIENT_PLATFORM::parse(XML_PARSER& xp) {
    strcpy(name, "");
    while (!xp.get_tag()) {
        if (xp.match_tag("/alt_platform")) return 0;
        if (xp.parse_str("name", name, sizeof(name))) continue;
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 17
0
int HOST::parse(XML_PARSER& xp) {
    p_ncpus = 1;
    double dtemp;
    string stemp;
    while (!xp.get_tag()) {
        if (xp.match_tag("/host_info")) return 0;
        if (xp.parse_int("timezone", timezone)) continue;
        if (xp.parse_str("domain_name", domain_name, sizeof(domain_name))) continue;
        if (xp.parse_str("ip_addr", last_ip_addr, sizeof(last_ip_addr))) continue;
        if (xp.parse_str("host_cpid", host_cpid, sizeof(host_cpid))) continue;
        if (xp.parse_int("p_ncpus", p_ncpus)) continue;
        if (xp.parse_str("p_vendor", p_vendor, sizeof(p_vendor))) continue;
        if (xp.parse_str("p_model", p_model, sizeof(p_model))) continue;
        if (xp.parse_double("p_fpops", p_fpops)) continue;
        if (xp.parse_double("p_iops", p_iops)) continue;
        if (xp.parse_double("p_membw", p_membw)) continue;
        if (xp.parse_str("os_name", os_name, sizeof(os_name))) continue;
        if (xp.parse_str("os_version", os_version, sizeof(os_version))) continue;
        if (xp.parse_double("m_nbytes", m_nbytes)) continue;
        if (xp.parse_double("m_cache", m_cache)) continue;
        if (xp.parse_double("m_swap", m_swap)) continue;
        if (xp.parse_double("d_total", d_total)) continue;
        if (xp.parse_double("d_free", d_free)) continue;
        if (xp.parse_double("n_bwup", n_bwup)) continue;
        if (xp.parse_double("n_bwdown", n_bwdown)) continue;
        if (xp.parse_str("p_features", p_features, sizeof(p_features))) continue;
        if (xp.parse_str("virtualbox_version", virtualbox_version, sizeof(virtualbox_version))) continue;
        if (xp.parse_bool("p_vm_extensions_disabled", p_vm_extensions_disabled)) continue;

        // parse deprecated fields to avoid error messages
        //
        if (xp.parse_double("p_calculated", dtemp)) continue;
        if (xp.match_tag("p_fpop_err")) continue;
        if (xp.match_tag("p_iop_err")) continue;
        if (xp.match_tag("p_membw_err")) continue;

        // fields reported by 5.5+ clients, not currently used
        //
        if (xp.parse_string("p_capabilities", stemp)) continue;
        if (xp.parse_string("accelerators", stemp)) continue;

#if 1
        // not sure where these fields belong in the above categories
        //
        if (xp.parse_string("cpu_caps", stemp)) continue;
        if (xp.parse_string("cache_l1", stemp)) continue;
        if (xp.parse_string("cache_l2", stemp)) continue;
        if (xp.parse_string("cache_l3", stemp)) continue;
#endif

        log_messages.printf(MSG_NORMAL,
            "HOST::parse(): unrecognized: %s\n", xp.parsed_tag
        );
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 18
0
int SCHED_DB_RESULT::parse_from_client(XML_PARSER& xp) {
    double dtemp;
    bool btemp;
    string stemp;
    int itemp;

    // should be non-zero if exit_status is not found
    exit_status = ERR_NO_EXIT_STATUS;
    memset(this, 0, sizeof(*this));
    while (!xp.get_tag()) {
        if (xp.match_tag("/result")) {
            return 0;
        }
        if (xp.parse_str("name", name, sizeof(name))) continue;
        if (xp.parse_int("state", client_state)) continue;
        if (xp.parse_double("final_cpu_time", cpu_time)) continue;
        if (xp.parse_double("final_elapsed_time", elapsed_time)) continue;
        if (xp.parse_int("exit_status", exit_status)) continue;
        if (xp.parse_int("app_version_num", app_version_num)) continue;
        if (xp.match_tag("file_info")) {
            string s;
            xp.copy_element(s);
            safe_strcat(xml_doc_out, s.c_str());
            continue;
        }
        if (xp.match_tag("stderr_out" )) {
            copy_element_contents(xp.f->f, "</stderr_out>", stderr_out, sizeof(stderr_out));
            continue;
        }
        if (xp.parse_string("platform", stemp)) continue;
        if (xp.parse_int("version_num", itemp)) continue;
        if (xp.parse_string("plan_class", stemp)) continue;
        if (xp.parse_double("completed_time", dtemp)) continue;
        if (xp.parse_string("file_name", stemp)) continue;
        if (xp.match_tag("file_ref")) {
            xp.copy_element(stemp);
            continue;
        }
        if (xp.parse_string("open_name", stemp)) continue;
        if (xp.parse_bool("ready_to_report", btemp)) continue;
        if (xp.parse_double("report_deadline", dtemp)) continue;
        if (xp.parse_string("wu_name", stemp)) continue;

        // deprecated stuff
        if (xp.parse_double("fpops_per_cpu_sec", dtemp)) continue;
        if (xp.parse_double("fpops_cumulative", dtemp)) continue;
        if (xp.parse_double("intops_per_cpu_sec", dtemp)) continue;
        if (xp.parse_double("intops_cumulative", dtemp)) continue;

        log_messages.printf(MSG_NORMAL,
            "RESULT::parse_from_client(): unrecognized: %s\n",
            xp.parsed_tag
        );
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 19
0
int FILE_INFO::parse(XML_PARSER& xp) {
    memset(this, 0, sizeof(*this));
    while (!xp.get_tag()) {
        if (xp.match_tag("/file_info")) {
            if (!strlen(name)) return ERR_XML_PARSE;
            return 0;
        }
        if (xp.parse_str("name", name, 256)) continue;
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 20
0
int TASK::parse(XML_PARSER& xp) {
    char buf[8192];

    weight = 1;
    current_cpu_time = 0;
    final_cpu_time = 0;
    stat_first = true;
    pid = 0;
    is_daemon = false;
    multi_process = false;
    append_cmdline_args = false;
    time_limit = 0;
    priority = PROCESS_PRIORITY_LOWEST;

    while (!xp.get_tag()) {
        if (!xp.is_tag) {
            fprintf(stderr, "%s TASK::parse(): unexpected text %s\n",
                boinc_msg_prefix(buf, sizeof(buf)), xp.parsed_tag
            );
            continue;
        }
        if (xp.match_tag("/task")) {
            return 0;
        }
        else if (xp.parse_string("application", application)) continue;
        else if (xp.parse_str("exec_dir", buf, sizeof(buf))) {
            macro_substitute(buf);
            exec_dir = buf;
            continue;  
        }
        else if (xp.parse_str("setenv", buf, sizeof(buf))) {
            macro_substitute(buf);
            vsetenv.push_back(buf);
            continue;
        }
        else if (xp.parse_string("stdin_filename", stdin_filename)) continue;
        else if (xp.parse_string("stdout_filename", stdout_filename)) continue;
        else if (xp.parse_string("stderr_filename", stderr_filename)) continue;
        else if (xp.parse_str("command_line", buf, sizeof(buf))) {
            macro_substitute(buf);
            command_line = buf;
            continue;
        }
        else if (xp.parse_string("checkpoint_filename", checkpoint_filename)) continue;
        else if (xp.parse_string("fraction_done_filename", fraction_done_filename)) continue;
        else if (xp.parse_double("weight", weight)) continue;
        else if (xp.parse_bool("daemon", is_daemon)) continue;
        else if (xp.parse_bool("multi_process", multi_process)) continue;
        else if (xp.parse_bool("append_cmdline_args", append_cmdline_args)) continue;
        else if (xp.parse_double("time_limit", time_limit)) continue;
        else if (xp.parse_int("priority", priority)) continue;
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 21
0
int parse_trickle_up_urls(XML_PARSER& xp, std::vector<std::string>& urls) {
    string s;
    while (!xp.get_tag()) {
        if (xp.match_tag("/trickle_up_urls")) {
            return 0;
        }
        if (xp.parse_string("url", s)) {
            urls.push_back(s);
        }
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 22
0
int IP_RESULT::parse(XML_PARSER& xp) {
    report_deadline = 0;
    cpu_time_remaining = 0;
    strcpy(name, "");
    while (!xp.get_tag()) {
        if (xp.match_tag("/ip_result")) return 0;
        if (xp.parse_str("name", name, sizeof(name))) continue;
        if (xp.parse_double("report_deadline", report_deadline)) continue;
        if (xp.parse_double("cpu_time_remaining", cpu_time_remaining)) continue;
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 23
0
// Parse log flag preferences
//
int LOG_FLAGS::parse(XML_PARSER& xp) {
    while (!xp.get_tag()) {
        if (!xp.is_tag) {
            continue;
        }
        if (xp.match_tag("/log_flags")) return 0;
        if (xp.parse_bool("file_xfer", file_xfer)) continue;
        if (xp.parse_bool("sched_ops", sched_ops)) continue;
        if (xp.parse_bool("task", task)) continue;

#ifdef ANDROID
        if (xp.parse_bool("android_debug", android_debug)) continue;
#endif
        if (xp.parse_bool("app_msg_receive", app_msg_receive)) continue;
        if (xp.parse_bool("app_msg_send", app_msg_send)) continue;
        if (xp.parse_bool("async_file_debug", async_file_debug)) continue;
        if (xp.parse_bool("benchmark_debug", benchmark_debug)) continue;
        if (xp.parse_bool("checkpoint_debug", checkpoint_debug)) continue;
        if (xp.parse_bool("coproc_debug", coproc_debug)) continue;
        if (xp.parse_bool("cpu_sched", cpu_sched)) continue;
        if (xp.parse_bool("cpu_sched_debug", cpu_sched_debug)) continue;
        if (xp.parse_bool("cpu_sched_status", cpu_sched_status)) continue;
        if (xp.parse_bool("dcf_debug", dcf_debug)) continue;
        if (xp.parse_bool("disk_usage_debug", disk_usage_debug)) continue;
        if (xp.parse_bool("file_xfer_debug", file_xfer_debug)) continue;
        if (xp.parse_bool("gui_rpc_debug", gui_rpc_debug)) continue;
        if (xp.parse_bool("heartbeat_debug", heartbeat_debug)) continue;
        if (xp.parse_bool("http_debug", http_debug)) continue;
        if (xp.parse_bool("http_xfer_debug", http_xfer_debug)) continue;
        if (xp.parse_bool("idle_detection_debug", idle_detection_debug)) continue;
        if (xp.parse_bool("mem_usage_debug", mem_usage_debug)) continue;
        if (xp.parse_bool("network_status_debug", network_status_debug)) continue;
        if (xp.parse_bool("notice_debug", notice_debug)) continue;
        if (xp.parse_bool("poll_debug", poll_debug)) continue;
        if (xp.parse_bool("priority_debug", priority_debug)) continue;
        if (xp.parse_bool("proxy_debug", proxy_debug)) continue;
        if (xp.parse_bool("rr_simulation", rr_simulation)) continue;
        if (xp.parse_bool("rrsim_detail", rrsim_detail)) continue;
        if (xp.parse_bool("sched_op_debug", sched_op_debug)) continue;
        if (xp.parse_bool("scrsave_debug", scrsave_debug)) continue;
        if (xp.parse_bool("slot_debug", slot_debug)) continue;
        if (xp.parse_bool("state_debug", state_debug)) continue;
        if (xp.parse_bool("statefile_debug", statefile_debug)) continue;
        if (xp.parse_bool("suspend_debug", suspend_debug)) continue;
        if (xp.parse_bool("task_debug", task_debug)) continue;
        if (xp.parse_bool("time_debug", time_debug)) continue;
        if (xp.parse_bool("trickle_debug", trickle_debug)) continue;
        if (xp.parse_bool("unparsed_xml", unparsed_xml)) continue;
        if (xp.parse_bool("work_fetch_debug", work_fetch_debug)) continue;
        xp.skip_unexpected(true, "LOG_FLAGS::parse");
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 24
0
 int parse(XML_PARSER& xp) {
     strcpy(file_name, "");
     strcpy(open_name, "");
     while (!xp.get_tag()) {
         if (!xp.is_tag) continue;
         if (xp.match_tag("/file_ref")) {
             return 0;
         }
         if (xp.parse_str("file_name", file_name, sizeof(file_name))) continue;
         if (xp.parse_str("open_name", open_name, sizeof(open_name))) continue;
     }
     return ERR_XML_PARSE;
 }
Ejemplo n.º 25
0
int NORMAL_DIST::parse(XML_PARSER& xp, const char* end_tag) {
    while(!xp.get_tag()) {
        if (!xp.is_tag) return ERR_XML_PARSE;
        if (xp.parse_double("mean", mean)) continue;
        else if (xp.parse_double("std_dev", std_dev)) continue;
        else if (xp.match_tag(end_tag)) return 0;
        else {
            printf("unrecognized: %s\n", xp.parsed_tag);
            return ERR_XML_PARSE;
        }
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 26
0
int PCI_INFO::parse(XML_PARSER& xp) {
    present = false;
    bus_id = device_id = domain_id = 0;
    while (!xp.get_tag()) {
        if (xp.match_tag("/pci_info")) {
            return 0;
        }
        if (xp.parse_int("bus_id", bus_id)) continue;
        if (xp.parse_int("device_id", device_id)) continue;
        if (xp.parse_int("domain_id", domain_id)) continue;
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 27
0
int COPROC_REQ::parse(XML_PARSER& xp) {
    strcpy(type, "");
    count = 0;
    while (!xp.get_tag()) {
        if (xp.match_tag("/coproc")) {
            if (!strlen(type)) return ERR_XML_PARSE;
            return 0;
        }
        if (xp.parse_str("type", type, sizeof(type))) continue;
        if (xp.parse_double("count", count)) continue;
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 28
0
int UNIFORM_DIST::parse(XML_PARSER& xp, const char* end_tag) {
    while (!xp.get_tag()) {
        if (!xp.is_tag) return ERR_XML_PARSE;
        if (xp.parse_double("lo", lo)) continue;
        else if (xp.parse_double("hi", hi)) continue;
        else if (xp.match_tag(end_tag)) return 0;
        else {
            printf("unrecognized: %s\n", xp.parsed_tag);
            return ERR_XML_PARSE;
        }
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 29
0
int HOST::parse_disk_usage(XML_PARSER& xp) {
    while (!xp.get_tag()) {
        if (xp.match_tag("/disk_usage")) return 0;
        if (xp.parse_double("d_boinc_used_total", d_boinc_used_total)) continue;
        if (xp.parse_double("d_boinc_used_project", d_boinc_used_project)) continue;
        if (xp.parse_double("d_project_share", d_project_share)) continue;
        log_messages.printf(MSG_NORMAL,
            "HOST::parse_disk_usage(): unrecognized: %s\n",
            xp.parsed_tag
        );
    }
    return ERR_XML_PARSE;
}
Ejemplo n.º 30
0
int TEMPLATE_DESC::parse(XML_PARSER& xp) {
    int retval;
    string s;
    while (!xp.get_tag()) {
        if (xp.match_tag("input_template")) {
            while (!xp.get_tag()) {
                if (xp.match_tag("/input_template")) break;
                if (xp.parse_string("open_name", s)) {
                    input_files.push_back(s);
                }
            }
        }
        if (xp.match_tag("output_template")) {
            while (!xp.get_tag()) {
                if (xp.match_tag("/output_template")) break;
                if (xp.parse_string("open_name", s)) {
                    output_files.push_back(s);
                }
            }
        }
    }
    return 0;
}