2005-02-06 21:26:21 +00:00
|
|
|
// Berkeley Open Infrastructure for Network Computing
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2005 University of California
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
// 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
|
|
|
|
|
|
|
|
#ifndef _ACCT_MGR_
|
|
|
|
#define _ACCT_MGR_
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "miofile.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
|
|
|
|
2006-01-09 07:14:58 +00:00
|
|
|
// represents info stored in acct_mgr_url.xml and acct_mgr_login.xml
|
2005-06-21 08:22:18 +00:00
|
|
|
//
|
|
|
|
struct ACCT_MGR_INFO {
|
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 acct_mgr_name[256];
|
|
|
|
char acct_mgr_url[256];
|
|
|
|
char login_name[256];
|
2005-12-14 01:44:11 +00:00
|
|
|
char password_hash[256];
|
|
|
|
// md5 of password.lowercase(login_name)
|
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];
|
|
|
|
// 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;
|
|
|
|
// whether to include GUI RPC port and password hash
|
|
|
|
// in AM RPCs (used for "farm management")
|
2006-06-01 05:29:37 +00:00
|
|
|
bool password_error;
|
2005-06-21 08:22:18 +00:00
|
|
|
|
2005-06-28 23:56:56 +00:00
|
|
|
ACCT_MGR_INFO();
|
2005-06-21 08:22:18 +00:00
|
|
|
int parse_url(MIOFILE&);
|
|
|
|
int parse_login(MIOFILE&);
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
// stuff after here related to RPCs to account managers
|
|
|
|
|
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;
|
2005-02-06 21:26:21 +00:00
|
|
|
|
2005-12-15 00:55:09 +00:00
|
|
|
int parse(FILE*);
|
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 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
|
|
|
|
2005-08-05 22:00:19 +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
|