2005-01-20 23:22:22 +00:00
|
|
|
// Berkeley Open Infrastructure for Network Computing
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2005 University of California
|
2003-08-15 22:39:56 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation;
|
|
|
|
// either version 2.1 of the License, or (at your option) any later version.
|
2003-08-15 22:39:56 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This software is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
2002-04-30 22:22:54 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// To view the GNU Lesser General Public License visit
|
|
|
|
// http://www.gnu.org/copyleft/lesser.html
|
|
|
|
// or write to the Free Software Foundation, Inc.,
|
|
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2002-04-30 22:22:54 +00:00
|
|
|
|
|
|
|
#ifndef _SERVER_TYPES_
|
|
|
|
#define _SERVER_TYPES_
|
|
|
|
|
2004-07-13 13:54:09 +00:00
|
|
|
#include <cstdio>
|
2002-04-30 22:22:54 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2003-04-07 19:06:00 +00:00
|
|
|
#include "boinc_db.h"
|
2003-06-11 18:38:08 +00:00
|
|
|
#include "result_state.h"
|
2004-05-03 02:18:35 +00:00
|
|
|
#include "md5_file.h"
|
2002-12-09 23:06:17 +00:00
|
|
|
|
2005-01-31 23:20:49 +00:00
|
|
|
// summary of a client's request for work, and our response to it
|
2004-09-10 00:41:48 +00:00
|
|
|
//
|
|
|
|
struct WORK_REQ {
|
|
|
|
bool infeasible_only;
|
|
|
|
double seconds_to_fill;
|
2005-02-14 20:11:01 +00:00
|
|
|
// in "normalized CPU seconds" (see doc/work_req.php)
|
2004-09-10 00:41:48 +00:00
|
|
|
double disk_available;
|
|
|
|
int nresults;
|
|
|
|
int core_client_version;
|
|
|
|
// the following flags are set whenever a result is infeasible;
|
|
|
|
// used to construct explanatory message to user
|
|
|
|
//
|
|
|
|
bool insufficient_disk;
|
|
|
|
bool insufficient_mem;
|
|
|
|
bool insufficient_speed;
|
|
|
|
bool no_app_version;
|
|
|
|
bool homogeneous_redundancy_reject;
|
|
|
|
bool outdated_core;
|
|
|
|
bool daily_result_quota_exceeded;
|
2005-02-22 17:53:17 +00:00
|
|
|
int daily_result_quota; // for this machine: number of cpus * daily_quota/cpu
|
2004-09-10 00:41:48 +00:00
|
|
|
void update_for_result(double seconds_filled);
|
|
|
|
};
|
|
|
|
|
|
|
|
// a description of a sticky file on host.
|
|
|
|
//
|
|
|
|
struct FILE_INFO {
|
|
|
|
char name[256];
|
2004-09-10 21:02:11 +00:00
|
|
|
|
|
|
|
int parse(FILE*);
|
2004-09-10 00:41:48 +00:00
|
|
|
};
|
|
|
|
|
2004-06-24 21:00:13 +00:00
|
|
|
struct MSG_FROM_HOST_DESC {
|
2004-07-06 04:10:51 +00:00
|
|
|
char variety[256];
|
2004-09-10 00:41:48 +00:00
|
|
|
std::string msg_text;
|
2004-01-08 00:27:59 +00:00
|
|
|
int parse(FILE*);
|
|
|
|
};
|
|
|
|
|
2004-01-26 19:29:39 +00:00
|
|
|
// an app version from an anonymous-platform client
|
|
|
|
//
|
|
|
|
struct CLIENT_APP_VERSION {
|
|
|
|
char app_name[256];
|
|
|
|
int version_num;
|
|
|
|
|
|
|
|
int parse(FILE*);
|
|
|
|
};
|
|
|
|
|
2004-03-23 03:59:32 +00:00
|
|
|
// subset of global prefs used by scheduler
|
|
|
|
//
|
|
|
|
struct GLOBAL_PREFS {
|
|
|
|
double disk_max_used_gb;
|
|
|
|
double disk_max_used_pct;
|
|
|
|
double disk_min_free_gb;
|
|
|
|
|
2004-03-31 06:07:17 +00:00
|
|
|
void parse(char* buf, char* venue);
|
2004-03-23 03:59:32 +00:00
|
|
|
};
|
|
|
|
|
2004-09-13 18:05:54 +00:00
|
|
|
struct GUI_URLS {
|
|
|
|
char* text;
|
|
|
|
void init();
|
2004-09-27 19:44:40 +00:00
|
|
|
void get_gui_urls(USER& user, HOST& host, TEAM& team, char*);
|
2004-09-13 18:05:54 +00:00
|
|
|
};
|
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
struct SCHEDULER_REQUEST {
|
|
|
|
char authenticator[256];
|
|
|
|
char platform_name[256];
|
2004-04-30 18:26:20 +00:00
|
|
|
char cross_project_id[256];
|
2002-04-30 22:22:54 +00:00
|
|
|
int hostid; // zero if first RPC
|
2002-12-02 04:29:40 +00:00
|
|
|
int core_client_major_version;
|
|
|
|
int core_client_minor_version;
|
2002-04-30 22:22:54 +00:00
|
|
|
int rpc_seqno;
|
2004-12-06 22:41:19 +00:00
|
|
|
double work_req_seconds;
|
2005-02-06 21:26:21 +00:00
|
|
|
// in "normalized CPU seconds" (see work_req.php)
|
2004-07-06 21:51:49 +00:00
|
|
|
double resource_share_fraction;
|
2004-07-22 18:56:54 +00:00
|
|
|
double estimated_delay;
|
2005-02-14 04:39:07 +00:00
|
|
|
// how many wall-clock seconds will elapse before
|
|
|
|
// host will begin any new work for this project
|
2003-12-07 18:58:08 +00:00
|
|
|
char global_prefs_xml[LARGE_BLOB_SIZE];
|
2004-05-13 18:18:22 +00:00
|
|
|
char code_sign_key[4096];
|
2004-08-14 00:37:38 +00:00
|
|
|
|
|
|
|
// ROMW: Added these back in since we have 3.x clients who still want
|
|
|
|
// want to send us the older style for determining disk usage.
|
|
|
|
// TODO: Remove the two lines below when the 4.x way of doing things
|
|
|
|
// is completely implemented.
|
|
|
|
double total_disk_usage;
|
|
|
|
double project_disk_usage;
|
|
|
|
|
2004-08-16 11:31:59 +00:00
|
|
|
#if 0
|
2004-08-05 22:14:23 +00:00
|
|
|
double project_disk_free;
|
|
|
|
double potentially_free_offender;
|
|
|
|
double potentially_free_self;
|
2004-08-16 11:31:59 +00:00
|
|
|
#endif
|
2004-08-14 00:37:38 +00:00
|
|
|
|
2004-01-26 19:29:39 +00:00
|
|
|
bool anonymous_platform;
|
2004-09-10 00:41:48 +00:00
|
|
|
std::vector<CLIENT_APP_VERSION> client_app_versions;
|
2004-03-23 03:59:32 +00:00
|
|
|
GLOBAL_PREFS global_prefs;
|
2004-05-03 02:18:35 +00:00
|
|
|
char global_prefs_source_email_hash[MD5_LEN];
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2004-05-13 04:48:19 +00:00
|
|
|
HOST host; // request message is parsed into here.
|
|
|
|
// does NOT contain the full host record.
|
2004-09-10 00:41:48 +00:00
|
|
|
std::vector<RESULT> results;
|
|
|
|
std::vector<MSG_FROM_HOST_DESC> msgs_from_host;
|
|
|
|
std::vector<FILE_INFO> file_infos; // sticky files reported by host
|
2002-04-30 22:22:54 +00:00
|
|
|
|
|
|
|
SCHEDULER_REQUEST();
|
|
|
|
~SCHEDULER_REQUEST();
|
|
|
|
int parse(FILE*);
|
2004-01-26 19:29:39 +00:00
|
|
|
bool has_version(APP& app);
|
2005-01-31 16:10:49 +00:00
|
|
|
int write(FILE*); // write request info to file: not complete
|
2002-04-30 22:22:54 +00:00
|
|
|
};
|
|
|
|
|
2005-01-31 22:19:03 +00:00
|
|
|
// message intended for human eyes
|
|
|
|
//
|
|
|
|
struct USER_MESSAGE {
|
|
|
|
std::string message;
|
|
|
|
std::string priority;
|
2005-02-16 23:17:43 +00:00
|
|
|
USER_MESSAGE(const char* m, const char*p);
|
2005-01-31 22:19:03 +00:00
|
|
|
};
|
|
|
|
|
2002-09-22 23:27:14 +00:00
|
|
|
// NOTE: if any field requires initialization,
|
|
|
|
// you must do it in the constructor. Nothing is zeroed by default.
|
|
|
|
//
|
2002-04-30 22:22:54 +00:00
|
|
|
struct SCHEDULER_REPLY {
|
2005-01-31 23:20:49 +00:00
|
|
|
WORK_REQ wreq;
|
2005-02-16 23:17:43 +00:00
|
|
|
double request_delay; // don't request again until this time elapses
|
2005-01-31 22:19:03 +00:00
|
|
|
std::vector<USER_MESSAGE> messages;
|
2004-10-01 22:00:39 +00:00
|
|
|
int hostid;
|
|
|
|
// nonzero only if a new host record was created.
|
|
|
|
// this tells client to reset rpc_seqno
|
2002-09-27 20:36:03 +00:00
|
|
|
bool send_global_prefs; // whether to send global preferences
|
2002-12-02 04:29:40 +00:00
|
|
|
bool nucleus_only; // send only message
|
2003-08-15 22:39:56 +00:00
|
|
|
bool probable_user_browser;
|
2002-05-29 23:25:21 +00:00
|
|
|
USER user;
|
2004-05-03 02:18:35 +00:00
|
|
|
char email_hash[MD5_LEN];
|
2004-05-13 04:48:19 +00:00
|
|
|
HOST host; // after validation, contains full host rec
|
2003-02-24 21:31:36 +00:00
|
|
|
TEAM team;
|
2004-09-10 00:41:48 +00:00
|
|
|
std::vector<APP> apps;
|
|
|
|
std::vector<APP_VERSION> app_versions;
|
|
|
|
std::vector<WORKUNIT>wus;
|
|
|
|
std::vector<RESULT>results;
|
|
|
|
std::vector<RESULT>result_acks;
|
|
|
|
std::vector<MSG_TO_HOST>msgs_to_host;
|
|
|
|
std::vector<FILE_INFO>file_deletes;
|
2004-05-13 18:18:22 +00:00
|
|
|
char code_sign_key[4096];
|
|
|
|
char code_sign_key_signature[4096];
|
2004-06-24 21:00:13 +00:00
|
|
|
bool send_msg_ack;
|
2004-05-03 02:18:35 +00:00
|
|
|
bool update_user_record;
|
2004-08-05 22:14:23 +00:00
|
|
|
bool deletion_policy_priority;
|
|
|
|
bool deletion_policy_expire;
|
2002-04-30 22:22:54 +00:00
|
|
|
|
|
|
|
SCHEDULER_REPLY();
|
|
|
|
~SCHEDULER_REPLY();
|
|
|
|
int write(FILE*);
|
|
|
|
void insert_app_unique(APP&);
|
|
|
|
void insert_app_version_unique(APP_VERSION&);
|
|
|
|
void insert_workunit_unique(WORKUNIT&);
|
|
|
|
void insert_result(RESULT&);
|
2005-01-31 22:19:03 +00:00
|
|
|
void insert_message(USER_MESSAGE&);
|
2005-02-09 20:06:15 +00:00
|
|
|
bool work_needed(bool locality_sched=false);
|
2005-02-16 23:17:43 +00:00
|
|
|
void set_delay(double);
|
2002-04-30 22:22:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|