123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267 |
- #ifndef BOINC_APP_IPC_H
- #define BOINC_APP_IPC_H
- #ifdef __cplusplus
- #include <vector>
- #include <string>
- #include <cstdio>
- #include "filesys.h"
- #include "hostinfo.h"
- #include "proxy_info.h"
- #include "prefs.h"
- #include "common_defs.h"
- #define MSG_CHANNEL_SIZE 1024
- struct MSG_CHANNEL {
- char buf[MSG_CHANNEL_SIZE];
- bool get_msg(char*);
- inline bool has_msg() {
- return buf[0]?true:false;
- }
- bool send_msg(const char*);
-
- void send_msg_overwrite(const char*);
-
- };
- struct SHARED_MEM {
- MSG_CHANNEL process_control_request;
-
-
-
-
- MSG_CHANNEL process_control_reply;
-
- MSG_CHANNEL graphics_request;
-
-
- MSG_CHANNEL graphics_reply;
-
-
-
- MSG_CHANNEL heartbeat;
-
-
-
-
- MSG_CHANNEL app_status;
-
-
-
-
-
-
- MSG_CHANNEL trickle_up;
-
-
- MSG_CHANNEL trickle_down;
-
-
- };
- struct MSG_QUEUE {
- std::vector<std::string> msgs;
- char name[256];
- double last_block;
- void init(char*);
- void msg_queue_send(const char*, MSG_CHANNEL& channel);
- void msg_queue_poll(MSG_CHANNEL& channel);
- int msg_queue_purge(const char*);
- bool timeout(double);
- };
- #define DEFAULT_CHECKPOINT_PERIOD 300
- #define SHM_PREFIX "shm_"
- #define QUIT_PREFIX "quit_"
- class APP_CLIENT_SHM {
- public:
- SHARED_MEM *shm;
- void reset_msgs();
- APP_CLIENT_SHM();
- };
- #ifdef _WIN32
- typedef char SHMEM_SEG_NAME[256];
- #else
- typedef int SHMEM_SEG_NAME;
- #endif
- struct APP_INIT_DATA {
- int major_version;
- int minor_version;
- int release;
- int app_version;
- char app_name[256];
- char symstore[256];
- char acct_mgr_url[256];
-
- char* project_preferences;
-
- int userid;
-
- int teamid;
- int hostid;
- char user_name[256];
- char team_name[256];
- char project_dir[256];
- char boinc_dir[MAXPATHLEN];
- char wu_name[256];
- char result_name[256];
- char authenticator[256];
- int slot;
- int client_pid;
- double user_total_credit;
- double user_expavg_credit;
- double host_total_credit;
- double host_expavg_credit;
- double resource_share_fraction;
- HOST_INFO host_info;
- PROXY_INFO proxy_info;
- GLOBAL_PREFS global_prefs;
- double starting_elapsed_time;
- bool using_sandbox;
- bool vm_extensions_disabled;
-
-
-
- double rsc_fpops_est;
- double rsc_fpops_bound;
- double rsc_memory_bound;
- double rsc_disk_bound;
- double computation_deadline;
-
-
-
- double fraction_done_start;
- double fraction_done_end;
-
-
- char gpu_type[64];
- int gpu_device_num;
- int gpu_opencl_dev_index;
- double gpu_usage;
-
-
- double ncpus;
-
-
- bool vbox_window;
-
-
- std::vector<std::string> app_files;
-
-
- double checkpoint_period;
- SHMEM_SEG_NAME shmem_seg_name;
- double wu_cpu_time;
- APP_INIT_DATA();
- APP_INIT_DATA(const APP_INIT_DATA&);
- APP_INIT_DATA &operator=(const APP_INIT_DATA&);
- void copy(const APP_INIT_DATA&);
- void clear();
- ~APP_INIT_DATA();
- };
- struct GRAPHICS_INFO {
- int xsize;
- int ysize;
- double refresh_period;
- };
- typedef struct GRAPHICS_INFO GRAPHICS_INFO;
- int write_init_data_file(FILE* f, APP_INIT_DATA&);
- int parse_init_data_file(FILE* f, APP_INIT_DATA&);
- int write_graphics_file(FILE* f, GRAPHICS_INFO* gi);
- int parse_graphics_file(FILE* f, GRAPHICS_INFO* gi);
- #define INIT_DATA_FILE "init_data.xml"
- #define BOINC_FINISH_CALLED_FILE "boinc_finish_called"
- #define TEMPORARY_EXIT_FILE "boinc_temporary_exit"
- #define TRICKLE_UP_FILENAME "trickle_up.xml"
- #define STDERR_FILE "stderr.txt"
- #define STDOUT_FILE "stdout.txt"
- #define LOCKFILE "boinc_lockfile"
- #define UPLOAD_FILE_REQ_PREFIX "boinc_ufr_"
- #define UPLOAD_FILE_STATUS_PREFIX "boinc_ufs_"
- #define PROJECT_DIR "projects"
- extern int boinc_link(const char* phys_name, const char* logical_name);
- extern int boinc_resolve_filename_s(const char*, std::string&);
- extern std::string resolve_soft_link(const char* project_dir, const char* file);
- extern void url_to_project_dir(char* url, char* dir, int dirsize);
- extern "C" {
- #endif
- extern int boinc_resolve_filename(const char*, char*, int len);
- #ifdef __cplusplus
- }
- #endif
- #endif
|