// The contents of this file are subject to the Mozilla Public License // Version 1.0 (the "License"); you may not use this file except in // compliance with the License. You may obtain a copy of the License at // http://www.mozilla.org/MPL/ // // Software distributed under the License is distributed on an "AS IS" // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the // License for the specific language governing rights and limitations // under the License. // // The Original Code is the Berkeley Open Infrastructure for Network Computing. // // The Initial Developer of the Original Code is the SETI@home project. // Portions created by the SETI@home project are Copyright (C) 2002 // University of California at Berkeley. All Rights Reserved. // // Contributor(s): // #include #include "types.h" #include "error_numbers.h" #include "parse.h" #include "scheduler_reply.h" int SCHEDULER_REPLY::parse(FILE* in) { char buf[256]; strcpy(message, ""); strcpy(message_priority, ""); request_delay = 0; hostid = 0; fgets(buf, 256, in); if (!match_tag(buf, "")) { fprintf(stderr, "SCHEDULER_REPLY::parse(): bad first tag %s\n", buf); return ERR_XML_PARSE; } while (fgets(buf, 256, in)) { if (match_tag(buf, "")) { return 0; } else if (parse_int(buf, "", hostid)) { continue; } else if (parse_int(buf, "", request_delay)) { continue; } else if (match_tag(buf, "")) { prefs.parse(in); } else if (match_tag(buf, "")) { APP app; app.parse(in); apps.push_back(app); } else if (match_tag(buf, "")) { FILE_INFO file_info; file_info.parse(in); file_infos.push_back(file_info); } else if (match_tag(buf, "")) { APP_VERSION av; av.parse(in); app_versions.push_back(av); } else if (match_tag(buf, "")) { WORKUNIT wu; wu.parse(in); workunits.push_back(wu); } else if (match_tag(buf, "")) { RESULT result; // make sure this is here so constructor // gets called each time result.parse(in, ""); results.push_back(result); } else if (match_tag(buf, "")) { RESULT result; result.parse(in, ""); result_acks.push_back(result); } else if (parse_str(buf, "