#ifndef _SCN_DEFINE_H_ #define _SCN_DEFINE_H_ #include #ifndef _HPUX #include #endif using namespace std; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "common_types.h" #include "db_api/odb_struct.h" namespace NS_SYSADMIN { //#define hton64(i) (1 == htonl(1)) ? i : (((long)(htonl((i) & 0xffffffff)) << 32) | htonl(((i) >> 32) & 0xffffffff )) #define hton64(i) (1 == htonl(1)) ? i : (((cmnInt64)(htonl((i) & 0xffffffff)) << 32) | htonl(((i) >> 32) & 0xffffffff )) #define ntoh64 hton64 #define RED "\033[1;31m" #define GREEN "\033[1;32m" #define NONE "\033[0m" #define BOLD "\033[1m" //port define. const int c_scn_query_port = 18421; const int c_scn_label_serv_port = 18422; //SCN define const int SCN_MAX_NAME_LEN = 40; const int SCN_MAX_STR_LEN = 256; const int SCN_MAX_SEND_LEN = 40960; const int SCN_MAX_RECV_LEN = 40960; const int MNG_MAX_CMD_STR_LEN = 512; //MNG define const int MNG_MAX_PROCESS_NUM = 600; const int MNG_MAX_STR_LEN = 256; const int MNG_MAX_NET_CARD_NUM = 2; const int MNG_MAX_APP_NUM = 1024; const int MNG_COMMAND_LENGTH = 80; const int PARA_LENGTH = /*32*/128; const int MNG_MAX_PATH_STR_LEN =1024; //app report type const int SAM_APP_START = 1001; const int SAM_APP_STATUS_CHANGE = 1002; const int SAM_APP_STATUS_REPORT = 1003; const int SAM_APP_SWITCH = 1005; const int SAM_APP_SWITCH_RPS = 1006; const int SAM_APP_EXIT = 1007; //cold app report type const int SAM_COLD_STATUS_CHANGE = 1008; const int SAM_COLD_STATUS_REPORT = 1009; const int SAM_CONTAINER_STATUS_REPORT = 1010; const int SAM_CONTAINER_APP_STATUS_REPORT = 1011; //mc reprot type const int SCN_TRANS_INFO_REPORT =2001; //share memory key & sem key const int SAM_SHM_KEY = 0x1060; const int NET_STATUS_SEM_KEY = 0x1011; const int PROC_REPORT_SEM_KEY = 0x1013; const int MC_STAGE_SEM_KEY = 0x1039; const int MC_STAGE_SHM_KEY = 0x1039; const int APP_STATUS_SEM_KEY = 0x1060; //service type const int BASE_SERVICE = 3400000; const int EMS_SERVER = 1; const int EMS_CLIENT = 2; const int EMS_WEBCLIENT = 4; const int WEB_SERVER = 1024; //error definition const int OPEN_PARA_FILE_FAIL = -1001; const int GET_PARA_FAIL = -1002; const int GET_NETMASK_FAIL = -1003; const int INPUT_IP_ADDRESS_ERROR = -1004; const int CONVERT_IP_ERROR = -1005; const int PROC_DO_NOT_EXIST = -1006; const int KILL_PROC_FAIL = -1007; const int CLEAR_PROC_STATUS_FAIL = -1008; const int CLEAR_NET_STATUS_FAIL = -1009; const int CLEAR_APP_STATUS_FAIL = -1010; const int P_SEM_ERROR = -1011; const int V_SEM_ERROR = -1012; const int APP_NUM_ERROR = -1013; const int MNG_TIME_UDP_PORT = 2345; const int MASK_REAL = 1; const int MASK_REAL_WEB = 65536; const short MNG_NET_INFO_NO = 171; //sys_info const int MAX_DISK_NUM = 100; const int MAX_NODE_NUM = 512;//50; const int MNG_MAX_NODE_NUM = 512; const int MAX_DISTANCE_READ_STATIC = 1; const int MAX_DISTANCE_READ_DYNAMIC = 2; //5; modify 20090901 const int MAX_DISTANCE_READ_DISK = 10; //600; modify 20090623 const int REPORT_DISK_USAGES_DISTANCE = 512; const int PARA_NUM = 6; const int PATH_LENGTH = 80; const int APP_DO_NOT_EXIST = -1014; const int PROC_STATUS_INPUT_ERROR = -1015; const int UPDATE_APP_STATUS_FAIL = -1016; const int SWITCH_FLAG_INPUT_ERROR = -1017; const int GET_HOSTNAME_ERROR = -1018; const int GET_BASE_INFO_FAIL = -1019; const int PROCESS_INFO_NOT_SET = -1020; const int GET_PROCESS_INFO_FAIL = -1021; const int RUN_STATUS_INPUT_ERROR = -1022; const int MAP_FILE_FAIL = -1023; const int SHMGET_FAIL = -1024; const int SHMMAT_FAIL = -1025; const int INIT_SEM_FAIL = -1026; const int IS_NOT_SERVER = -1027; const int NAMETOID_FAIL = -1028; const int IDTONAME_FAIL = -1029; const int PARA_INPUT_ERROR = -1030; const int INIT_NETINFO_ERROR = -1031; const int GET_NETINFO_ERROR = -1032; const int SET_PROCOK_FAIL = -1033; const int INIT_NIC_FAIL = -1034; const int GET_NIC_FAIL = -1035; const int APP_DO_NOT_RUN = -1036; ////////////////////////////////////////////////////////// add 20090415 const int APP_DONT_DUTY = -1910; const int APP_DONT_STANDBY = -1911; const int APP_DONT_EXT = -1912; const int ERR_INPUT_PARA = -1913; const int NO_OTHER_APP_STANDBY = -1914; const int NO_OTHER_APP_DUTY = -1915; const int CAN_NOT_SWITCH_TO_STANDBY = -1916; const int CAN_NOT_SWITCH_TO_DUTY = -1917; const int APP_LOCKED = -1918; //add 20090414 //max socket address struct size //const int MAXSOCKADDR = 128; const int MNG_PLOT_SIZE = 101; //proc type const int START_RESPAWN_OPTION = 0; const int START_RESPAWN_KEY = 1; const int START_ONCE = 2; const int START_WAIT = 3; const int STOP_WAIT = 4; //network status const unsigned char OFFLINE = 0; const unsigned char ONLINE = 1; //run status const unsigned char IS_EXIT = 0; const unsigned char IS_RUNNING = 1; const unsigned char IS_START = 2; const unsigned char IS_RECOVER = 3; //app monitor const int DIS_BETWEEN_APP_REPORT = 1; const int DIS_COLD_TIME = 1; const int DIS_COLD_UNIT = 10; //app status const unsigned char APP_START = 1; const unsigned char APP_STANDBY = 2; const unsigned char APP_DUTY = 3; const unsigned char APP_FORCESTANDBY = 4; const unsigned char APP_FORCEDUTY = 5; const unsigned char APP_OFFLINE = 6; const unsigned char APP_BAD = 7; const unsigned char APP_EXIT = 8; const unsigned char APP_NON = 13; const unsigned char APP_INIT = 14; const unsigned char SYSCTL_START = 9; const unsigned char SYSCTL_STOP = 10; const unsigned char NODE_OFFLINE = 11; const unsigned char NODE_ONLINE = 12; const unsigned char TASK_INIT_MENU = 21;//������ const unsigned char TASK_RUN_MENU = 22;//�����л� const unsigned char TASK_OFFLINE_MENU = 23;//������ï¿? const unsigned char TASK_BAD_MENU = 24;//������ï¿? const unsigned char TASK_EXIT_MENU = 25;//�����˳� //other definition const int SCN_YES = 1; const int SCN_NO = 0; // Ó¦ÓÃÓÅÏȼ¶ //¶ÔÓÚPUBLICÓ¦ÓÃδÅäÖõÄÇé¿ö,PUBLICµÄÓÅÏȼ¶´Ó256¿ªÊ¼¡£ const int PRI_BASE_NO_DEFINED = 256; const int PRI_BASE_COLD_NODE = 1024; //¶ÔÓÚÀ䱸½Úµã£¬Ó¦ÓÃÓÅÏȼ¶´Ó65536¿ªÊ¼¡£ const int PRI_BASE_32_PUBLIC = 1; //32̬µÄÓ¦ÓÃÓÅÏȼ¶¡£ //other definition const int SAM_YES = 1; const int SAM_NO = 0; //SAM TRANS ERROR DEFINE const int ECLIENT_CLOSE = -2; const int ESERVER_CLOSE = -3; const int ERECV_ZERO = 0; #ifdef _HPUX const int MAX_START_TIME = 6;//10; modify 20090428 #else const int MAX_START_TIME = 3;//10; modify 20090428 #endif //struct SCN_STATUS_INFO //from APP_STATUS_INFO, 20181106 modify by gaoyuan struct SUBSCN_STATUS_INFO { int scn_id; int scn_inst; //char scn_name[SCN_MAX_NAME_LEN]; char scn_label[SCN_MAX_NAME_LEN]; int subscn_id; int subscn_inst; //char subscn_name[SCN_MAX_NAME_LEN]; char subscn_label[SCN_MAX_NAME_LEN]; int node_id; char node_name[SCN_MAX_NAME_LEN]; short subscn_priority; unsigned char cur_status; unsigned char net_status; unsigned char all_proc_ok; int normal_key_proc_num; int bad_key_proc_num; time_t last_active_time; unsigned char run_status; short switch_flag; //add 20090414 char reserve[20]; //add 20090414 }; struct SCN_STATUS_CHANGE { char project_name[SCN_MAX_NAME_LEN]; int node_id; char node_name[SCN_MAX_NAME_LEN]; time_t report_time; int scn_id; int scn_inst; char scn_label[SCN_MAX_NAME_LEN]; int subscn_id; int subscn_inst; char subscn_label[SCN_MAX_NAME_LEN]; short subscn_priority; unsigned char cur_status; unsigned char all_process_ok; }; struct SCN_STATUS_REPORT_INFO { int scn_id; int scn_inst; char scn_label[SCN_MAX_NAME_LEN]; int subscn_id; int subscn_inst; char subscn_label[SCN_MAX_NAME_LEN]; int node_id; char node_name[SCN_MAX_NAME_LEN]; short subscn_priority; unsigned char net_status; unsigned char cur_status; unsigned char all_process_ok; time_t last_receive_info_time; time_t report_time; int run_status; short switch_flag; }; struct SCN_STATUS_TABLE_INFO { int scn_id; int scn_inst; char scn_label[SCN_MAX_NAME_LEN]; int subscn_id; int subscn_inst; char subscn_label[SCN_MAX_NAME_LEN]; int node_id; char node_name[SCN_MAX_NAME_LEN]; short subscn_priority; unsigned char net_status; unsigned char cur_status; unsigned char all_process_ok; time_t last_receive_info_time; }; //struct SCN_PROC_STATIC_INFO struct SUBSCN_PROC_STATIC_INFO { int scn_id; int scn_inst; int subscn_id; int subscn_inst; int proc_num; std::vectorproc_info_stru; }; struct SUBSCN_PROC_INFO { //int process_id; for d5000 //cmnInt64 process_id; //20180810 boyu /* #ifndef _VERSION_5000_ RTDB_KEY_STRU process_id; #else cmnInt64 process_id; #endif */ cmnInt64 process_id; char proc_name[SCN_MAX_NAME_LEN]; char proc_alias[SCN_MAX_NAME_LEN]; int instance_num; unsigned char is_used; // unsigned char key_proc; unsigned char start_type; unsigned char auto_run; int run_order; unsigned char cycle_start; int cycle_period; unsigned char offline_run; unsigned char duty_run; unsigned char standby_run; int occupy_context; char file_path[MNG_COMMAND_LENGTH]; char proc_para[SCN_MAX_STR_LEN]; unsigned char run_style; //char proc_para[PARA_NUM][PARA_LENGTH]; //int para_num; }; // //struct for process report // struct PROC_REPORT_INFO { int scn_id; int scn_inst; int subscn_id; int subscn_inst; char proc_alias[SCN_MAX_NAME_LEN]; pid_t proc_id; time_t mon_time; time_t start_time; int proc_run_port; int report_moncycle; int msg_level; int status_change; char proc_msg[MNG_MAX_STR_LEN]; int proc_beat; }; // //struct of net card status // struct NET_CARD_STATUS { unsigned char use_flag; char net_card_id[SCN_MAX_NAME_LEN]; unsigned char net_card_ok; }; // //union for scn_common // union SEMUN { int val; struct semid_ds *buf; unsigned short *array; }; struct Length //2.×Ö·û´®³¤¶È { enum { WordLen=32, NameLen=64, StringLen=128, SentenceLen=256, ParagraphLen=512, PageLen=1024 }; }; enum SCN_QUERY_CODE { GetAllScn_CODE, GetSubscnByScn_CODE, GetScnInstByScn_CODE, GetSubscnInst_CODE, RequestSubscn_label_CODE, RequestSubscn_inst_CODE, RequestSubscn_label_CODE2, RequestSubscn_inst_CODE2, Scn_ID_Name_CODE, Subscn_ID_Name_CODE, CreateObj_CODE, GetKey_int_CODE, GetKey_str_CODE, File_Exist_CODE, GetKeys_CODE, }; } #endif