2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2005-01-20 23:22:22 +00:00
|
|
|
// http://boinc.berkeley.edu
|
2008-08-06 18:36:30 +00:00
|
|
|
// Copyright (C) 2008 University of California
|
2003-09-03 05:42:33 +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.
|
2003-09-03 05:42:33 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2005-01-20 23:22:22 +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.
|
2002-04-30 22:22:54 +00:00
|
|
|
//
|
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/>.
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2003-09-03 05:42:33 +00:00
|
|
|
#ifndef H_BACKEND_LIB
|
|
|
|
#define H_BACKEND_LIB
|
|
|
|
|
2008-04-02 19:33:12 +00:00
|
|
|
#include <limits.h>
|
|
|
|
|
2002-07-05 05:33:40 +00:00
|
|
|
#include "crypt.h"
|
2004-08-06 11:42:41 +00:00
|
|
|
#include "sched_config.h"
|
2003-09-03 05:42:33 +00:00
|
|
|
#include "boinc_db.h"
|
2002-07-05 05:33:40 +00:00
|
|
|
|
2014-04-21 06:52:51 +00:00
|
|
|
// describes an input file, possibly remote
|
|
|
|
//
|
|
|
|
struct INFILE_DESC {
|
|
|
|
bool is_remote;
|
2014-04-21 20:19:10 +00:00
|
|
|
|
|
|
|
// the following defined if remote (physical name is jf_MD5)
|
|
|
|
//
|
2014-04-21 06:52:51 +00:00
|
|
|
double nbytes;
|
|
|
|
char md5[64];
|
|
|
|
char url[1024]; // make this a vector to support multiple URLs
|
2014-04-21 20:19:10 +00:00
|
|
|
|
|
|
|
// the following defined if not remote
|
|
|
|
//
|
|
|
|
char name[1024]; // physical name
|
2014-04-21 06:52:51 +00:00
|
|
|
};
|
|
|
|
|
2002-11-07 19:31:34 +00:00
|
|
|
extern int add_signatures(char*, R_RSA_PRIVATE_KEY&);
|
|
|
|
extern int remove_signatures(char*);
|
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
extern int process_result_template(
|
2002-11-06 09:03:55 +00:00
|
|
|
char* result_template,
|
2002-07-05 05:33:40 +00:00
|
|
|
R_RSA_PRIVATE_KEY& key,
|
2002-10-09 04:56:41 +00:00
|
|
|
char* base_filename,
|
- server code: at some point I made a global var "SCHED_CONFIG config",
mostly so that the parse function could assume
that everything was initially zero.
However, various back-end functions pass around SCHED_CONFIG&
as an argument (also named "config").
This creates a shadow, which is always bad.
Worse is the possibility that some projects have back-end programs
that have a SCHED_CONFIG variable that's automatic,
and therefore isn't zero initially,
and therefore isn't parsing correctly.
To fix this, I changed the 2 vectors in SCHED_CONFIG into pointers,
and have the parse routine zero the structure.
I was tempted to remove the SCHED_CONFIG& args to back-end functions,
but this would have broken some projects' code.
I did, however, change the name from config to config_loc
to avoid shadowing.
Also fixed various other compiler warnings.
svn path=/trunk/boinc/; revision=15541
2008-07-02 17:24:53 +00:00
|
|
|
SCHED_CONFIG&
|
2003-08-15 23:44:28 +00:00
|
|
|
);
|
|
|
|
|
2002-07-05 05:33:40 +00:00
|
|
|
extern int read_file(FILE*, char* buf);
|
2004-05-14 23:08:33 +00:00
|
|
|
extern int read_filename(const char* path, char* buf, int len);
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2003-06-04 17:21:26 +00:00
|
|
|
extern void initialize_result(DB_RESULT&, DB_WORKUNIT&);
|
2004-07-02 17:53:31 +00:00
|
|
|
|
2002-10-14 23:10:12 +00:00
|
|
|
extern int create_result(
|
2008-02-21 00:47:50 +00:00
|
|
|
WORKUNIT&,
|
|
|
|
char* result_template_filename,
|
|
|
|
char* suffix,
|
|
|
|
R_RSA_PRIVATE_KEY& key,
|
|
|
|
SCHED_CONFIG& config,
|
|
|
|
char* query_string=0,
|
|
|
|
int priority_increase=0
|
|
|
|
);
|
|
|
|
|
|
|
|
extern int create_result_ti(
|
2004-12-06 22:41:19 +00:00
|
|
|
TRANSITIONER_ITEM&,
|
2004-07-02 17:53:31 +00:00
|
|
|
char* result_template_filename,
|
|
|
|
char* suffix,
|
|
|
|
R_RSA_PRIVATE_KEY& key,
|
2004-09-24 21:28:12 +00:00
|
|
|
SCHED_CONFIG& config,
|
2007-04-05 17:02:01 +00:00
|
|
|
char* query_string=0,
|
|
|
|
int priority_increase=0
|
2002-10-14 23:10:12 +00:00
|
|
|
);
|
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
extern int create_work(
|
2003-06-04 17:21:26 +00:00
|
|
|
DB_WORKUNIT& wu,
|
2003-09-16 21:50:03 +00:00
|
|
|
const char* wu_template,
|
2004-07-10 00:12:06 +00:00
|
|
|
const char* result_template_filename,
|
|
|
|
const char* result_template_filepath,
|
2003-09-16 21:50:03 +00:00
|
|
|
const char** infiles,
|
2002-07-05 05:33:40 +00:00
|
|
|
int ninfiles,
|
2005-10-29 20:16:07 +00:00
|
|
|
SCHED_CONFIG&,
|
2007-01-30 18:19:30 +00:00
|
|
|
const char* command_line = NULL,
|
2014-04-11 06:53:19 +00:00
|
|
|
const char* additional_xml = NULL,
|
|
|
|
char* query_string = 0
|
2002-04-30 22:22:54 +00:00
|
|
|
);
|
2002-12-06 07:33:45 +00:00
|
|
|
|
2014-04-21 06:52:51 +00:00
|
|
|
extern int create_work2(
|
|
|
|
DB_WORKUNIT& wu,
|
|
|
|
const char* wu_template,
|
|
|
|
const char* result_template_filename,
|
|
|
|
const char* result_template_filepath,
|
|
|
|
vector<INFILE_DESC>&,
|
|
|
|
SCHED_CONFIG&,
|
|
|
|
const char* command_line = NULL,
|
|
|
|
const char* additional_xml = NULL,
|
|
|
|
char* query_string = 0
|
|
|
|
);
|
|
|
|
|
2011-09-01 19:58:27 +00:00
|
|
|
extern int stage_file(const char*, bool);
|
|
|
|
|
2012-02-24 22:55:11 +00:00
|
|
|
// the following functions return XML that can be put in
|
|
|
|
// scheduler replies to do file operations
|
|
|
|
//
|
|
|
|
extern int put_file_xml(
|
|
|
|
const char* file_name, vector<const char*> urls,
|
|
|
|
const char* md5, double nbytes, double report_deadline,
|
|
|
|
char* buf
|
|
|
|
);
|
|
|
|
extern int get_file_xml(
|
|
|
|
const char* file_name, vector<const char*> urls,
|
|
|
|
double max_nbytes,
|
|
|
|
double report_deadline,
|
|
|
|
bool generate_upload_certificate,
|
|
|
|
R_RSA_PRIVATE_KEY& key,
|
|
|
|
char* buf
|
|
|
|
);
|
|
|
|
extern int delete_file_xml(
|
|
|
|
const char* file_name,
|
|
|
|
char* buf
|
|
|
|
);
|
|
|
|
|
|
|
|
// the following 3 functions are for programs other than the scheduler
|
2012-02-16 23:59:26 +00:00
|
|
|
// to do file operations.
|
2012-02-24 22:55:11 +00:00
|
|
|
// They work by creating MSG_TO_HOST records in the DB,
|
|
|
|
// containing the needed XML
|
2012-02-16 23:59:26 +00:00
|
|
|
//
|
2012-02-24 22:55:11 +00:00
|
|
|
extern int create_put_file_msg(
|
2011-07-19 20:52:41 +00:00
|
|
|
int host_id, const char* file_name, vector<const char*> urls,
|
2011-07-20 22:27:01 +00:00
|
|
|
const char* md5, double nbytes, double report_deadline
|
2011-07-19 20:52:41 +00:00
|
|
|
);
|
|
|
|
|
2012-02-24 22:55:11 +00:00
|
|
|
extern int create_get_file_msg(
|
2011-07-20 22:27:01 +00:00
|
|
|
int host_id, const char* file_name, vector<const char*> urls,
|
|
|
|
double max_nbytes,
|
|
|
|
double report_deadline,
|
|
|
|
bool generate_upload_certificate,
|
|
|
|
R_RSA_PRIVATE_KEY& key
|
2011-07-19 20:52:41 +00:00
|
|
|
);
|
2011-04-24 02:00:27 +00:00
|
|
|
|
2012-02-24 22:55:11 +00:00
|
|
|
extern int create_delete_file_msg(
|
|
|
|
int host_id,
|
|
|
|
const char* file_name
|
|
|
|
);
|
2012-02-16 23:59:26 +00:00
|
|
|
|
2011-10-18 07:15:04 +00:00
|
|
|
// cancel jobs from min_id to max_id inclusive
|
|
|
|
//
|
|
|
|
extern int cancel_jobs(int min_id, int max_id);
|
|
|
|
|
2012-09-20 18:28:29 +00:00
|
|
|
// cancel a particular job
|
|
|
|
//
|
|
|
|
extern int cancel_job(DB_WORKUNIT&);
|
|
|
|
|
2012-12-07 19:38:50 +00:00
|
|
|
extern int get_total_quota(double&);
|
|
|
|
extern int get_project_flops(double&);
|
2013-01-05 05:05:27 +00:00
|
|
|
extern double user_priority_delta(DB_USER_SUBMIT&, double, double, double);
|
2003-09-03 05:42:33 +00:00
|
|
|
#endif
|