2008-08-06 18:36:30 +00:00
|
|
|
// This file is part of BOINC.
|
2005-02-06 21:26:21 +00:00
|
|
|
// http://boinc.berkeley.edu
|
2008-08-06 18:36:30 +00:00
|
|
|
// Copyright (C) 2008 University of California
|
2005-02-06 21:26:21 +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.
|
2005-02-06 21:26:21 +00:00
|
|
|
//
|
2008-08-06 18:36:30 +00:00
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
2005-02-06 21:26:21 +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/>.
|
2005-02-06 21:26:21 +00:00
|
|
|
|
|
|
|
#ifndef _ACCT_MGR_
|
|
|
|
#define _ACCT_MGR_
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "miofile.h"
|
2006-09-12 18:18:15 +00:00
|
|
|
#include "parse.h"
|
2005-08-05 18:41:46 +00:00
|
|
|
#include "gui_http.h"
|
2005-12-14 23:43:50 +00:00
|
|
|
#include "client_types.h"
|
2005-02-06 21:26:21 +00:00
|
|
|
|
2010-04-01 05:54:29 +00:00
|
|
|
// represents info stored in acct_mgr_url.xml and acct_mgr_login.xml
|
2008-10-04 23:44:24 +00:00
|
|
|
|
2010-09-08 18:06:56 +00:00
|
|
|
struct ACCT_MGR_INFO : PROJ_AM {
|
2005-06-28 23:56:56 +00:00
|
|
|
// the following used to be std::string but there
|
|
|
|
// were mysterious bugs where setting it to "" didn't work
|
|
|
|
//
|
|
|
|
char login_name[256];
|
2005-12-14 01:44:11 +00:00
|
|
|
char password_hash[256];
|
2010-04-01 05:54:29 +00:00
|
|
|
// md5 of password.lowercase(login_name)
|
2006-09-12 18:18:15 +00:00
|
|
|
char opaque[256];
|
2010-04-01 05:54:29 +00:00
|
|
|
// whatever the AMS sends us
|
2005-12-14 23:43:50 +00:00
|
|
|
char signing_key[MAX_KEY_LEN];
|
2006-01-09 07:14:58 +00:00
|
|
|
char previous_host_cpid[64];
|
2010-04-01 05:54:29 +00:00
|
|
|
// the host CPID sent in last RPC
|
2005-11-26 00:12:44 +00:00
|
|
|
double next_rpc_time;
|
2006-01-06 23:13:21 +00:00
|
|
|
bool send_gui_rpc_info;
|
2010-04-01 05:54:29 +00:00
|
|
|
// whether to include GUI RPC port and password hash
|
|
|
|
// in AM RPCs (used for "farm management")
|
2009-06-12 21:34:33 +00:00
|
|
|
bool cookie_required;
|
2010-04-01 05:54:29 +00:00
|
|
|
// use of cookies are required during initial signup
|
|
|
|
// NOTE: This bool gets dropped after the client has
|
|
|
|
// successfully attached to an account manager
|
2009-06-12 21:34:33 +00:00
|
|
|
char cookie_failure_url[256];
|
2010-04-01 05:54:29 +00:00
|
|
|
// if the cookies could not be detected, provide a
|
|
|
|
// link to a website to go to so the user can find
|
|
|
|
// what login name and password they have been assigned
|
|
|
|
// NOTE: This bool gets dropped after the client has
|
|
|
|
// successfully attached to an account manager
|
2006-06-01 05:29:37 +00:00
|
|
|
bool password_error;
|
2005-06-21 08:22:18 +00:00
|
|
|
|
2010-09-08 18:06:56 +00:00
|
|
|
inline bool using_am() {
|
|
|
|
if (!strlen(master_url)) return false;
|
|
|
|
if (!strlen(login_name)) return false;
|
|
|
|
if (!strlen(password_hash)) return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2005-06-28 23:56:56 +00:00
|
|
|
ACCT_MGR_INFO();
|
2006-11-03 19:24:21 +00:00
|
|
|
int parse_login_file(FILE*);
|
2005-06-21 08:22:18 +00:00
|
|
|
int write_info();
|
|
|
|
int init();
|
2005-06-28 23:56:56 +00:00
|
|
|
void clear();
|
2005-11-26 00:12:44 +00:00
|
|
|
bool poll();
|
2005-06-21 08:22:18 +00:00
|
|
|
};
|
|
|
|
|
2010-09-08 18:06:56 +00:00
|
|
|
// stuff after here related to RPCs to account managers
|
|
|
|
|
2007-03-21 03:23:50 +00:00
|
|
|
struct OPTIONAL_BOOL {
|
|
|
|
bool present;
|
|
|
|
bool value;
|
|
|
|
inline void init() {present=false;}
|
|
|
|
inline void set(bool v) {value=v; present=true;}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct OPTIONAL_DOUBLE {
|
|
|
|
bool present;
|
|
|
|
double value;
|
|
|
|
inline void init() {present=false;}
|
|
|
|
inline void set(double v) {value=v; present=true;}
|
|
|
|
};
|
|
|
|
|
2010-11-17 20:04:58 +00:00
|
|
|
// an account entry in reply message
|
|
|
|
//
|
2005-11-26 00:12:44 +00:00
|
|
|
struct AM_ACCOUNT {
|
2005-02-06 21:26:21 +00:00
|
|
|
std::string url;
|
|
|
|
std::string authenticator;
|
2005-12-15 00:55:09 +00:00
|
|
|
char url_signature[MAX_SIGNATURE_LEN];
|
2005-12-08 19:21:56 +00:00
|
|
|
bool detach;
|
2006-03-17 20:18:39 +00:00
|
|
|
bool update;
|
2007-03-21 03:23:50 +00:00
|
|
|
OPTIONAL_BOOL dont_request_more_work;
|
|
|
|
OPTIONAL_BOOL detach_when_done;
|
|
|
|
OPTIONAL_DOUBLE resource_share;
|
2010-11-17 20:04:58 +00:00
|
|
|
OPTIONAL_BOOL suspend;
|
|
|
|
OPTIONAL_BOOL abort_not_started;
|
2005-02-06 21:26:21 +00:00
|
|
|
|
2006-09-12 18:18:15 +00:00
|
|
|
int parse(XML_PARSER&);
|
2005-11-26 00:12:44 +00:00
|
|
|
AM_ACCOUNT() {}
|
|
|
|
~AM_ACCOUNT() {}
|
2005-02-06 21:26:21 +00:00
|
|
|
};
|
|
|
|
|
2005-08-05 22:00:19 +00:00
|
|
|
struct ACCT_MGR_OP: public GUI_HTTP_OP {
|
2006-06-01 05:29:37 +00:00
|
|
|
bool via_gui;
|
2005-09-15 00:16:55 +00:00
|
|
|
int error_num;
|
2005-06-21 08:22:18 +00:00
|
|
|
ACCT_MGR_INFO ami;
|
2005-06-28 23:56:56 +00:00
|
|
|
// a temporary copy while doing RPC.
|
|
|
|
// CLIENT_STATE::acct_mgr_info is authoratative
|
2005-06-21 08:22:18 +00:00
|
|
|
std::string error_str;
|
2005-11-26 00:12:44 +00:00
|
|
|
std::vector<AM_ACCOUNT> accounts;
|
|
|
|
double repeat_sec;
|
2006-06-01 19:03:00 +00:00
|
|
|
char* global_prefs_xml;
|
|
|
|
char host_venue[256];
|
2010-09-08 20:20:02 +00:00
|
|
|
bool got_rss_feeds;
|
|
|
|
std::vector<RSS_FEED>rss_feeds;
|
2006-06-01 19:03:00 +00:00
|
|
|
|
2006-06-01 05:29:37 +00:00
|
|
|
int do_rpc(
|
|
|
|
std::string url, std::string name, std::string password,
|
|
|
|
bool via_gui
|
|
|
|
);
|
2005-12-15 00:55:09 +00:00
|
|
|
int parse(FILE*);
|
2005-08-05 18:41:46 +00:00
|
|
|
virtual void handle_reply(int http_op_retval);
|
2005-03-11 00:33:25 +00:00
|
|
|
|
2006-06-01 19:03:00 +00:00
|
|
|
ACCT_MGR_OP();
|
2005-09-15 00:16:55 +00:00
|
|
|
virtual ~ACCT_MGR_OP(){}
|
2005-02-06 21:26:21 +00:00
|
|
|
};
|
|
|
|
|
2005-02-08 00:01:50 +00:00
|
|
|
#endif
|