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-01-30 22:19:19 +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.
|
|
|
|
//
|
|
|
|
// 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-01-30 22:19:19 +00:00
|
|
|
|
2005-08-16 20:48:21 +00:00
|
|
|
#include "network.h"
|
|
|
|
|
2004-01-21 07:07:16 +00:00
|
|
|
class GUI_RPC_CONN {
|
|
|
|
public:
|
|
|
|
int sock;
|
2005-03-07 06:09:04 +00:00
|
|
|
char nonce[256];
|
|
|
|
bool auth_needed;
|
2005-04-09 23:19:38 +00:00
|
|
|
// if true, don't allow operations other than authentication
|
|
|
|
bool is_local;
|
|
|
|
// connection is from local host
|
2004-01-21 07:07:16 +00:00
|
|
|
GUI_RPC_CONN(int);
|
|
|
|
~GUI_RPC_CONN();
|
|
|
|
int handle_rpc();
|
2005-03-07 06:09:04 +00:00
|
|
|
void handle_auth1(MIOFILE&);
|
|
|
|
void handle_auth2(char*, MIOFILE&);
|
2004-01-21 07:07:16 +00:00
|
|
|
};
|
|
|
|
|
2005-03-07 06:09:04 +00:00
|
|
|
// authentication for GUI RPCs:
|
|
|
|
// 1) if a IPaddr-list file is found, accept only from those addrs
|
|
|
|
// 2) if a password file file is found, ALSO demand password auth
|
|
|
|
|
2004-01-21 07:07:16 +00:00
|
|
|
class GUI_RPC_CONN_SET {
|
2004-07-10 07:27:00 +00:00
|
|
|
std::vector<GUI_RPC_CONN*> gui_rpcs;
|
|
|
|
std::vector<int> allowed_remote_ip_addresses;
|
|
|
|
int get_allowed_hosts();
|
2005-03-07 06:09:04 +00:00
|
|
|
int get_password();
|
2004-07-10 07:27:00 +00:00
|
|
|
int insert(GUI_RPC_CONN*);
|
2004-01-21 07:07:16 +00:00
|
|
|
public:
|
2005-12-02 22:29:35 +00:00
|
|
|
int lsock;
|
2005-12-25 04:53:24 +00:00
|
|
|
double last_rpc_time;
|
|
|
|
// actually, the last time of a project or result op
|
|
|
|
// (ones that are triggered by a user action,
|
|
|
|
// rather than by the Manager itself)
|
|
|
|
|
2005-07-23 08:10:39 +00:00
|
|
|
GUI_RPC_CONN_SET();
|
2005-03-07 06:09:04 +00:00
|
|
|
char password[256];
|
2005-08-16 21:31:27 +00:00
|
|
|
void get_fdset(FDSET_GROUP&, FDSET_GROUP&);
|
2005-08-16 20:48:21 +00:00
|
|
|
void got_select(FDSET_GROUP&);
|
2004-05-05 21:15:34 +00:00
|
|
|
int init();
|
2006-07-17 16:38:53 +00:00
|
|
|
void close();
|
2005-12-24 06:32:07 +00:00
|
|
|
bool got_recent_rpc(double interval);
|
2004-01-21 07:07:16 +00:00
|
|
|
};
|
|
|
|
|
2005-12-13 08:04:57 +00:00
|
|
|
|
2005-12-20 07:35:50 +00:00
|
|
|
#define GUI_RPC_PORT 31416
|