2005-01-20 23:22:22 +00:00
|
|
|
// Berkeley Open Infrastructure for Network Computing
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2005 University of California
|
2004-07-13 13:54:09 +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.
|
2004-07-13 13:54:09 +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 _PREFS_
|
|
|
|
#define _PREFS_
|
|
|
|
|
2004-07-13 13:54:09 +00:00
|
|
|
#include <cstdio>
|
2005-06-22 10:51:34 +00:00
|
|
|
#include "miofile.h"
|
2006-09-11 19:03:00 +00:00
|
|
|
#include "parse.h"
|
2002-06-21 06:52:47 +00:00
|
|
|
|
2002-09-26 05:57:10 +00:00
|
|
|
// Global preferences are edited and stored on BOINC servers.
|
2002-06-01 20:26:21 +00:00
|
|
|
// The native representation of preferences is XML.
|
|
|
|
// The client maintains the preferences (in XML form)
|
|
|
|
// and mod time in the state file and in memory.
|
|
|
|
// It includes these items in each scheduler request message.
|
|
|
|
// A scheduler reply message may contain a more recent set of preferences.
|
|
|
|
//
|
|
|
|
|
2006-11-02 20:38:47 +00:00
|
|
|
// A struct with one bool per GLOBAL_PREFS field
|
|
|
|
//
|
|
|
|
struct GLOBAL_PREFS_MASK {
|
|
|
|
bool run_on_batteries;
|
|
|
|
bool run_if_user_active;
|
|
|
|
bool start_hour; // 0..23; no restriction if start==end
|
|
|
|
bool end_hour;
|
|
|
|
bool net_start_hour; // 0..23; no restriction if start==end
|
|
|
|
bool net_end_hour;
|
|
|
|
bool leave_apps_in_memory;
|
|
|
|
bool confirm_before_connecting;
|
|
|
|
bool hangup_if_dialed;
|
|
|
|
bool dont_verify_images;
|
|
|
|
bool work_buf_min_days;
|
|
|
|
bool max_cpus;
|
|
|
|
bool cpu_scheduling_period_minutes;
|
|
|
|
bool disk_interval;
|
|
|
|
bool disk_max_used_gb;
|
|
|
|
bool disk_max_used_pct;
|
|
|
|
bool disk_min_free_gb;
|
|
|
|
bool vm_max_used_frac;
|
|
|
|
bool ram_max_used_busy_frac;
|
|
|
|
bool ram_max_used_idle_frac;
|
|
|
|
bool idle_time_to_run;
|
|
|
|
bool max_bytes_sec_up;
|
|
|
|
bool max_bytes_sec_down;
|
|
|
|
bool cpu_usage_limit;
|
2006-11-07 00:17:01 +00:00
|
|
|
|
|
|
|
GLOBAL_PREFS_MASK();
|
|
|
|
void clear();
|
2006-11-24 21:50:58 +00:00
|
|
|
bool are_prefs_set();
|
2006-11-27 03:53:43 +00:00
|
|
|
bool are_simple_prefs_set();
|
2006-11-02 20:38:47 +00:00
|
|
|
};
|
|
|
|
|
2002-06-21 06:52:47 +00:00
|
|
|
// The following structure is a parsed version of the prefs file
|
|
|
|
//
|
2002-09-29 00:32:11 +00:00
|
|
|
struct GLOBAL_PREFS {
|
2003-09-02 23:49:53 +00:00
|
|
|
int mod_time;
|
2003-02-21 01:38:16 +00:00
|
|
|
bool run_on_batteries;
|
|
|
|
bool run_if_user_active;
|
2003-03-25 01:30:13 +00:00
|
|
|
int start_hour; // 0..23; no restriction if start==end
|
|
|
|
int end_hour;
|
2005-06-08 23:55:21 +00:00
|
|
|
int net_start_hour; // 0..23; no restriction if start==end
|
|
|
|
int net_end_hour;
|
2004-08-06 23:17:59 +00:00
|
|
|
bool leave_apps_in_memory;
|
2002-06-01 20:26:21 +00:00
|
|
|
bool confirm_before_connecting;
|
2003-02-06 19:01:49 +00:00
|
|
|
bool hangup_if_dialed;
|
2005-04-06 19:41:31 +00:00
|
|
|
bool dont_verify_images;
|
2003-02-26 00:47:57 +00:00
|
|
|
double work_buf_min_days;
|
2003-03-20 02:05:25 +00:00
|
|
|
int max_cpus;
|
2004-10-13 18:30:18 +00:00
|
|
|
double cpu_scheduling_period_minutes;
|
2003-03-20 02:05:25 +00:00
|
|
|
double disk_interval;
|
2002-06-01 20:26:21 +00:00
|
|
|
double disk_max_used_gb;
|
|
|
|
double disk_max_used_pct;
|
|
|
|
double disk_min_free_gb;
|
2006-10-02 23:42:38 +00:00
|
|
|
double vm_max_used_frac;
|
|
|
|
double ram_max_used_busy_frac;
|
|
|
|
double ram_max_used_idle_frac;
|
2002-11-19 22:57:05 +00:00
|
|
|
double idle_time_to_run;
|
2003-02-26 00:47:57 +00:00
|
|
|
double max_bytes_sec_up;
|
|
|
|
double max_bytes_sec_down;
|
2006-05-21 22:03:36 +00:00
|
|
|
double cpu_usage_limit;
|
2004-10-06 19:09:37 +00:00
|
|
|
char source_project[256];
|
|
|
|
char source_scheduler[256];
|
2006-10-06 18:52:50 +00:00
|
|
|
bool host_specific;
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2002-09-29 00:32:11 +00:00
|
|
|
GLOBAL_PREFS();
|
2004-10-17 02:18:59 +00:00
|
|
|
void defaults();
|
|
|
|
void clear_bools();
|
2006-11-14 10:12:24 +00:00
|
|
|
int parse(XML_PARSER&, const char* venue, bool& found_venue, GLOBAL_PREFS_MASK& mask);
|
|
|
|
int parse_override(XML_PARSER&, const char* venue, bool& found_venue, GLOBAL_PREFS_MASK& mask);
|
2005-02-16 23:17:43 +00:00
|
|
|
int parse_file(const char* filename, const char* venue, bool& found_venue);
|
2005-06-22 10:51:34 +00:00
|
|
|
int write(MIOFILE&);
|
2006-11-02 20:38:47 +00:00
|
|
|
int write_subset(MIOFILE&, GLOBAL_PREFS_MASK&);
|
2002-04-30 22:22:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|