2003-06-11 23:36:48 +00:00
|
|
|
// The contents of this file are subject to the BOINC Public License
|
2002-12-03 18:57:40 +00:00
|
|
|
// 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
|
2003-06-11 23:36:48 +00:00
|
|
|
// http://boinc.berkeley.edu/license_1.0.txt
|
2003-08-01 23:40:16 +00:00
|
|
|
//
|
2002-12-03 18:57:40 +00:00
|
|
|
// 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
|
2003-08-01 23:40:16 +00:00
|
|
|
// under the License.
|
|
|
|
//
|
|
|
|
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
|
|
|
//
|
2002-12-03 18:57:40 +00:00
|
|
|
// The Initial Developer of the Original Code is the SETI@home project.
|
|
|
|
// Portions created by the SETI@home project are Copyright (C) 2002
|
2003-08-01 23:40:16 +00:00
|
|
|
// University of California at Berkeley. All Rights Reserved.
|
|
|
|
//
|
2002-12-03 18:57:40 +00:00
|
|
|
// Contributor(s):
|
|
|
|
//
|
|
|
|
|
2003-04-07 19:06:00 +00:00
|
|
|
#include "boinc_db.h"
|
2002-05-30 07:14:21 +00:00
|
|
|
|
2002-12-03 18:57:40 +00:00
|
|
|
// the following must be at least as large as DB tables
|
|
|
|
// Increase as needed
|
|
|
|
//
|
2002-05-30 07:14:21 +00:00
|
|
|
#define MAX_PLATFORMS 50
|
|
|
|
#define MAX_APPS 10
|
2003-08-01 23:40:16 +00:00
|
|
|
#define MAX_APP_VERSIONS 1000
|
2002-05-30 07:14:21 +00:00
|
|
|
#define MAX_WU_RESULTS 1000
|
2004-01-09 00:51:47 +00:00
|
|
|
#define MAX_INFEASIBLE_THRESHOLD 20
|
2003-09-21 21:00:25 +00:00
|
|
|
#define MAX_INFEASIBLE 500
|
2004-01-09 00:51:47 +00:00
|
|
|
// if # of elements in work array that were infeasible
|
|
|
|
// for at least MAX_INFEASIBLE_THRESHOLD hosts exceeds this,
|
|
|
|
// classify some of them as COULDNT_SEND
|
2002-05-30 07:14:21 +00:00
|
|
|
|
|
|
|
// a workunit/result pair
|
|
|
|
struct WU_RESULT {
|
|
|
|
bool present;
|
2003-09-21 21:00:25 +00:00
|
|
|
int infeasible_count;
|
2002-05-30 07:14:21 +00:00
|
|
|
WORKUNIT workunit;
|
|
|
|
RESULT result;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SCHED_SHMEM {
|
2002-06-01 20:26:21 +00:00
|
|
|
bool ready; // feeder sets to true when init done
|
2002-05-30 07:14:21 +00:00
|
|
|
// the following fields let the scheduler make sure
|
|
|
|
// that the shared mem has the right format
|
|
|
|
int ss_size; // sizeof(SCHED_SHMEM)
|
|
|
|
int platform_size; // sizeof(PLATFORM)
|
|
|
|
int app_size; // sizeof(APP)
|
|
|
|
int app_version_size; // sizeof(APP_VERSION)
|
|
|
|
int wu_result_size; // sizeof(WU_RESULT)
|
|
|
|
int nplatforms;
|
|
|
|
int napps;
|
|
|
|
int napp_versions;
|
|
|
|
int nwu_results;
|
|
|
|
int max_platforms;
|
|
|
|
int max_apps;
|
|
|
|
int max_app_versions;
|
|
|
|
int max_wu_results;
|
|
|
|
PLATFORM platforms[MAX_PLATFORMS];
|
|
|
|
APP apps[MAX_APPS];
|
|
|
|
APP_VERSION app_versions[MAX_APP_VERSIONS];
|
|
|
|
WU_RESULT wu_results[MAX_WU_RESULTS];
|
|
|
|
|
|
|
|
void init();
|
|
|
|
int verify();
|
|
|
|
int scan_tables();
|
|
|
|
|
|
|
|
APP* lookup_app(int);
|
|
|
|
APP_VERSION* lookup_app_version(int appid, int platform, int version);
|
|
|
|
PLATFORM* lookup_platform(char*);
|
|
|
|
};
|
|
|
|
|