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-05-17 22:15:10 +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-04-10 09:11:03 +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.
|
2004-05-17 22:15:10 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// To view the GNU Lesser General Public License visit
|
|
|
|
// http://www.gnu.org/copyleft/lesser.html
|
|
|
|
// or write to the Free Software Foundation, Inc.,
|
2007-10-09 11:35:47 +00:00
|
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-04-11 04:37:10 +00:00
|
|
|
#ifndef _MAINDOCUMENT_H_
|
|
|
|
#define _MAINDOCUMENT_H_
|
|
|
|
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma interface "MainDocument.cpp"
|
|
|
|
#endif
|
|
|
|
|
2007-09-20 11:10:59 +00:00
|
|
|
#include <vector>
|
2006-09-01 21:06:30 +00:00
|
|
|
#include "common_defs.h"
|
2004-09-10 23:17:08 +00:00
|
|
|
#include "gui_rpc_client.h"
|
|
|
|
|
2007-09-20 11:10:59 +00:00
|
|
|
typedef struct {
|
|
|
|
int slot;
|
|
|
|
std::string project_url;
|
|
|
|
std::string name;
|
|
|
|
#ifdef _WIN32
|
|
|
|
HANDLE pid;
|
|
|
|
#else
|
|
|
|
int pid;
|
|
|
|
#endif
|
|
|
|
} RUNNING_GFX_APP;
|
|
|
|
|
|
|
|
|
2007-10-05 16:47:07 +00:00
|
|
|
extern bool g_use_sandbox;
|
|
|
|
|
2005-04-06 20:40:19 +00:00
|
|
|
class CMainDocument;
|
2008-01-30 06:09:34 +00:00
|
|
|
class CBOINCClientManager;
|
2005-04-06 20:40:19 +00:00
|
|
|
|
2005-04-17 02:10:52 +00:00
|
|
|
class CNetworkConnection : public wxObject {
|
2005-04-06 20:40:19 +00:00
|
|
|
public:
|
2005-04-17 02:10:52 +00:00
|
|
|
CNetworkConnection(CMainDocument* pDocument);
|
2005-04-10 02:24:08 +00:00
|
|
|
~CNetworkConnection();
|
2005-04-08 04:23:37 +00:00
|
|
|
|
2006-03-27 07:55:04 +00:00
|
|
|
void Poll();
|
2005-04-08 04:23:37 +00:00
|
|
|
void FireReconnectEvent() { m_bConnectEvent = true; };
|
2008-01-30 06:09:34 +00:00
|
|
|
void ForceDisconnect() { m_bForceReconnect = false; m_bReconnectOnError = false; m_bConnectEvent = false; SetStateDisconnected(); };
|
2006-04-25 00:59:49 +00:00
|
|
|
void ForceReconnect() { m_bForceReconnect = true; SetStateDisconnected(); };
|
2005-04-24 00:09:40 +00:00
|
|
|
int FrameShutdownDetected();
|
|
|
|
int GetConnectedComputerName(wxString& strMachine);
|
2007-05-03 16:17:54 +00:00
|
|
|
int GetConnectedComputerVersion(wxString& strVersion);
|
2005-04-24 00:09:40 +00:00
|
|
|
int GetConnectingComputerName(wxString& strMachine);
|
2005-12-06 03:18:02 +00:00
|
|
|
bool IsComputerNameLocal(const wxString& strMachine);
|
2008-01-11 17:56:21 +00:00
|
|
|
int GetLocalPassword(wxString& strPassword);
|
2008-02-06 00:10:31 +00:00
|
|
|
int SetComputer(
|
|
|
|
const wxChar* szComputer, const int iPort, const wxChar* szPassword,
|
|
|
|
const bool bUseDefaultPassword
|
|
|
|
);
|
2005-04-08 04:23:37 +00:00
|
|
|
void SetStateError();
|
2005-04-08 21:18:30 +00:00
|
|
|
void SetStateErrorAuthentication();
|
2005-04-08 04:23:37 +00:00
|
|
|
void SetStateReconnecting();
|
2005-11-27 01:28:56 +00:00
|
|
|
void SetStateSuccess(wxString& strComputer, wxString& strComputerPassword);
|
2005-04-08 19:57:31 +00:00
|
|
|
void SetStateDisconnected();
|
2005-04-08 04:23:37 +00:00
|
|
|
bool IsConnectEventSignaled() { return m_bConnectEvent; };
|
|
|
|
bool IsConnected() { return m_bConnected; };
|
|
|
|
bool IsReconnecting() { return m_bReconnecting; };
|
2005-04-06 20:40:19 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
CMainDocument* m_pDocument;
|
2005-04-08 22:23:53 +00:00
|
|
|
bool m_bFrameShutdownDetected;
|
2005-04-08 04:23:37 +00:00
|
|
|
bool m_bConnectEvent;
|
|
|
|
bool m_bForceReconnect;
|
|
|
|
bool m_bReconnectOnError;
|
|
|
|
bool m_bConnected;
|
|
|
|
bool m_bReconnecting;
|
2005-11-29 00:29:43 +00:00
|
|
|
bool m_bUseDefaultPassword;
|
2007-01-30 15:50:16 +00:00
|
|
|
bool m_bUsedDefaultPassword;
|
2008-01-11 17:56:21 +00:00
|
|
|
int m_iReadGUIRPCAuthFailure;
|
2007-01-23 21:14:08 +00:00
|
|
|
bool m_bNewConnection;
|
2005-04-08 04:23:37 +00:00
|
|
|
wxString m_strNewComputerName;
|
|
|
|
wxString m_strNewComputerPassword;
|
|
|
|
wxString m_strConnectedComputerName;
|
|
|
|
wxString m_strConnectedComputerPassword;
|
2007-05-03 16:17:54 +00:00
|
|
|
wxString m_strConnectedComputerVersion;
|
2008-02-06 00:10:31 +00:00
|
|
|
int m_iPort;
|
2005-04-06 20:40:19 +00:00
|
|
|
};
|
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2005-04-17 02:10:52 +00:00
|
|
|
class CMainDocument : public wxObject {
|
2004-04-10 09:11:03 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(CMainDocument)
|
|
|
|
|
2004-09-25 21:33:24 +00:00
|
|
|
public:
|
|
|
|
CMainDocument();
|
|
|
|
~CMainDocument();
|
|
|
|
|
|
|
|
//
|
2004-09-29 22:21:45 +00:00
|
|
|
// Global
|
2004-09-25 21:33:24 +00:00
|
|
|
//
|
2004-07-12 08:46:26 +00:00
|
|
|
private:
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2006-08-31 19:24:38 +00:00
|
|
|
wxDateTime m_dtCachedCCStatusTimestamp;
|
2008-01-30 06:09:34 +00:00
|
|
|
bool m_bClientStartCheckCompleted;
|
2004-10-24 07:38:38 +00:00
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
|
|
|
|
public:
|
2005-04-24 00:09:40 +00:00
|
|
|
int OnInit();
|
|
|
|
int OnExit();
|
|
|
|
int OnPoll();
|
2005-04-08 04:23:37 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int OnRefreshState();
|
2008-01-30 06:09:34 +00:00
|
|
|
int CachedStateUpdate();
|
2005-04-24 00:09:40 +00:00
|
|
|
int ResetState();
|
2004-10-24 05:40:12 +00:00
|
|
|
|
2005-11-29 00:29:43 +00:00
|
|
|
int Connect(
|
|
|
|
const wxChar* szComputer,
|
2008-02-06 00:10:31 +00:00
|
|
|
const int iPort,
|
2005-11-29 00:29:43 +00:00
|
|
|
const wxChar* szComputerPassword = wxEmptyString,
|
|
|
|
const bool bDisconnect = FALSE,
|
|
|
|
const bool bUseDefaultPassword = FALSE
|
|
|
|
);
|
2005-11-27 01:28:56 +00:00
|
|
|
int Reconnect();
|
2004-10-28 07:03:06 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int CachedStateLock();
|
|
|
|
int CachedStateUnlock();
|
2004-10-09 03:05:01 +00:00
|
|
|
|
2008-02-08 00:17:21 +00:00
|
|
|
void ForceDisconnect();
|
2005-04-24 00:09:40 +00:00
|
|
|
int FrameShutdownDetected();
|
|
|
|
int CoreClientQuit();
|
2005-04-08 04:23:37 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int GetConnectedComputerName(wxString& strMachine);
|
2007-05-03 16:17:54 +00:00
|
|
|
int GetConnectedComputerVersion(wxString& strVersion);
|
2005-04-24 00:09:40 +00:00
|
|
|
int GetConnectingComputerName(wxString& strMachine);
|
2005-12-06 03:18:02 +00:00
|
|
|
bool IsComputerNameLocal(const wxString strMachine);
|
2005-04-08 04:23:37 +00:00
|
|
|
bool IsConnected();
|
|
|
|
bool IsReconnecting();
|
2005-02-22 23:40:38 +00:00
|
|
|
|
2006-12-21 17:05:58 +00:00
|
|
|
int GetCoreClientStatus(CC_STATUS&, bool bForce = false);
|
2006-11-15 12:01:46 +00:00
|
|
|
int SetActivityRunMode(int iMode, int iTimeout);
|
|
|
|
int SetNetworkRunMode(int iMode, int iTimeout);
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
int ForceCacheUpdate();
|
2005-04-24 00:09:40 +00:00
|
|
|
int RunBenchmarks();
|
2004-10-27 23:19:50 +00:00
|
|
|
|
2006-06-22 10:10:51 +00:00
|
|
|
bool IsUserAuthorized();
|
|
|
|
|
2008-01-30 06:09:34 +00:00
|
|
|
CNetworkConnection* m_pNetworkConnection;
|
|
|
|
CBOINCClientManager* m_pClientManager;
|
2005-04-06 20:40:19 +00:00
|
|
|
RPC_CLIENT rpc;
|
|
|
|
CC_STATE state;
|
2006-09-01 04:24:25 +00:00
|
|
|
CC_STATUS status;
|
2005-04-06 20:40:19 +00:00
|
|
|
HOST_INFO host;
|
|
|
|
wxDateTime m_dtCachedStateTimestamp;
|
|
|
|
|
2004-10-27 23:19:50 +00:00
|
|
|
|
2004-09-29 22:21:45 +00:00
|
|
|
//
|
|
|
|
// Project Tab
|
|
|
|
//
|
|
|
|
private:
|
2005-04-24 00:09:40 +00:00
|
|
|
int CachedProjectStatusUpdate();
|
2006-08-31 19:24:38 +00:00
|
|
|
wxDateTime m_dtProjecStatusTimestamp;
|
2004-09-25 21:33:24 +00:00
|
|
|
|
|
|
|
public:
|
2005-06-24 10:49:42 +00:00
|
|
|
PROJECT* project(unsigned int);
|
2007-01-08 17:29:02 +00:00
|
|
|
PROJECT* project(const wxString& projectname);
|
2005-06-13 08:47:51 +00:00
|
|
|
float m_fProjectTotalResourceShare;
|
2005-04-17 02:10:52 +00:00
|
|
|
|
2005-06-13 08:47:51 +00:00
|
|
|
int GetProjectCount();
|
2005-04-17 02:10:52 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int ProjectNoMoreWork(int iIndex);
|
2007-01-08 17:29:02 +00:00
|
|
|
int ProjectNoMoreWork(const wxString& projectname);
|
2005-04-24 00:09:40 +00:00
|
|
|
int ProjectAllowMoreWork(int iIndex);
|
2007-01-08 17:29:02 +00:00
|
|
|
int ProjectAllowMoreWork(const wxString& projectname);
|
2005-04-24 00:09:40 +00:00
|
|
|
int ProjectAttach(const wxString& strURL, const wxString& strAccountKey);
|
|
|
|
int ProjectDetach(int iIndex);
|
2007-01-08 17:29:02 +00:00
|
|
|
int ProjectDetach(const wxString& projectname);
|
2005-04-24 00:09:40 +00:00
|
|
|
int ProjectUpdate(int iIndex);
|
2007-01-08 17:29:02 +00:00
|
|
|
int ProjectUpdate(const wxString& projectname);
|
2005-04-24 00:09:40 +00:00
|
|
|
int ProjectReset(int iIndex);
|
2007-01-08 17:29:02 +00:00
|
|
|
int ProjectReset(const wxString& projectname);
|
2005-04-24 00:09:40 +00:00
|
|
|
int ProjectSuspend(int iIndex);
|
2007-01-08 17:29:02 +00:00
|
|
|
int ProjectSuspend(const wxString& projectname);
|
2005-04-24 00:09:40 +00:00
|
|
|
int ProjectResume(int iIndex);
|
2007-01-08 17:29:02 +00:00
|
|
|
int ProjectResume(const wxString& projectname);
|
2004-09-25 21:33:24 +00:00
|
|
|
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
//
|
|
|
|
// Work Tab
|
|
|
|
//
|
|
|
|
private:
|
2005-04-24 00:09:40 +00:00
|
|
|
int CachedResultsStatusUpdate();
|
2006-08-31 19:24:38 +00:00
|
|
|
wxDateTime m_dtResultsTimestamp;
|
2007-09-21 11:45:57 +00:00
|
|
|
wxDateTime m_dtKillInactiveGfxTimestamp;
|
2007-09-20 11:10:59 +00:00
|
|
|
std::vector<RUNNING_GFX_APP> m_running_gfx_apps;
|
|
|
|
RUNNING_GFX_APP* GetRunningGraphicsApp(RESULT* result, int slot);
|
2007-09-20 12:14:03 +00:00
|
|
|
void KillAllRunningGraphicsApps();
|
|
|
|
void KillInactiveGraphicsApps();
|
2008-02-21 10:50:59 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
void KillGraphicsApp(HANDLE pid);
|
|
|
|
#else
|
|
|
|
void KillGraphicsApp(int tpid);
|
|
|
|
#endif
|
2004-10-11 04:38:00 +00:00
|
|
|
|
|
|
|
public:
|
2005-06-13 08:47:51 +00:00
|
|
|
RESULTS results;
|
2005-06-24 10:49:42 +00:00
|
|
|
RESULT* result(unsigned int);
|
2008-03-05 14:41:24 +00:00
|
|
|
RESULT* result(const wxString& name, const wxString& project_url);
|
2004-10-11 04:38:00 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int GetWorkCount();
|
2005-04-17 02:10:52 +00:00
|
|
|
|
2006-07-21 08:23:26 +00:00
|
|
|
int WorkSuspend(
|
|
|
|
std::string& strProjectURL,
|
|
|
|
std::string& strName
|
|
|
|
);
|
|
|
|
int WorkResume(
|
|
|
|
std::string& strProjectURL,
|
|
|
|
std::string& strName
|
|
|
|
);
|
2007-09-20 00:32:16 +00:00
|
|
|
int WorkShowGraphics(RESULT* result);
|
2006-07-21 08:23:26 +00:00
|
|
|
int WorkAbort(
|
|
|
|
std::string& strProjectURL,
|
|
|
|
std::string& strName
|
2006-03-27 03:44:13 +00:00
|
|
|
);
|
2008-01-30 03:50:32 +00:00
|
|
|
CC_STATE* GetState() { return &state; };
|
2004-10-19 18:14:40 +00:00
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
|
2004-09-29 22:21:45 +00:00
|
|
|
//
|
|
|
|
// Messages Tab
|
|
|
|
//
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
2005-06-13 08:47:51 +00:00
|
|
|
MESSAGES messages;
|
2005-06-24 10:49:42 +00:00
|
|
|
MESSAGE* message(unsigned int);
|
2005-06-11 00:30:11 +00:00
|
|
|
int CachedMessageUpdate();
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int GetMessageCount();
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int ResetMessageState();
|
2004-12-02 21:43:44 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int m_iMessageSequenceNumber;
|
2005-04-06 20:40:19 +00:00
|
|
|
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2004-10-22 00:41:18 +00:00
|
|
|
//
|
|
|
|
// Transfers Tab
|
|
|
|
//
|
2004-09-25 21:33:24 +00:00
|
|
|
private:
|
2005-04-24 00:09:40 +00:00
|
|
|
int CachedFileTransfersUpdate();
|
2006-04-17 02:38:47 +00:00
|
|
|
wxDateTime m_dtFileTransfersTimestamp;
|
2004-10-22 00:41:18 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
public:
|
2005-06-13 08:47:51 +00:00
|
|
|
FILE_TRANSFERS ft;
|
2005-06-24 10:49:42 +00:00
|
|
|
FILE_TRANSFER* file_transfer(unsigned int);
|
2008-03-05 14:41:24 +00:00
|
|
|
FILE_TRANSFER* file_transfer(const wxString& fileName, const wxString& project_url);
|
2004-04-11 04:37:10 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int GetTransferCount();
|
2005-04-17 02:10:52 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int TransferRetryNow(int iIndex);
|
2008-03-05 14:41:24 +00:00
|
|
|
int TransferRetryNow(const wxString& fileName, const wxString& project_url);
|
2005-04-24 00:09:40 +00:00
|
|
|
int TransferAbort(int iIndex);
|
2008-03-05 14:41:24 +00:00
|
|
|
int TransferAbort(const wxString& fileName, const wxString& project_url);
|
2004-10-22 19:23:09 +00:00
|
|
|
|
2004-10-22 22:37:11 +00:00
|
|
|
|
|
|
|
//
|
2006-11-03 17:08:49 +00:00
|
|
|
// Disk Tab
|
2004-10-22 22:37:11 +00:00
|
|
|
//
|
|
|
|
private:
|
2006-11-03 17:08:49 +00:00
|
|
|
wxDateTime m_dtDiskUsageTimestamp;
|
2004-10-22 22:37:11 +00:00
|
|
|
|
|
|
|
public:
|
2006-11-03 17:08:49 +00:00
|
|
|
DISK_USAGE disk_usage;
|
|
|
|
PROJECT* DiskUsageProject(unsigned int);
|
2006-11-03 18:00:15 +00:00
|
|
|
int CachedDiskUsageUpdate();
|
2004-10-25 16:14:51 +00:00
|
|
|
|
2005-04-04 06:02:36 +00:00
|
|
|
//
|
|
|
|
// Statistics Tab
|
|
|
|
//
|
|
|
|
private:
|
2005-04-24 00:09:40 +00:00
|
|
|
int CachedStatisticsStatusUpdate();
|
2006-04-17 02:38:47 +00:00
|
|
|
wxDateTime m_dtStatisticsStatusTimestamp;
|
2005-04-04 06:02:36 +00:00
|
|
|
|
|
|
|
public:
|
2005-06-13 08:47:51 +00:00
|
|
|
PROJECTS statistics_status;
|
2005-06-24 10:49:42 +00:00
|
|
|
PROJECT* statistic(unsigned int);
|
2005-04-04 06:02:36 +00:00
|
|
|
|
2005-04-24 00:09:40 +00:00
|
|
|
int GetStatisticsCount();
|
2005-04-04 06:02:36 +00:00
|
|
|
|
|
|
|
|
2004-10-25 16:14:51 +00:00
|
|
|
//
|
|
|
|
// Proxy Configuration
|
|
|
|
//
|
|
|
|
private:
|
|
|
|
|
|
|
|
public:
|
2005-08-02 01:28:29 +00:00
|
|
|
GR_PROXY_INFO proxy_info;
|
2005-04-24 00:09:40 +00:00
|
|
|
int GetProxyConfiguration();
|
|
|
|
int SetProxyConfiguration();
|
2005-04-06 20:40:19 +00:00
|
|
|
|
2006-06-28 08:53:02 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Simple GUI Updates
|
|
|
|
//
|
|
|
|
private:
|
|
|
|
wxDateTime m_dtCachedSimpleGUITimestamp;
|
2006-08-17 20:10:43 +00:00
|
|
|
int CachedSimpleGUIUpdate();
|
|
|
|
|
|
|
|
public:
|
|
|
|
int GetSimpleGUIWorkCount();
|
2006-06-28 08:53:02 +00:00
|
|
|
|
2004-07-12 08:46:26 +00:00
|
|
|
};
|
2004-04-11 04:37:10 +00:00
|
|
|
|
2004-04-11 05:09:18 +00:00
|
|
|
#endif
|
|
|
|
|
2006-06-22 10:10:51 +00:00
|
|
|
#ifdef SANDBOX
|
|
|
|
#define BOINC_MASTER_GROUP_NAME "boinc_master"
|
|
|
|
#endif
|