2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2006-09-01 21:12:45 +00:00
|
|
|
// http://boinc.berkeley.edu
|
2008-08-06 18:36:30 +00:00
|
|
|
// Copyright (C) 2008 University of California
|
2006-09-01 21:12:45 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC 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 3 of the License, or (at your option) any later version.
|
2006-09-01 21:12:45 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2006-09-01 21:12:45 +00:00
|
|
|
// 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.
|
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2006-09-01 21:12:45 +00:00
|
|
|
|
|
|
|
#ifndef _COMMON_DEFS_
|
|
|
|
#define _COMMON_DEFS_
|
|
|
|
|
2006-12-11 23:42:54 +00:00
|
|
|
#include "miofile.h"
|
2012-10-29 22:44:51 +00:00
|
|
|
#include "parse.h"
|
2006-12-11 23:42:54 +00:00
|
|
|
|
2006-09-01 21:12:45 +00:00
|
|
|
// #defines or enums that are shared by more than one BOINC component
|
|
|
|
// (e.g. client, server, Manager, etc.)
|
|
|
|
|
|
|
|
#define GUI_RPC_PORT 31416
|
|
|
|
|
2011-07-13 19:46:03 +00:00
|
|
|
#define COBBLESTONE_SCALE 200/86400e9
|
|
|
|
// multiply normalized PFC by this to get Cobblestones
|
|
|
|
|
2010-11-14 17:04:56 +00:00
|
|
|
// run modes for CPU, GPU, network,
|
|
|
|
// controlled by Activity menu and snooze button
|
|
|
|
//
|
2006-09-01 21:12:45 +00:00
|
|
|
#define RUN_MODE_ALWAYS 1
|
2006-09-05 16:06:44 +00:00
|
|
|
#define RUN_MODE_AUTO 2
|
|
|
|
#define RUN_MODE_NEVER 3
|
2006-11-22 03:23:38 +00:00
|
|
|
#define RUN_MODE_RESTORE 4
|
|
|
|
// restore permanent mode - used only in set_X_mode() GUI RPC
|
2006-09-01 21:12:45 +00:00
|
|
|
|
|
|
|
// values of ACTIVE_TASK::scheduler_state and ACTIVE_TASK::next_scheduler_state
|
2007-01-15 19:25:23 +00:00
|
|
|
// "SCHEDULED" is synonymous with "executing" except when CPU throttling
|
|
|
|
// is in use.
|
2006-09-01 21:12:45 +00:00
|
|
|
#define CPU_SCHED_UNINITIALIZED 0
|
|
|
|
#define CPU_SCHED_PREEMPTED 1
|
|
|
|
#define CPU_SCHED_SCHEDULED 2
|
|
|
|
|
|
|
|
// official HTTP status codes
|
|
|
|
|
|
|
|
#define HTTP_STATUS_CONTINUE 100
|
|
|
|
#define HTTP_STATUS_OK 200
|
|
|
|
#define HTTP_STATUS_PARTIAL_CONTENT 206
|
|
|
|
#define HTTP_STATUS_MOVED_PERM 301
|
|
|
|
#define HTTP_STATUS_MOVED_TEMP 302
|
2012-08-13 18:23:20 +00:00
|
|
|
#define HTTP_STATUS_CLIENT_ERROR 400
|
2006-09-01 21:12:45 +00:00
|
|
|
#define HTTP_STATUS_NOT_FOUND 404
|
|
|
|
#define HTTP_STATUS_PROXY_AUTH_REQ 407
|
|
|
|
#define HTTP_STATUS_RANGE_REQUEST_ERROR 416
|
|
|
|
#define HTTP_STATUS_INTERNAL_SERVER_ERROR 500
|
|
|
|
#define HTTP_STATUS_SERVICE_UNAVAILABLE 503
|
|
|
|
|
|
|
|
// graphics messages
|
|
|
|
//
|
|
|
|
#define MODE_UNSUPPORTED 0
|
|
|
|
#define MODE_HIDE_GRAPHICS 1
|
|
|
|
#define MODE_WINDOW 2
|
|
|
|
#define MODE_FULLSCREEN 3
|
|
|
|
#define MODE_BLANKSCREEN 4
|
|
|
|
#define MODE_REREAD_PREFS 5
|
|
|
|
#define MODE_QUIT 6
|
|
|
|
#define NGRAPHICS_MSGS 7
|
|
|
|
|
2009-01-12 23:47:52 +00:00
|
|
|
// priorities for client messages
|
2007-01-25 23:39:06 +00:00
|
|
|
//
|
|
|
|
#define MSG_INFO 1
|
2006-09-01 21:12:45 +00:00
|
|
|
// write to stdout
|
2009-12-23 18:02:40 +00:00
|
|
|
// GUI: show in event log
|
|
|
|
#define MSG_USER_ALERT 2
|
|
|
|
// Conditions that require user intervention.
|
|
|
|
// Text should be user-friendly.
|
2006-09-01 21:12:45 +00:00
|
|
|
// write to stdout
|
2009-12-23 18:02:40 +00:00
|
|
|
// GUI: show in event log in bold or red; show in notices tab
|
2010-08-26 21:26:52 +00:00
|
|
|
#define MSG_INTERNAL_ERROR 3
|
2007-01-25 23:39:06 +00:00
|
|
|
// Conditions that indicate a problem or bug with BOINC itself,
|
|
|
|
// or with a BOINC project or account manager.
|
|
|
|
// treat same as MSG_INFO, but prepend with [error]
|
2010-08-26 21:26:52 +00:00
|
|
|
#define MSG_SCHEDULER_ALERT 4
|
|
|
|
// high-priority message from scheduler
|
|
|
|
// (used internally within the client;
|
|
|
|
// changed to MSG_USER_ALERT before passing to manager)
|
2007-01-25 23:39:06 +00:00
|
|
|
|
2006-11-10 17:55:22 +00:00
|
|
|
// bitmap defs for task_suspend_reason, network_suspend_reason
|
2007-07-19 23:22:19 +00:00
|
|
|
// Note: doesn't need to be a bitmap, but keep for compatibility
|
2006-11-10 17:55:22 +00:00
|
|
|
//
|
2006-09-01 21:12:45 +00:00
|
|
|
enum SUSPEND_REASON {
|
|
|
|
SUSPEND_REASON_BATTERIES = 1,
|
|
|
|
SUSPEND_REASON_USER_ACTIVE = 2,
|
|
|
|
SUSPEND_REASON_USER_REQ = 4,
|
|
|
|
SUSPEND_REASON_TIME_OF_DAY = 8,
|
|
|
|
SUSPEND_REASON_BENCHMARKS = 16,
|
|
|
|
SUSPEND_REASON_DISK_SIZE = 32,
|
2010-03-10 18:59:40 +00:00
|
|
|
SUSPEND_REASON_CPU_THROTTLE = 64,
|
2007-12-27 21:40:20 +00:00
|
|
|
SUSPEND_REASON_NO_RECENT_INPUT = 128,
|
|
|
|
SUSPEND_REASON_INITIAL_DELAY = 256,
|
2010-01-19 00:03:38 +00:00
|
|
|
SUSPEND_REASON_EXCLUSIVE_APP_RUNNING = 512,
|
2010-04-21 23:17:12 +00:00
|
|
|
SUSPEND_REASON_CPU_USAGE = 1024,
|
2011-04-23 19:02:17 +00:00
|
|
|
SUSPEND_REASON_NETWORK_QUOTA_EXCEEDED = 2048,
|
2012-08-04 00:27:32 +00:00
|
|
|
SUSPEND_REASON_OS = 4096,
|
2013-02-08 00:09:36 +00:00
|
|
|
SUSPEND_REASON_WIFI_STATE = 4097,
|
|
|
|
SUSPEND_REASON_BATTERY_CHARGING = 4098,
|
2013-05-14 19:28:09 +00:00
|
|
|
SUSPEND_REASON_BATTERY_OVERHEATED = 4099,
|
|
|
|
SUSPEND_REASON_NO_GUI_KEEPALIVE = 4100
|
2006-09-01 21:12:45 +00:00
|
|
|
};
|
|
|
|
|
2013-02-08 00:09:36 +00:00
|
|
|
// battery state (currently used only for Android)
|
2013-02-07 22:32:51 +00:00
|
|
|
//
|
|
|
|
enum BATTERY_STATE {
|
2013-02-08 00:09:36 +00:00
|
|
|
BATTERY_STATE_UNKNOWN=0,
|
|
|
|
BATTERY_STATE_DISCHARGING,
|
|
|
|
BATTERY_STATE_CHARGING,
|
|
|
|
BATTERY_STATE_FULL,
|
2013-02-08 23:36:01 +00:00
|
|
|
BATTERY_STATE_OVERHEATED
|
2013-02-07 22:32:51 +00:00
|
|
|
};
|
|
|
|
|
2012-06-29 05:17:01 +00:00
|
|
|
// Values of RESULT::state in client.
|
2006-09-01 21:12:45 +00:00
|
|
|
// THESE MUST BE IN NUMERICAL ORDER
|
|
|
|
// (because of the > comparison in RESULT::computing_done())
|
2013-03-12 04:32:41 +00:00
|
|
|
// see html/inc/common_defs.inc
|
2006-09-01 21:12:45 +00:00
|
|
|
//
|
2011-10-11 17:41:10 +00:00
|
|
|
#define RESULT_NEW 0
|
2006-09-01 21:12:45 +00:00
|
|
|
// New result
|
2011-10-11 17:41:10 +00:00
|
|
|
#define RESULT_FILES_DOWNLOADING 1
|
2006-09-01 21:12:45 +00:00
|
|
|
// Input files for result (WU, app version) are being downloaded
|
2011-10-11 17:41:10 +00:00
|
|
|
#define RESULT_FILES_DOWNLOADED 2
|
2006-09-01 21:12:45 +00:00
|
|
|
// Files are downloaded, result can be (or is being) computed
|
2011-10-11 17:41:10 +00:00
|
|
|
#define RESULT_COMPUTE_ERROR 3
|
2006-09-01 21:12:45 +00:00
|
|
|
// computation failed; no file upload
|
2011-10-11 17:41:10 +00:00
|
|
|
#define RESULT_FILES_UPLOADING 4
|
2006-09-01 21:12:45 +00:00
|
|
|
// Output files for result are being uploaded
|
2011-10-11 17:41:10 +00:00
|
|
|
#define RESULT_FILES_UPLOADED 5
|
2006-09-01 21:12:45 +00:00
|
|
|
// Files are uploaded, notify scheduling server at some point
|
2011-10-11 17:41:10 +00:00
|
|
|
#define RESULT_ABORTED 6
|
2006-09-01 21:12:45 +00:00
|
|
|
// result was aborted
|
2011-10-11 17:41:10 +00:00
|
|
|
#define RESULT_UPLOAD_FAILED 7
|
|
|
|
// some output file permanent failure
|
2006-09-01 21:12:45 +00:00
|
|
|
|
2012-08-13 23:15:50 +00:00
|
|
|
// Values of FILE_INFO::status.
|
|
|
|
// If the status is neither of these two,
|
|
|
|
// it's an error code indicating an unrecoverable error
|
|
|
|
// in the transfer of the file,
|
|
|
|
// or that the file was too big and was deleted.
|
|
|
|
//
|
|
|
|
#define FILE_NOT_PRESENT 0
|
|
|
|
#define FILE_PRESENT 1
|
|
|
|
#define FILE_VERIFY_PENDING 2
|
|
|
|
|
2007-05-11 03:49:25 +00:00
|
|
|
// values of ACTIVE_TASK::task_state
|
|
|
|
//
|
|
|
|
#define PROCESS_UNINITIALIZED 0
|
|
|
|
// process doesn't exist yet
|
|
|
|
#define PROCESS_EXECUTING 1
|
|
|
|
// process is running, as far as we know
|
|
|
|
#define PROCESS_SUSPENDED 9
|
|
|
|
// we've sent it a "suspend" message
|
|
|
|
#define PROCESS_ABORT_PENDING 5
|
|
|
|
// process exceeded limits; send "abort" message, waiting to exit
|
|
|
|
#define PROCESS_QUIT_PENDING 8
|
|
|
|
// we've sent it a "quit" message, waiting to exit
|
2012-02-03 22:08:11 +00:00
|
|
|
#define PROCESS_COPY_PENDING 10
|
|
|
|
// waiting for async file copies to finish
|
2007-05-11 03:49:25 +00:00
|
|
|
|
|
|
|
// states in which the process has exited
|
|
|
|
#define PROCESS_EXITED 2
|
|
|
|
#define PROCESS_WAS_SIGNALED 3
|
|
|
|
#define PROCESS_EXIT_UNKNOWN 4
|
|
|
|
#define PROCESS_ABORTED 6
|
|
|
|
// aborted process has exited
|
|
|
|
#define PROCESS_COULDNT_START 7
|
|
|
|
|
2006-09-01 21:12:45 +00:00
|
|
|
// values of "network status"
|
|
|
|
//
|
|
|
|
#define NETWORK_STATUS_ONLINE 0
|
|
|
|
#define NETWORK_STATUS_WANT_CONNECTION 1
|
|
|
|
#define NETWORK_STATUS_WANT_DISCONNECT 2
|
|
|
|
#define NETWORK_STATUS_LOOKUP_PENDING 3
|
|
|
|
|
2006-09-01 22:21:20 +00:00
|
|
|
// reasons for making a scheduler RPC:
|
|
|
|
//
|
|
|
|
#define RPC_REASON_USER_REQ 1
|
|
|
|
#define RPC_REASON_RESULTS_DUE 2
|
|
|
|
#define RPC_REASON_NEED_WORK 3
|
|
|
|
#define RPC_REASON_TRICKLE_UP 4
|
|
|
|
#define RPC_REASON_ACCT_MGR_REQ 5
|
|
|
|
#define RPC_REASON_INIT 6
|
|
|
|
#define RPC_REASON_PROJECT_REQ 7
|
|
|
|
|
2012-10-29 22:44:51 +00:00
|
|
|
struct TIME_STATS {
|
|
|
|
// we maintain an exponentially weighted average of these quantities:
|
|
|
|
double now;
|
|
|
|
// the client's time of day
|
|
|
|
double on_frac;
|
|
|
|
// the fraction of total time this host runs the client
|
|
|
|
double connected_frac;
|
|
|
|
// of the time this host runs the client,
|
|
|
|
// the fraction it is connected to the Internet,
|
|
|
|
// or -1 if not known
|
|
|
|
double cpu_and_network_available_frac;
|
|
|
|
// of the time this host runs the client,
|
|
|
|
// the fraction it is connected to the Internet
|
|
|
|
// AND network usage is allowed (by prefs and user toggle)
|
|
|
|
// AND CPU usage is allowed
|
|
|
|
double active_frac;
|
|
|
|
// of the time this host runs the client,
|
|
|
|
// the fraction it is enabled to use CPU
|
|
|
|
// (as determined by preferences, manual suspend/resume, etc.)
|
|
|
|
double gpu_active_frac;
|
|
|
|
// same, GPU
|
|
|
|
double client_start_time;
|
|
|
|
double previous_uptime;
|
|
|
|
// duration of previous session
|
|
|
|
|
|
|
|
void write(MIOFILE&);
|
|
|
|
int parse(XML_PARSER&);
|
|
|
|
void print();
|
|
|
|
};
|
|
|
|
|
2006-12-11 23:42:54 +00:00
|
|
|
struct VERSION_INFO {
|
|
|
|
int major;
|
|
|
|
int minor;
|
|
|
|
int release;
|
2008-04-17 16:18:16 +00:00
|
|
|
bool prerelease;
|
2006-12-11 23:42:54 +00:00
|
|
|
int parse(MIOFILE&);
|
|
|
|
void write(MIOFILE&);
|
|
|
|
bool greater_than(VERSION_INFO&);
|
|
|
|
};
|
|
|
|
|
2013-05-14 19:28:09 +00:00
|
|
|
// used for Android
|
|
|
|
//
|
|
|
|
struct DEVICE_STATUS {
|
|
|
|
bool on_ac_power;
|
|
|
|
bool on_usb_power;
|
|
|
|
double battery_charge_pct;
|
|
|
|
int battery_state; // see above
|
|
|
|
double battery_temperature_celsius;
|
|
|
|
bool wifi_online;
|
|
|
|
|
|
|
|
int parse(XML_PARSER&);
|
|
|
|
DEVICE_STATUS() {
|
|
|
|
on_ac_power = false;
|
|
|
|
on_usb_power = false;
|
|
|
|
battery_charge_pct = 0;
|
|
|
|
battery_state = BATTERY_STATE_UNKNOWN;
|
|
|
|
battery_temperature_celsius = 0;
|
|
|
|
wifi_online = false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2009-12-16 19:55:09 +00:00
|
|
|
#define RUN_MUTEX "BoincSingleInstance"
|
|
|
|
#define CLIENT_AUTH_FILENAME "client_auth.xml"
|
|
|
|
#define LOCK_FILE_NAME "lockfile"
|
|
|
|
#define GRAPHICS_APP_FILENAME "graphics_app"
|
2009-02-03 21:22:50 +00:00
|
|
|
#define GUI_RPC_PASSWD_FILE "gui_rpc_auth.cfg"
|
2009-02-05 12:32:16 +00:00
|
|
|
#define SS_CONFIG_FILE "ss_config.xml"
|
2009-12-16 19:55:09 +00:00
|
|
|
|
2009-02-05 12:32:16 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
#define DEFAULT_SS_EXECUTABLE "boincscr.exe"
|
|
|
|
#else
|
|
|
|
#define DEFAULT_SS_EXECUTABLE "boincscr"
|
|
|
|
#endif
|
2009-02-03 21:22:50 +00:00
|
|
|
|
2006-09-01 21:12:45 +00:00
|
|
|
#endif
|