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; }
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; }
int APP::parse(XML_PARSER& xp) { strcpy(name, ""); strcpy(user_friendly_name, ""); project = NULL; non_cpu_intensive = false; while (!xp.get_tag()) { if (xp.match_tag("/app")) { if (!strlen(user_friendly_name)) { strcpy(user_friendly_name, name); } return 0; } if (xp.parse_str("name", name, sizeof(name))) continue; if (xp.parse_str("user_friendly_name", user_friendly_name, sizeof(user_friendly_name))) continue; if (xp.parse_bool("non_cpu_intensive", non_cpu_intensive)) continue; #ifdef SIM if (xp.parse_double("latency_bound", latency_bound)) continue; if (xp.parse_double("fpops_est", fpops_est)) continue; if (xp.parse_double("weight", weight)) continue; if (xp.parse_double("working_set", working_set)) continue; if (xp.match_tag("fpops")) { fpops.parse(xp, "/fpops"); continue; } if (xp.match_tag("checkpoint_period")) { checkpoint_period.parse(xp, "/checkpoint_period"); continue; } #endif if (log_flags.unparsed_xml) { msg_printf(0, MSG_INFO, "[unparsed_xml] APP::parse(): unrecognized: %s\n", xp.parsed_tag ); } xp.skip_unexpected(); } return ERR_XML_PARSE; }
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; }
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; }
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; }
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 (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; }
int parse_project_files(XML_PARSER& xp, vector<FILE_REF>& project_files) { int retval; project_files.clear(); while (!xp.get_tag()) { if (xp.match_tag("/project_files")) return 0; if (xp.match_tag("file_ref")) { FILE_REF file_ref; retval = file_ref.parse(xp); if (!retval) { project_files.push_back(file_ref); } } else { if (log_flags.unparsed_xml) { msg_printf(0, MSG_INFO, "[unparsed_xml] parse_project_files(): unrecognized: %s\n", xp.parsed_tag ); } xp.skip_unexpected(); } } return ERR_XML_PARSE; }
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; }
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; if (xp.parse_double("nbytes", nbytes)) continue; if (xp.parse_int("status", status)) continue; if (xp.parse_bool("sticky", sticky)) continue; } return ERR_XML_PARSE; }
int HOST::parse_time_stats(XML_PARSER& xp) { while (!xp.get_tag()) { if (xp.match_tag("/time_stats")) return 0; if (xp.parse_double("on_frac", on_frac)) continue; if (xp.parse_double("connected_frac", connected_frac)) continue; if (xp.parse_double("active_frac", active_frac)) continue; if (xp.parse_double("gpu_active_frac", gpu_active_frac)) continue; if (xp.parse_double("cpu_and_network_available_frac", cpu_and_network_available_frac)) continue; if (xp.parse_double("client_start_time", client_start_time)) continue; if (xp.parse_double("previous_uptime", previous_uptime)) continue; #if 0 if (xp.match_tag("outages")) continue; if (xp.match_tag("outage")) continue; if (xp.match_tag("start")) continue; if (xp.match_tag("end")) continue; log_messages.printf(MSG_NORMAL, "HOST::parse_time_stats(): unrecognized: %s\n", xp.parsed_tag ); #endif } return ERR_XML_PARSE; }
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; 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; } return ERR_XML_PARSE; }
// 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; 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("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; }
int RANDOM_PROCESS::parse(XML_PARSER& xp, const char* end_tag) { while (!xp.get_tag()) { if (!xp.is_tag) return ERR_XML_PARSE; if (xp.parse_double("lambda", lambda)) continue; else if (xp.parse_double("frac", frac)) continue; else if (xp.match_tag(end_tag)) { init(frac, lambda); return 0; } else { printf("unrecognized: %s\n", xp.parsed_tag); return ERR_XML_PARSE; } } return ERR_XML_PARSE; }
int RESULT::parse_name(XML_PARSER& xp, const char* end_tag) { strcpy(name, ""); while (!xp.get_tag()) { if (xp.match_tag(end_tag)) return 0; if (xp.parse_str("name", name, sizeof(name))) continue; if (log_flags.unparsed_xml) { msg_printf(0, MSG_INFO, "[unparsed_xml] RESULT::parse_name(): unrecognized: %s\n", xp.parsed_tag ); } xp.skip_unexpected(); } return ERR_XML_PARSE; }
int OUTPUT_FILE_INFO::parse(XML_PARSER& xp) { bool found=false; optional = false; no_validate = false; while (!xp.get_tag()) { if (!xp.is_tag) continue; if (xp.match_tag("/file_ref")) { return found?0:ERR_XML_PARSE; } if (xp.parse_string("file_name", name)) { found = true; continue; } if (xp.parse_bool("optional", optional)) continue; if (xp.parse_bool("no_validate", no_validate)) continue; } return ERR_XML_PARSE; }
int RSC_JOB_LIMIT::parse(XML_PARSER& xp, const char* end_tag) { per_proc = false; while (!xp.get_tag()) { if (!xp.is_tag) { continue; } if (xp.match_tag(end_tag)) { return 0; } if (xp.parse_int("jobs", base_limit)) { continue; } if (xp.parse_bool("per_proc", per_proc)) { continue; } } return ERR_XML_PARSE; }
int OTHER_RESULT::parse(XML_PARSER& xp) { strcpy(name, ""); have_plan_class = false; app_version = -1; while (!xp.get_tag()) { if (xp.match_tag("/other_result")) { if (!strcmp(name, "")) return ERR_XML_PARSE; return 0; } if (xp.parse_str("name", name, sizeof(name))) continue; if (xp.parse_int("app_version", app_version)) continue; if (xp.parse_str("plan_class", plan_class, sizeof(plan_class))) { have_plan_class = true; continue; } } return ERR_XML_PARSE; }
int parse_unzip_input(XML_PARSER& xp) { char buf2[256]; string s; while (!xp.get_tag()) { if (xp.match_tag("/unzip_input")) { return 0; } if (xp.parse_string("zipfilename", s)) { unzip_filenames.push_back(s); continue; } fprintf(stderr, "%s unexpected tag in job.xml: %s\n", boinc_msg_prefix(buf2, sizeof(buf2)), xp.parsed_tag ); } return ERR_XML_PARSE; }
int NOTICE::parse_rss(XML_PARSER& xp) { char buf[256]; clear(); while (!xp.get_tag()) { if (!xp.is_tag) continue; if (xp.match_tag("/item")) return 0; if (xp.parse_str("title", title, sizeof(title))) continue; if (xp.parse_str("link", link, sizeof(link))) continue; if (xp.parse_str("guid", guid, sizeof(guid))) continue; if (xp.parse_string("description", description)) continue; if (xp.parse_str("pubDate", buf, sizeof(buf))) { create_time = parse_rss_time(buf); continue; } } return ERR_XML_PARSE; }
int APP_VERSION_CONFIG::parse(XML_PARSER& xp, PROJECT* p) { memset(this, 0, sizeof(APP_VERSION_CONFIG)); while (!xp.get_tag()) { if (xp.match_tag("/app_version")) return 0; if (xp.parse_str("app_name", app_name, 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) { msg_printf(p, MSG_INFO, "Unparsed line in app_info.xml: %s", xp.parsed_tag ); } xp.skip_unexpected(log_flags.unparsed_xml, "APP_VERSION_CONFIG::parse"); } return ERR_XML_PARSE; }
static bool parse_rsc_param(XML_PARSER& xp, const char* end_tag, int& rsc_type, double& value) { char name[256]; bool val_found = false; rsc_type = -1; while (!xp.get_tag()) { if (xp.match_tag(end_tag)) { return (rsc_type > 0 && val_found); } if (xp.parse_str("name", name, sizeof(name))) { rsc_type = rsc_index(name); continue; } if (xp.parse_double("rsc_type", value)) { val_found = true; } } return false; }
int GLOBAL_PREFS::parse_day(XML_PARSER& xp) { int day_of_week = -1; bool has_cpu = false; bool has_net = false; double start_hour = 0; double end_hour = 0; double net_start_hour = 0; double net_end_hour = 0; while (!xp.get_tag()) { if (!xp.is_tag) continue; if (xp.match_tag("/day_prefs")) { if (day_of_week < 0 || day_of_week > 6) return ERR_XML_PARSE; if (has_cpu) { cpu_times.week.set(day_of_week, start_hour, end_hour); } if (has_net) { net_times.week.set(day_of_week, net_start_hour, net_end_hour); } return 0; } if (xp.parse_int("day_of_week", day_of_week)) continue; if (xp.parse_double("start_hour", start_hour)) { has_cpu = true; continue; } if (xp.parse_double("end_hour", end_hour)) { has_cpu = true; continue; } if (xp.parse_double("net_start_hour", net_start_hour)) { has_net = true; continue; } if (xp.parse_double("net_end_hour", net_end_hour)) { has_net = true; continue; } xp.skip_unexpected(true, "GLOBAL_PREFS::parse_day"); } return ERR_XML_PARSE; }
int HOST::parse_net_stats(XML_PARSER& xp) { double dtemp; while (!xp.get_tag()) { if (xp.match_tag("/net_stats")) return 0; if (xp.parse_double("bwup", n_bwup)) continue; if (xp.parse_double("bwdown", n_bwdown)) continue; // items reported by 5.10+ clients, not currently used // if (xp.parse_double("avg_time_up", dtemp)) continue; if (xp.parse_double("avg_up", dtemp)) continue; if (xp.parse_double("avg_time_down", dtemp)) continue; if (xp.parse_double("avg_down", dtemp)) continue; log_messages.printf(MSG_NORMAL, "HOST::parse_net_stats(): unrecognized: %s\n", xp.parsed_tag ); } return ERR_XML_PARSE; }
int EXCLUDE_GPU::parse(XML_PARSER& xp) { bool found_url = false; type = ""; appname = ""; device_num = -1; while (!xp.get_tag()) { if (!xp.is_tag) continue; if (xp.match_tag("/exclude_gpu")) { if (!found_url) return ERR_XML_PARSE; return 0; } if (xp.parse_string("url", url)) { canonicalize_master_url(url); found_url = true; continue; } if (xp.parse_int("device_num", device_num)) continue; if (xp.parse_string("type", type)) continue; if (xp.parse_string("app", appname)) continue; } return ERR_XML_PARSE; }
int COMPLETED_JOB_DESC::parse(XML_PARSER& xp) { canonical_resultid = 0; error_mask = 0; error_resultid = 0; exit_status = 0; elapsed_time = 0; cpu_time = 0; while (!xp.get_tag()) { if (xp.match_tag("/completed_job")) return 0; if (xp.parse_int("canonical_resultid", canonical_resultid)) continue; if (xp.parse_int("error_mask", error_mask)) continue; if (xp.parse_int("error_resultid", error_resultid)) continue; if (xp.parse_int("exit_status", exit_status)) continue; if (xp.parse_double("elapsed_time", elapsed_time)) continue; if (xp.parse_double("cpu_time", cpu_time)) continue; if (xp.parse_string("stderr_out", stderr_out)) { xml_unescape(stderr_out); continue; } } return ERR_XML_PARSE; }
int VBOX_PORT_FORWARD::parse(XML_PARSER& xp) { while (!xp.get_tag()) { if (xp.match_tag("/port_forward")) { if (!host_port) { vboxlog_msg("VBOX_PORT_FORWARD::parse(): unspecified host port"); return ERR_XML_PARSE; } if (!guest_port) { vboxlog_msg("VBOX_PORT_FORWARD::parse(): unspecified guest port"); return ERR_XML_PARSE; } return 0; } else if (xp.parse_bool("is_remote", is_remote)) continue; else if (xp.parse_int("host_port", host_port)) continue; else if (xp.parse_int("guest_port", guest_port)) continue; else if (xp.parse_int("nports", nports)) continue; else { vboxlog_msg("VBOX_PORT_FORWARD::parse(): unexpected text %s", xp.parsed_tag); } } return ERR_XML_PARSE; }
// 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")) { 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; }
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_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; } return ERR_XML_PARSE; }
// Parse XML information about a persistent file transfer // int PERS_FILE_XFER::parse(XML_PARSER& xp) { while (!xp.get_tag()) { if (xp.match_tag("/persistent_file_xfer")) return 0; else if (xp.parse_int("num_retries", nretry)) continue; else if (xp.parse_double("first_request_time", first_request_time)) { continue; } else if (xp.parse_double("next_request_time", next_request_time)) { continue; } else if (xp.parse_double("time_so_far", time_so_far)) continue; else if (xp.parse_double("last_bytes_xferred", last_bytes_xferred)) continue; else if (xp.parse_bool("is_upload", is_upload)) continue; else { if (log_flags.unparsed_xml) { msg_printf(NULL, MSG_INFO, "[unparsed_xml] Unparsed line in file transfer info: %s", xp.parsed_tag ); } } } return ERR_XML_PARSE; }