Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] JSON Output #3847

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
321 changes: 256 additions & 65 deletions client/boinc_cmd.cpp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ generic_sources = \
opencl_boinc.cpp \
parse.cpp \
prefs.cpp \
pretty_printer.cpp \
procinfo.cpp \
proc_control.cpp \
project_init.cpp \
Expand Down
4 changes: 3 additions & 1 deletion lib/common_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "miofile.h"
#include "parse.h"
#include "pretty_printer.h"

// #defines or enums that are shared by more than one BOINC component
// (e.g. client, server, Manager, etc.)
Expand Down Expand Up @@ -285,7 +286,8 @@ struct TIME_STATS {

void write(MIOFILE&);
int parse(XML_PARSER&);
void print();
pretty_printer get();

TIME_STATS() {
now = 0;
on_frac = 1;
Expand Down
69 changes: 38 additions & 31 deletions lib/gui_rpc_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
#include <locale.h>

#include <deque>
#include <string>
#include <map>

#include "cc_config.h"
#include "common_defs.h"
Expand All @@ -50,14 +52,19 @@
#include "network.h"
#include "notice.h"
#include "prefs.h"
#include "pretty_printer.h"

using std::string;
using std::map;
using std::pair;

struct GUI_URL {
std::string name;
std::string description;
std::string url;

int parse(XML_PARSER&);
void print();
pair<string, map<string, string>> get();
};

// statistics at a specific day
Expand Down Expand Up @@ -184,8 +191,8 @@ struct PROJECT {
PROJECT();

int parse(XML_PARSER&);
void print();
void print_disk_usage();
pretty_printer get();
pretty_printer get_disk_usage();
void clear();
void get_name(std::string&);

Expand All @@ -201,7 +208,7 @@ struct APP {
APP();

int parse(XML_PARSER&);
void print();
pretty_printer get() const;
void clear();
};

Expand All @@ -226,7 +233,7 @@ struct APP_VERSION {
int parse(XML_PARSER&);
int parse_coproc(XML_PARSER&);
int parse_file_ref(XML_PARSER&);
void print();
pretty_printer get() const;
void clear();
};

Expand All @@ -245,7 +252,7 @@ struct WORKUNIT {
WORKUNIT();

int parse(XML_PARSER&);
void print();
pretty_printer get();
void clear();
};

Expand Down Expand Up @@ -310,7 +317,7 @@ struct RESULT {
RESULT();

int parse(XML_PARSER&);
void print();
pretty_printer get();
void clear();
};

Expand Down Expand Up @@ -340,7 +347,7 @@ struct FILE_TRANSFER {
FILE_TRANSFER();

int parse(XML_PARSER&);
void print();
pretty_printer get();
void clear();
};

Expand All @@ -354,7 +361,7 @@ struct MESSAGE {
MESSAGE();

int parse(XML_PARSER&);
void print();
pretty_printer get() const;
void clear();
};

Expand All @@ -375,12 +382,12 @@ struct GR_PROXY_INFO {
std::string socks5_user_passwd;
bool socks5_remote_dns;

std::string noproxy_hosts;
std::string noproxy_hosts;

GR_PROXY_INFO();

int parse(XML_PARSER&);
void print();
void print(const bool& console_print);
void clear();
};

Expand Down Expand Up @@ -418,7 +425,7 @@ struct CC_STATE {
RESULT* lookup_result(PROJECT*, const char* name);
RESULT* lookup_result(const char* url, const char* name);

void print();
void print(const bool& console_print);
void clear();
int parse(XML_PARSER&);
inline bool have_gpu() {
Expand All @@ -433,8 +440,8 @@ struct PROJECTS {

PROJECTS(){}

void print();
void print_urls();
void print(const bool& console_print);
void print_urls(const bool& console_print);
void clear();
};

Expand All @@ -447,7 +454,7 @@ struct DISK_USAGE {

DISK_USAGE(){clear();}

void print();
void print(const bool& console_print);
void clear();
};

Expand All @@ -456,7 +463,7 @@ struct RESULTS {

RESULTS(){}

void print();
void print(const bool& console_print);
void clear();
};

Expand All @@ -465,7 +472,7 @@ struct FILE_TRANSFERS {

FILE_TRANSFERS();

void print();
void print(const bool& console_print);
void clear();
};

Expand All @@ -474,7 +481,7 @@ struct MESSAGES {

MESSAGES();

void print();
void print(const bool& console_print) const;
void clear();
};

Expand All @@ -500,7 +507,7 @@ struct ACCT_MGR_INFO {
ACCT_MGR_INFO();

int parse(XML_PARSER&);
void print();
void print(const bool& console_print) const;
void clear();
};

Expand Down Expand Up @@ -554,7 +561,7 @@ struct PROJECT_CONFIG {
bool sched_stopped; // scheduler disabled
bool web_stopped; // DB-driven web functions disabled
int min_client_version;
std::string error_msg;
std::string error_msg;
bool terms_of_use_is_html;
std::string terms_of_use;
// if present, show this text in an "accept terms of use?" dialog
Expand All @@ -568,7 +575,7 @@ struct PROJECT_CONFIG {

int parse(XML_PARSER&);
void clear();
void print();
void print(const bool& console_print) const;
};

struct ACCOUNT_IN {
Expand All @@ -591,14 +598,14 @@ struct ACCOUNT_IN {

struct ACCOUNT_OUT {
int error_num;
std::string error_msg;
std::string error_msg;
std::string authenticator;

ACCOUNT_OUT();

int parse(XML_PARSER&);
void clear();
void print();
void print(const bool& console_print) const;
};

struct CC_STATUS {
Expand All @@ -608,15 +615,15 @@ struct CC_STATUS {
int task_suspend_reason; // bitmap, see common_defs.h
int task_mode; // always/auto/never; see common_defs.h
int task_mode_perm; // same, but permanent version
double task_mode_delay; // time until perm becomes actual
double task_mode_delay; // time until perm becomes actual
int gpu_suspend_reason;
int gpu_mode;
int gpu_mode_perm;
double gpu_mode_delay;
double gpu_mode_delay;
int network_suspend_reason;
int network_mode;
int network_mode_perm;
double network_mode_delay;
double network_mode_delay;
bool disallow_attach;
bool simple_gui_only;
int max_event_log_lines;
Expand All @@ -625,13 +632,13 @@ struct CC_STATUS {

int parse(XML_PARSER&);
void clear();
void print();
void print(const bool& console_print) const;
};

struct SIMPLE_GUI_INFO {
std::vector<PROJECT*> projects;
std::vector<RESULT*> results;
void print();
void print(const bool& console_print);
};

struct DAILY_XFER {
Expand All @@ -645,7 +652,7 @@ struct DAILY_XFER {
struct DAILY_XFER_HISTORY {
std::vector <DAILY_XFER> daily_xfers;
int parse(XML_PARSER&);
void print();
void print(const bool& console_print);
};

// Keep this consistent with client/result.h
Expand All @@ -661,7 +668,7 @@ struct OLD_RESULT {
double create_time;

int parse(XML_PARSER&);
void print();
pair<string, pretty_printer> get();
};

struct RPC_CLIENT {
Expand Down Expand Up @@ -768,7 +775,7 @@ struct RPC_CLIENT {
int get_app_config(const char* url, APP_CONFIGS& conf);
int set_app_config(const char* url, APP_CONFIGS& conf);
int get_daily_xfer_history(DAILY_XFER_HISTORY&);
int set_language(const char*);
int set_language(const char*);
};

struct RPC {
Expand Down
Loading