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-11-14 08:29:32 +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-06-01 17:02:14 +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.
|
|
|
|
//
|
|
|
|
// 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
|
2004-06-01 17:02:14 +00:00
|
|
|
|
2004-09-30 21:55:19 +00:00
|
|
|
// a C++ interface to BOINC GUI RPC
|
|
|
|
|
2005-12-16 03:35:15 +00:00
|
|
|
#if !defined(_WIN32) || defined (__CYGWIN__)
|
2004-01-21 07:07:16 +00:00
|
|
|
#include <stdio.h>
|
2004-01-23 21:57:47 +00:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2005-04-09 00:39:31 +00:00
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <netinet/tcp.h>
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
#include <netdb.h>
|
2004-06-10 07:49:50 +00:00
|
|
|
#endif
|
2004-01-23 21:57:47 +00:00
|
|
|
|
2004-06-12 04:45:36 +00:00
|
|
|
#include "miofile.h"
|
2005-06-22 10:51:34 +00:00
|
|
|
#include "prefs.h"
|
2005-08-01 22:44:40 +00:00
|
|
|
#include "hostinfo.h"
|
2004-06-12 04:45:36 +00:00
|
|
|
|
2005-12-20 07:35:50 +00:00
|
|
|
#define GUI_RPC_PORT 31416
|
2004-11-17 09:27:06 +00:00
|
|
|
|
2005-08-09 09:55:45 +00:00
|
|
|
// official HTTP status codes
|
|
|
|
//
|
2006-03-27 03:44:13 +00:00
|
|
|
#define HTTP_STATUS_OK 200
|
|
|
|
#define HTTP_STATUS_PARTIAL_CONTENT 206
|
|
|
|
#define HTTP_STATUS_RANGE_REQUEST_ERROR 416
|
|
|
|
#define HTTP_STATUS_MOVED_PERM 301
|
|
|
|
#define HTTP_STATUS_MOVED_TEMP 302
|
|
|
|
#define HTTP_STATUS_NOT_FOUND 404
|
|
|
|
#define HTTP_STATUS_PROXY_AUTH_REQ 407
|
|
|
|
#define HTTP_STATUS_INTERNAL_SERVER_ERROR 500
|
|
|
|
#define HTTP_STATUS_SERVICE_UNAVAILABLE 503
|
2005-08-09 09:55:45 +00:00
|
|
|
|
2005-04-04 00:35:56 +00:00
|
|
|
#define RUN_MODE_ALWAYS 0
|
|
|
|
#define RUN_MODE_NEVER 1
|
|
|
|
#define RUN_MODE_AUTO 2
|
2004-11-17 09:27:06 +00:00
|
|
|
|
2005-04-04 00:35:56 +00:00
|
|
|
#define RESULT_NEW 0
|
|
|
|
#define RESULT_FILES_DOWNLOADING 1
|
|
|
|
#define RESULT_FILES_DOWNLOADED 2
|
|
|
|
#define RESULT_COMPUTE_ERROR 3
|
|
|
|
#define RESULT_FILES_UPLOADING 4
|
|
|
|
#define RESULT_FILES_UPLOADED 5
|
2004-11-17 09:27:06 +00:00
|
|
|
|
2005-04-04 00:35:56 +00:00
|
|
|
#define CPU_SCHED_UNINITIALIZED 0
|
|
|
|
#define CPU_SCHED_PREEMPTED 1
|
|
|
|
#define CPU_SCHED_SCHEDULED 2
|
2004-11-17 09:27:06 +00:00
|
|
|
|
2005-04-05 00:32:24 +00:00
|
|
|
// see client/ss_logic.h for explanation
|
|
|
|
//
|
2005-04-04 00:35:56 +00:00
|
|
|
#define SS_STATUS_ENABLED 1
|
|
|
|
#define SS_STATUS_RESTARTREQUEST 2
|
|
|
|
#define SS_STATUS_BLANKED 3
|
|
|
|
#define SS_STATUS_BOINCSUSPENDED 4
|
|
|
|
#define SS_STATUS_NOAPPSEXECUTING 6
|
|
|
|
#define SS_STATUS_NOGRAPHICSAPPSEXECUTING 7
|
|
|
|
#define SS_STATUS_QUIT 8
|
2005-04-05 00:32:24 +00:00
|
|
|
#define SS_STATUS_NOPROJECTSDETECTED 9
|
2004-07-08 17:59:46 +00:00
|
|
|
|
2006-03-27 03:44:13 +00:00
|
|
|
// see lib/app_ipc.h for explanation
|
|
|
|
//
|
|
|
|
#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
|
|
|
|
|
2005-08-06 19:20:26 +00:00
|
|
|
// These MUST match the constants in client/client_msgs.h
|
|
|
|
//
|
2006-03-27 03:44:13 +00:00
|
|
|
#define MSG_PRIORITY_INFO 1
|
2005-06-11 00:30:11 +00:00
|
|
|
// show message in black
|
2006-03-27 03:44:13 +00:00
|
|
|
#define MSG_PRIORITY_ERROR 2
|
2005-06-11 00:30:11 +00:00
|
|
|
// show message in red
|
2006-03-27 03:44:13 +00:00
|
|
|
#define MSG_PRIORITY_ALERT_INFO 4
|
2005-06-11 00:30:11 +00:00
|
|
|
// show message in a modal dialog
|
2006-03-27 03:44:13 +00:00
|
|
|
#define MSG_PRIORITY_ALERT_ERROR 5
|
2005-06-21 08:22:18 +00:00
|
|
|
// show error message in a modal dialog
|
2005-06-11 00:30:11 +00:00
|
|
|
|
2005-08-11 06:52:19 +00:00
|
|
|
// Which websites can we look up?
|
2005-08-09 09:55:45 +00:00
|
|
|
//
|
2006-03-27 03:44:13 +00:00
|
|
|
#define LOOKUP_GOOGLE 1
|
|
|
|
#define LOOKUP_YAHOO 2
|
2005-08-09 09:55:45 +00:00
|
|
|
|
2004-09-27 23:35:21 +00:00
|
|
|
struct GUI_URL {
|
|
|
|
std::string name;
|
|
|
|
std::string description;
|
|
|
|
std::string url;
|
|
|
|
|
|
|
|
int parse(MIOFILE&);
|
|
|
|
void print();
|
|
|
|
};
|
|
|
|
|
2005-04-04 06:02:36 +00:00
|
|
|
// statistics at a specific day
|
|
|
|
//
|
2005-08-11 04:45:16 +00:00
|
|
|
struct DAILY_STATS {
|
2005-04-04 06:02:36 +00:00
|
|
|
double user_total_credit;
|
|
|
|
double user_expavg_credit;
|
|
|
|
double host_total_credit;
|
|
|
|
double host_expavg_credit;
|
|
|
|
double day;
|
2005-08-11 04:45:16 +00:00
|
|
|
|
|
|
|
int parse(MIOFILE&);
|
2005-04-04 06:02:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-09-14 15:52:06 +00:00
|
|
|
class PROJECT {
|
|
|
|
public:
|
2004-07-01 17:37:26 +00:00
|
|
|
std::string master_url;
|
2004-01-23 21:57:47 +00:00
|
|
|
double resource_share;
|
2004-07-01 17:37:26 +00:00
|
|
|
std::string project_name;
|
|
|
|
std::string user_name;
|
|
|
|
std::string team_name;
|
2004-09-27 23:35:21 +00:00
|
|
|
std::vector<GUI_URL> gui_urls;
|
2004-01-23 21:57:47 +00:00
|
|
|
double user_total_credit;
|
|
|
|
double user_expavg_credit;
|
|
|
|
double host_total_credit; // as reported by server
|
|
|
|
double host_expavg_credit; // as reported by server
|
2004-10-22 22:37:11 +00:00
|
|
|
double disk_usage;
|
2004-01-23 21:57:47 +00:00
|
|
|
int nrpc_failures; // # of consecutive times we've failed to
|
|
|
|
// contact all scheduling servers
|
|
|
|
int master_fetch_failures;
|
2004-11-15 19:23:58 +00:00
|
|
|
double min_rpc_time; // earliest time to contact any server
|
2004-01-23 21:57:47 +00:00
|
|
|
|
|
|
|
bool master_url_fetch_pending; // need to fetch and parse the master URL
|
|
|
|
bool sched_rpc_pending; // contact scheduling server for preferences
|
|
|
|
bool tentative; // master URL and account ID not confirmed
|
2005-01-25 19:21:35 +00:00
|
|
|
bool non_cpu_intensive;
|
2004-09-27 23:35:21 +00:00
|
|
|
bool suspended_via_gui;
|
2005-04-04 06:02:36 +00:00
|
|
|
bool dont_request_more_work;
|
2006-01-16 05:24:39 +00:00
|
|
|
bool scheduler_rpc_in_progress;
|
2006-01-25 21:25:33 +00:00
|
|
|
bool attached_via_acct_mgr;
|
2004-01-23 21:57:47 +00:00
|
|
|
|
2006-01-18 21:07:04 +00:00
|
|
|
// NOTE: if you add any data items, update copy() to include them
|
|
|
|
|
2004-09-14 15:52:06 +00:00
|
|
|
PROJECT();
|
|
|
|
~PROJECT();
|
|
|
|
|
2004-06-12 04:45:36 +00:00
|
|
|
int parse(MIOFILE&);
|
2004-01-23 21:57:47 +00:00
|
|
|
void print();
|
2004-09-14 15:52:06 +00:00
|
|
|
void clear();
|
2005-04-27 06:55:28 +00:00
|
|
|
void get_name(std::string&);
|
2006-01-18 21:07:04 +00:00
|
|
|
void copy(PROJECT&); // copy to this object
|
2005-04-27 06:55:28 +00:00
|
|
|
|
2006-02-24 03:02:57 +00:00
|
|
|
// used to keep track of whether or not this record needs to be deleted
|
|
|
|
bool flag_for_delete;
|
|
|
|
|
2005-04-04 06:02:36 +00:00
|
|
|
// statistic of the last x days
|
2005-08-11 04:45:16 +00:00
|
|
|
std::vector<DAILY_STATS> statistics;
|
2004-01-23 21:57:47 +00:00
|
|
|
};
|
|
|
|
|
2004-09-14 15:52:06 +00:00
|
|
|
class APP {
|
|
|
|
public:
|
2004-07-01 17:37:26 +00:00
|
|
|
std::string name;
|
2004-01-23 21:57:47 +00:00
|
|
|
PROJECT* project;
|
|
|
|
|
2004-09-14 15:52:06 +00:00
|
|
|
APP();
|
|
|
|
~APP();
|
|
|
|
|
2004-06-12 04:45:36 +00:00
|
|
|
int parse(MIOFILE&);
|
2004-01-23 21:57:47 +00:00
|
|
|
void print();
|
2004-09-14 15:52:06 +00:00
|
|
|
void clear();
|
2004-01-23 21:57:47 +00:00
|
|
|
};
|
|
|
|
|
2004-09-14 15:52:06 +00:00
|
|
|
class APP_VERSION {
|
|
|
|
public:
|
2004-07-01 17:37:26 +00:00
|
|
|
std::string app_name;
|
2004-01-23 21:57:47 +00:00
|
|
|
int version_num;
|
|
|
|
APP* app;
|
|
|
|
PROJECT* project;
|
|
|
|
|
2004-09-14 15:52:06 +00:00
|
|
|
APP_VERSION();
|
|
|
|
~APP_VERSION();
|
|
|
|
|
2004-06-12 04:45:36 +00:00
|
|
|
int parse(MIOFILE&);
|
2004-01-23 21:57:47 +00:00
|
|
|
void print();
|
2004-09-14 15:52:06 +00:00
|
|
|
void clear();
|
2004-01-23 21:57:47 +00:00
|
|
|
};
|
|
|
|
|
2004-09-14 15:52:06 +00:00
|
|
|
class WORKUNIT {
|
|
|
|
public:
|
2004-07-01 17:37:26 +00:00
|
|
|
std::string name;
|
|
|
|
std::string app_name;
|
2004-01-23 21:57:47 +00:00
|
|
|
int version_num;
|
|
|
|
double rsc_fpops_est;
|
|
|
|
double rsc_fpops_bound;
|
|
|
|
double rsc_memory_bound;
|
|
|
|
double rsc_disk_bound;
|
|
|
|
PROJECT* project;
|
|
|
|
APP* app;
|
|
|
|
APP_VERSION* avp;
|
|
|
|
|
2004-09-14 15:52:06 +00:00
|
|
|
WORKUNIT();
|
|
|
|
~WORKUNIT();
|
|
|
|
|
2004-06-12 04:45:36 +00:00
|
|
|
int parse(MIOFILE&);
|
2004-01-23 21:57:47 +00:00
|
|
|
void print();
|
2004-09-14 15:52:06 +00:00
|
|
|
void clear();
|
2004-01-23 21:57:47 +00:00
|
|
|
};
|
|
|
|
|
2004-09-14 15:52:06 +00:00
|
|
|
class RESULT {
|
|
|
|
public:
|
2004-07-01 17:37:26 +00:00
|
|
|
std::string name;
|
|
|
|
std::string wu_name;
|
2004-10-19 21:48:17 +00:00
|
|
|
std::string project_url;
|
2004-01-23 21:57:47 +00:00
|
|
|
int report_deadline;
|
|
|
|
bool ready_to_report;
|
|
|
|
bool got_server_ack;
|
|
|
|
double final_cpu_time;
|
|
|
|
int state;
|
2004-10-19 18:14:40 +00:00
|
|
|
int scheduler_state;
|
2004-01-23 21:57:47 +00:00
|
|
|
int exit_status;
|
|
|
|
int signal;
|
2004-10-26 20:53:24 +00:00
|
|
|
std::string stderr_out;
|
2005-01-22 00:24:34 +00:00
|
|
|
bool suspended_via_gui;
|
|
|
|
bool aborted_via_gui;
|
|
|
|
|
2004-07-19 19:40:06 +00:00
|
|
|
// the following defined if active
|
2004-10-20 23:38:56 +00:00
|
|
|
bool active_task;
|
2004-10-26 20:53:24 +00:00
|
|
|
int active_task_state;
|
2004-01-31 23:21:07 +00:00
|
|
|
int app_version_num;
|
|
|
|
double checkpoint_cpu_time;
|
|
|
|
double current_cpu_time;
|
|
|
|
double fraction_done;
|
2004-12-14 20:28:13 +00:00
|
|
|
double vm_bytes;
|
|
|
|
double rss_bytes;
|
2004-10-20 21:50:28 +00:00
|
|
|
double estimated_cpu_time_remaining;
|
2004-10-26 22:54:43 +00:00
|
|
|
bool supports_graphics;
|
2005-04-21 23:53:39 +00:00
|
|
|
int graphics_mode_acked;
|
2004-07-14 00:53:12 +00:00
|
|
|
|
|
|
|
APP* app;
|
|
|
|
WORKUNIT* wup;
|
2004-01-31 23:21:07 +00:00
|
|
|
PROJECT* project;
|
|
|
|
|
2004-09-14 15:52:06 +00:00
|
|
|
RESULT();
|
|
|
|
~RESULT();
|
|
|
|
|
2004-06-12 04:45:36 +00:00
|
|
|
int parse(MIOFILE&);
|
2004-01-31 23:21:07 +00:00
|
|
|
void print();
|
2004-09-14 15:52:06 +00:00
|
|
|
void clear();
|
2004-01-31 23:21:07 +00:00
|
|
|
};
|
|
|
|
|
2004-09-14 15:52:06 +00:00
|
|
|
class FILE_TRANSFER {
|
|
|
|
public:
|
|
|
|
std::string name;
|
2004-10-19 21:48:17 +00:00
|
|
|
std::string project_url;
|
2004-10-22 20:11:38 +00:00
|
|
|
std::string project_name;
|
2004-10-22 00:22:11 +00:00
|
|
|
double nbytes;
|
2004-09-14 15:52:06 +00:00
|
|
|
bool generated_locally;
|
|
|
|
bool uploaded;
|
|
|
|
bool upload_when_present;
|
|
|
|
bool sticky;
|
|
|
|
bool pers_xfer_active;
|
|
|
|
bool xfer_active;
|
|
|
|
int num_retries;
|
2004-10-22 18:39:21 +00:00
|
|
|
int first_request_time;
|
|
|
|
int next_request_time;
|
|
|
|
int status;
|
|
|
|
double time_so_far;
|
2004-09-14 15:52:06 +00:00
|
|
|
double bytes_xferred;
|
|
|
|
double file_offset;
|
|
|
|
double xfer_speed;
|
|
|
|
std::string hostname;
|
|
|
|
PROJECT* project;
|
|
|
|
|
|
|
|
FILE_TRANSFER();
|
|
|
|
~FILE_TRANSFER();
|
|
|
|
|
|
|
|
int parse(MIOFILE&);
|
|
|
|
void print();
|
|
|
|
void clear();
|
2004-04-02 00:19:22 +00:00
|
|
|
};
|
|
|
|
|
2004-09-14 15:52:06 +00:00
|
|
|
class MESSAGE {
|
|
|
|
public:
|
2004-07-01 17:37:26 +00:00
|
|
|
std::string project;
|
2004-04-02 00:19:22 +00:00
|
|
|
int priority;
|
2004-09-28 22:48:42 +00:00
|
|
|
int seqno;
|
2004-04-02 00:19:22 +00:00
|
|
|
int timestamp;
|
2004-07-01 17:37:26 +00:00
|
|
|
std::string body;
|
2004-09-14 15:52:06 +00:00
|
|
|
|
|
|
|
MESSAGE();
|
|
|
|
~MESSAGE();
|
|
|
|
|
|
|
|
int parse(MIOFILE&);
|
|
|
|
void print();
|
|
|
|
void clear();
|
2004-04-02 00:19:22 +00:00
|
|
|
};
|
|
|
|
|
2005-08-01 22:44:40 +00:00
|
|
|
class GR_PROXY_INFO {
|
2004-09-14 15:52:06 +00:00
|
|
|
public:
|
|
|
|
bool use_http_proxy;
|
|
|
|
bool use_socks_proxy;
|
2004-09-25 19:33:30 +00:00
|
|
|
bool use_http_authentication;
|
2004-09-14 15:52:06 +00:00
|
|
|
int socks_version;
|
|
|
|
std::string socks_server_name;
|
|
|
|
std::string http_server_name;
|
|
|
|
int socks_server_port;
|
|
|
|
int http_server_port;
|
|
|
|
std::string http_user_name;
|
|
|
|
std::string http_user_passwd;
|
|
|
|
std::string socks5_user_name;
|
|
|
|
std::string socks5_user_passwd;
|
|
|
|
|
2005-08-01 22:44:40 +00:00
|
|
|
GR_PROXY_INFO();
|
|
|
|
~GR_PROXY_INFO();
|
2004-09-14 15:52:06 +00:00
|
|
|
|
|
|
|
int parse(MIOFILE&);
|
|
|
|
void print();
|
|
|
|
void clear();
|
|
|
|
};
|
|
|
|
|
|
|
|
class CC_STATE {
|
|
|
|
public:
|
2004-06-30 18:17:21 +00:00
|
|
|
std::vector<PROJECT*> projects;
|
|
|
|
std::vector<APP*> apps;
|
|
|
|
std::vector<APP_VERSION*> app_versions;
|
|
|
|
std::vector<WORKUNIT*> wus;
|
|
|
|
std::vector<RESULT*> results;
|
2004-01-23 21:57:47 +00:00
|
|
|
|
2005-06-22 10:51:34 +00:00
|
|
|
GLOBAL_PREFS global_prefs;
|
|
|
|
|
2004-09-14 15:52:06 +00:00
|
|
|
CC_STATE();
|
|
|
|
~CC_STATE();
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
PROJECT* lookup_project(std::string&);
|
2004-10-19 22:41:26 +00:00
|
|
|
APP* lookup_app(std::string&, std::string&);
|
2004-10-19 20:11:40 +00:00
|
|
|
APP* lookup_app(PROJECT*, std::string&);
|
2004-10-19 22:41:26 +00:00
|
|
|
APP_VERSION* lookup_app_version(std::string&, std::string&, int);
|
2004-10-19 20:11:40 +00:00
|
|
|
APP_VERSION* lookup_app_version(PROJECT*, std::string&, int);
|
2004-10-19 22:41:26 +00:00
|
|
|
WORKUNIT* lookup_wu(std::string&, std::string&);
|
2004-10-19 20:11:40 +00:00
|
|
|
WORKUNIT* lookup_wu(PROJECT*, std::string&);
|
2004-10-19 22:41:26 +00:00
|
|
|
RESULT* lookup_result(std::string&, std::string&);
|
2004-10-19 20:11:40 +00:00
|
|
|
RESULT* lookup_result(PROJECT*, std::string&);
|
2004-09-14 15:52:06 +00:00
|
|
|
|
2004-07-13 23:51:09 +00:00
|
|
|
void print();
|
2004-09-14 15:52:06 +00:00
|
|
|
void clear();
|
2004-07-13 23:51:09 +00:00
|
|
|
};
|
2004-01-23 21:57:47 +00:00
|
|
|
|
2004-09-14 15:52:06 +00:00
|
|
|
class PROJECTS {
|
|
|
|
public:
|
|
|
|
std::vector<PROJECT*> projects;
|
|
|
|
|
|
|
|
PROJECTS();
|
|
|
|
~PROJECTS();
|
|
|
|
|
|
|
|
void print();
|
|
|
|
void clear();
|
|
|
|
};
|
|
|
|
|
|
|
|
class RESULTS {
|
|
|
|
public:
|
2004-07-13 23:51:09 +00:00
|
|
|
std::vector<RESULT*> results;
|
2004-09-14 15:52:06 +00:00
|
|
|
|
|
|
|
RESULTS();
|
|
|
|
~RESULTS();
|
|
|
|
|
2004-07-13 23:51:09 +00:00
|
|
|
void print();
|
2004-09-14 15:52:06 +00:00
|
|
|
void clear();
|
2004-07-13 23:51:09 +00:00
|
|
|
};
|
|
|
|
|
2004-09-14 15:52:06 +00:00
|
|
|
class FILE_TRANSFERS {
|
|
|
|
public:
|
2004-07-13 23:51:09 +00:00
|
|
|
std::vector<FILE_TRANSFER*> file_transfers;
|
2004-09-14 15:52:06 +00:00
|
|
|
|
|
|
|
FILE_TRANSFERS();
|
|
|
|
~FILE_TRANSFERS();
|
|
|
|
|
2004-07-13 23:51:09 +00:00
|
|
|
void print();
|
2004-09-14 15:52:06 +00:00
|
|
|
void clear();
|
|
|
|
};
|
|
|
|
|
|
|
|
class MESSAGES {
|
|
|
|
public:
|
|
|
|
std::vector<MESSAGE*> messages;
|
|
|
|
|
|
|
|
MESSAGES();
|
|
|
|
~MESSAGES();
|
|
|
|
|
|
|
|
void print();
|
|
|
|
void clear();
|
2004-07-13 23:51:09 +00:00
|
|
|
};
|
|
|
|
|
2005-02-15 06:32:43 +00:00
|
|
|
struct DISPLAY_INFO {
|
|
|
|
char window_station[256]; // windows
|
|
|
|
char desktop[256]; // windows
|
|
|
|
char display[256]; // X11
|
|
|
|
|
|
|
|
DISPLAY_INFO();
|
|
|
|
void print_str(char*);
|
|
|
|
};
|
|
|
|
|
2005-06-21 08:22:18 +00:00
|
|
|
struct ACCT_MGR_INFO {
|
|
|
|
std::string acct_mgr_name;
|
|
|
|
std::string acct_mgr_url;
|
2005-09-27 23:55:20 +00:00
|
|
|
bool have_credentials;
|
|
|
|
|
2005-09-27 09:55:54 +00:00
|
|
|
ACCT_MGR_INFO();
|
2005-09-28 05:47:14 +00:00
|
|
|
~ACCT_MGR_INFO(){}
|
2005-09-27 09:55:54 +00:00
|
|
|
|
2005-06-21 08:22:18 +00:00
|
|
|
int parse(MIOFILE&);
|
2005-09-27 09:55:54 +00:00
|
|
|
void clear();
|
2005-06-21 08:22:18 +00:00
|
|
|
};
|
|
|
|
|
2005-09-28 05:47:14 +00:00
|
|
|
struct PROJECT_ATTACH_REPLY {
|
|
|
|
int error_num;
|
|
|
|
std::vector<std::string>messages;
|
|
|
|
|
2005-09-28 11:59:34 +00:00
|
|
|
PROJECT_ATTACH_REPLY();
|
2005-09-28 05:47:14 +00:00
|
|
|
~PROJECT_ATTACH_REPLY(){}
|
2005-09-28 11:59:34 +00:00
|
|
|
|
2005-09-28 05:47:14 +00:00
|
|
|
int parse(MIOFILE&);
|
2005-09-28 11:59:34 +00:00
|
|
|
void clear();
|
2005-09-28 05:47:14 +00:00
|
|
|
};
|
|
|
|
|
2005-09-15 00:16:55 +00:00
|
|
|
struct ACCT_MGR_RPC_REPLY {
|
|
|
|
int error_num;
|
2005-09-28 05:47:14 +00:00
|
|
|
std::vector<std::string>messages;
|
2005-09-15 00:16:55 +00:00
|
|
|
|
2005-09-27 09:55:54 +00:00
|
|
|
ACCT_MGR_RPC_REPLY();
|
2005-09-28 05:47:14 +00:00
|
|
|
~ACCT_MGR_RPC_REPLY(){}
|
2005-09-27 09:55:54 +00:00
|
|
|
|
|
|
|
int parse(MIOFILE&);
|
|
|
|
void clear();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PROJECT_INIT_STATUS {
|
|
|
|
std::string url;
|
|
|
|
std::string name;
|
|
|
|
bool has_account_key;
|
|
|
|
|
|
|
|
PROJECT_INIT_STATUS();
|
2005-09-28 05:47:14 +00:00
|
|
|
~PROJECT_INIT_STATUS(){}
|
2005-09-27 09:55:54 +00:00
|
|
|
|
2005-09-15 00:16:55 +00:00
|
|
|
int parse(MIOFILE&);
|
2005-09-27 09:55:54 +00:00
|
|
|
void clear();
|
2005-09-15 00:16:55 +00:00
|
|
|
};
|
|
|
|
|
2005-07-31 23:33:12 +00:00
|
|
|
struct PROJECT_CONFIG {
|
2005-08-06 19:20:26 +00:00
|
|
|
int error_num;
|
2005-07-31 23:33:12 +00:00
|
|
|
std::string name;
|
|
|
|
int min_passwd_length;
|
2005-09-14 17:10:13 +00:00
|
|
|
bool account_manager;
|
2005-08-09 18:09:04 +00:00
|
|
|
bool uses_username;
|
2005-08-06 19:20:26 +00:00
|
|
|
bool account_creation_disabled;
|
2005-08-10 00:21:35 +00:00
|
|
|
bool client_account_creation_disabled;
|
2005-09-28 05:47:14 +00:00
|
|
|
std::vector<std::string> messages;
|
2005-08-06 19:20:26 +00:00
|
|
|
|
2005-09-27 09:55:54 +00:00
|
|
|
PROJECT_CONFIG();
|
|
|
|
~PROJECT_CONFIG();
|
2005-07-31 23:33:12 +00:00
|
|
|
|
|
|
|
int parse(MIOFILE&);
|
2005-08-09 18:00:33 +00:00
|
|
|
void clear();
|
2005-08-07 01:33:15 +00:00
|
|
|
void print();
|
2005-07-31 23:33:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ACCOUNT_IN {
|
|
|
|
std::string url;
|
|
|
|
std::string email_addr;
|
2006-02-02 08:33:23 +00:00
|
|
|
// this is the account identifier. on systems that use
|
|
|
|
// usernames it is the username, on systems that use
|
|
|
|
// email addresses it is an email address for the user.
|
2005-07-31 23:33:12 +00:00
|
|
|
std::string user_name;
|
2006-02-02 08:33:23 +00:00
|
|
|
// this is the suggested friendly name for the user
|
|
|
|
// during account creation.
|
2005-08-05 23:06:48 +00:00
|
|
|
std::string passwd;
|
2005-08-06 19:20:26 +00:00
|
|
|
|
2005-09-27 09:55:54 +00:00
|
|
|
ACCOUNT_IN();
|
|
|
|
~ACCOUNT_IN();
|
2005-08-06 19:20:26 +00:00
|
|
|
|
|
|
|
void clear();
|
2005-07-31 23:33:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ACCOUNT_OUT {
|
2005-08-05 22:54:00 +00:00
|
|
|
int error_num;
|
2006-02-22 01:32:20 +00:00
|
|
|
std::vector<std::string>messages;
|
|
|
|
|
2005-08-05 22:00:19 +00:00
|
|
|
std::string authenticator;
|
2005-07-31 23:33:12 +00:00
|
|
|
|
2005-09-27 09:55:54 +00:00
|
|
|
ACCOUNT_OUT();
|
|
|
|
~ACCOUNT_OUT();
|
2005-08-06 19:20:26 +00:00
|
|
|
|
2005-07-31 23:33:12 +00:00
|
|
|
int parse(MIOFILE&);
|
2005-08-09 18:00:33 +00:00
|
|
|
void clear();
|
2005-08-07 01:33:15 +00:00
|
|
|
void print();
|
2005-08-06 19:20:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct LOOKUP_WEBSITE {
|
|
|
|
int error_num;
|
|
|
|
|
2005-09-27 09:55:54 +00:00
|
|
|
LOOKUP_WEBSITE();
|
|
|
|
~LOOKUP_WEBSITE();
|
2005-08-06 19:20:26 +00:00
|
|
|
|
|
|
|
int parse(MIOFILE&);
|
|
|
|
void clear();
|
2005-07-31 23:33:12 +00:00
|
|
|
};
|
|
|
|
|
2004-07-13 23:51:09 +00:00
|
|
|
class RPC_CLIENT {
|
2004-09-25 19:33:30 +00:00
|
|
|
public:
|
2004-11-18 01:30:37 +00:00
|
|
|
int sock;
|
2005-08-31 00:18:36 +00:00
|
|
|
int client_major_version;
|
|
|
|
int client_minor_version;
|
|
|
|
int client_release;
|
2005-05-25 19:26:37 +00:00
|
|
|
double start_time;
|
|
|
|
double timeout;
|
|
|
|
bool retry;
|
2005-04-09 00:39:31 +00:00
|
|
|
sockaddr_in addr;
|
|
|
|
|
2005-02-16 23:17:43 +00:00
|
|
|
int send_request(const char*);
|
2004-07-13 23:51:09 +00:00
|
|
|
int get_reply(char*&);
|
2004-09-14 15:52:06 +00:00
|
|
|
RPC_CLIENT();
|
2004-01-21 07:07:16 +00:00
|
|
|
~RPC_CLIENT();
|
2005-12-14 01:07:10 +00:00
|
|
|
int init(const char* host, int port=0);
|
2005-05-25 19:26:37 +00:00
|
|
|
int init_asynch(const char* host, double timeout, bool retry);
|
|
|
|
// timeout == how long to wait until give up
|
|
|
|
// If the caller (i.e. BOINC Manager) just launched the core client,
|
|
|
|
// this should be large enough to allow the process to
|
|
|
|
// run and open its listening socket (e.g. 60 sec)
|
|
|
|
// If connecting to a remote client, it should be large enough
|
|
|
|
// for the user to deal with a "personal firewall" popup
|
|
|
|
// (e.g. 60 sec)
|
2005-12-20 07:35:50 +00:00
|
|
|
// retry: if true, keep retrying
|
2005-05-25 19:26:37 +00:00
|
|
|
// until succeed or timeout.
|
|
|
|
// Use this if just launched the core client.
|
2005-04-08 23:40:50 +00:00
|
|
|
int init_poll();
|
2004-09-30 21:55:19 +00:00
|
|
|
void close();
|
2005-03-30 09:24:31 +00:00
|
|
|
int authorize(const char* passwd);
|
2004-07-13 23:51:09 +00:00
|
|
|
int get_state(CC_STATE&);
|
|
|
|
int get_results(RESULTS&);
|
|
|
|
int get_file_transfers(FILE_TRANSFERS&);
|
2006-02-15 22:35:18 +00:00
|
|
|
int get_project_status(CC_STATE&);
|
2004-09-14 15:52:06 +00:00
|
|
|
int get_project_status(PROJECTS&);
|
|
|
|
int get_disk_usage(PROJECTS&);
|
2005-02-15 06:32:43 +00:00
|
|
|
int show_graphics(
|
2006-03-27 03:44:13 +00:00
|
|
|
const char* project, const char* result_name, int graphics_mode,
|
2005-02-15 06:32:43 +00:00
|
|
|
DISPLAY_INFO&
|
|
|
|
);
|
2005-02-16 23:17:43 +00:00
|
|
|
int project_op(PROJECT&, const char* op);
|
2004-09-05 18:46:19 +00:00
|
|
|
int set_run_mode(int mode);
|
|
|
|
int get_run_mode(int& mode);
|
|
|
|
int set_network_mode(int mode);
|
2004-09-05 18:51:41 +00:00
|
|
|
int get_network_mode(int& mode);
|
2005-02-22 07:10:44 +00:00
|
|
|
int get_activity_state(bool& activities_suspended, bool& network_suspended);
|
2004-11-17 09:27:06 +00:00
|
|
|
int get_screensaver_mode(int& status);
|
2005-02-15 06:32:43 +00:00
|
|
|
int set_screensaver_mode(
|
|
|
|
bool enabled, double blank_time, DISPLAY_INFO&
|
|
|
|
);
|
2004-04-01 23:19:13 +00:00
|
|
|
int run_benchmarks();
|
2005-08-01 22:44:40 +00:00
|
|
|
int set_proxy_settings(GR_PROXY_INFO&);
|
|
|
|
int get_proxy_settings(GR_PROXY_INFO&);
|
2004-09-30 21:41:09 +00:00
|
|
|
int get_messages(int seqno, MESSAGES&);
|
2005-02-16 23:17:43 +00:00
|
|
|
int file_transfer_op(FILE_TRANSFER&, const char*);
|
|
|
|
int result_op(RESULT&, const char*);
|
2004-10-12 00:27:48 +00:00
|
|
|
int get_host_info(HOST_INFO&);
|
2004-11-23 07:45:11 +00:00
|
|
|
int quit();
|
2005-06-21 08:22:18 +00:00
|
|
|
int acct_mgr_info(ACCT_MGR_INFO&);
|
2005-02-16 23:17:43 +00:00
|
|
|
const char* mode_name(int mode);
|
2005-04-04 06:02:36 +00:00
|
|
|
int get_statistics(PROJECTS&);
|
2006-02-09 00:56:51 +00:00
|
|
|
int network_status(int&);
|
2005-06-23 00:15:05 +00:00
|
|
|
int network_available();
|
2005-09-27 09:55:54 +00:00
|
|
|
int get_project_init_status(PROJECT_INIT_STATUS& pis);
|
2005-07-31 23:33:12 +00:00
|
|
|
|
|
|
|
// the following are asynch operations.
|
|
|
|
// Make the first call to start the op,
|
|
|
|
// call the second one periodically until it returns zero.
|
2005-09-22 08:46:51 +00:00
|
|
|
// TODO: do project update
|
2005-07-31 23:33:12 +00:00
|
|
|
//
|
|
|
|
int get_project_config(std::string url);
|
|
|
|
int get_project_config_poll(PROJECT_CONFIG&);
|
|
|
|
int lookup_account(ACCOUNT_IN&);
|
|
|
|
int lookup_account_poll(ACCOUNT_OUT&);
|
|
|
|
int create_account(ACCOUNT_IN&);
|
|
|
|
int create_account_poll(ACCOUNT_OUT&);
|
2005-08-09 09:55:45 +00:00
|
|
|
int lookup_website(int);
|
|
|
|
int lookup_website_poll();
|
2005-09-28 05:47:14 +00:00
|
|
|
int project_attach(const char* url, const char* auth, bool use_config_file=false);
|
|
|
|
int project_attach_poll(PROJECT_ATTACH_REPLY&);
|
|
|
|
int acct_mgr_rpc(const char* url, const char* name, const char* passwd, bool use_config_file=false);
|
|
|
|
int acct_mgr_rpc_poll(ACCT_MGR_RPC_REPLY&);
|
2005-11-12 06:14:10 +00:00
|
|
|
int get_newer_version(std::string&);
|
2006-02-07 22:04:55 +00:00
|
|
|
int read_global_prefs_override();
|
2004-01-21 07:07:16 +00:00
|
|
|
};
|
2004-09-25 19:33:30 +00:00
|
|
|
|
|
|
|
struct RPC {
|
|
|
|
char* mbuf;
|
|
|
|
MIOFILE fin;
|
|
|
|
RPC_CLIENT* rpc_client;
|
|
|
|
|
|
|
|
RPC(RPC_CLIENT*);
|
|
|
|
~RPC();
|
2005-02-16 23:17:43 +00:00
|
|
|
int do_rpc(const char*);
|
2005-05-31 21:59:29 +00:00
|
|
|
int parse_reply();
|
2004-09-25 19:33:30 +00:00
|
|
|
};
|