PracticeDev/study_clang/Mimic/test_schedule/include/CSwitchCommon.h

193 lines
6.9 KiB
C
Raw Permalink Normal View History

2022-12-20 17:31:11 +08:00
/*************************************************************************
> File Name : CSwitchCommon.h
> Author : FengChao
> EMail : smile.fengchao@gmail.com
> Created Time : Thu 23 Jul 2020 09:13:37 AM CST
************************************************************************/
#ifndef CSWITCHCOMMON_H
#define CSWITCHCOMMON_H
#define MAX_NOS_NUM 8
typedef enum Judge_Error_Code_E
{
JUDGE_ALL_SUCCESS=0, /*接收到所有执行体消息,全部一致*/
/*
----+----+-----
| A | B | C | 1线A/B/C
----+----+-----
| 1 | 1 | 1 | 2A/B/C全部一致的消息
----+----+-----
uiNosIdx = 0;
*/
JUDGE_SUCC_WITH_TWO_STAGE, /*接收到所有执行体消息,有多数一致,但少数也一致*/
/*
----+----+----
| A | B | C 1线A/B/C
----+----+----
| 1 | 1 | 2 2A/B全部一致
----+----+----
uiNosIdx = C;
*/
JUDGE_SUCC_WITH_MANY_STAGE, /*接收到所有执行体消息,有多数一致,但有多个少数群体*/
/*
----+----+----+----+-----
| A | B | C | D | E 1线A/B/C/D/E
----+----+----+----+-----
| 1 | 1 | 1 | 2 | 3 2A/B/C全部一致D/E不一致
----+----+----+----+-----
uiNosIdx = D | E;
*/
JUDGE_SUCC_WITH_TIMEOUT, /*未收到所有执行体消息,全部一致*/
/*
----+----+-----
| A | B | C | 1线A/B/C
----+----+-----
| 1 | 1 | | 2A/B全部一致的消息C的消息
----+----+-----
uiNosIdx = 1 << C;
*/
JUDGE_SUCC_WITH_TIMEOUT_TWO_STAGE, /*未收到所有执行体消息,有多数一致,但少数也一致*/
/*
----+----+----+----+-----
| A | B | C | D | E 1线A/B/C/D/E
----+----+----+----+-----
| 1 | 1 | 1 | 2 | 2A/B/C全部一致D的消息E超时
----+----+----+----+-----
uiNosIdx = D | E;
*/
JUDGE_SUCC_WITH_TIMEOUT_MANY_STAGE, /*未收到所有执行体消息,有多数一致,但有多个少数群体*/
/*
----+----+----+----+----+----+-----
| A | B | C | D | E | F | G 1线A/B/C/D/E/F/G
----+----+----+----+----+----+-----
| 1 | 1 | 1 | 1 | 2 | 3 | 2A/B/C全部一致D/E不一致G超时
----+----+----+----+----+----+-----
uiNosIdx = E | F | G;
*/
JUDGE_ALL_FAIL_WITH_DIFF, /*收到所有执行体消息,全部不一致*/
/*
----+----+-----
| A | B | C | 1线A/B/C
----+----+-----
| 1 | 2 | 3 | 2A/B/C的消息
----+----+-----
uiNosIdx = A | B | C;
*/
JUDGE_FAIL_WITH_TWO_STAGE, /*收到所有执行体消息,分为数目相同的两个群体*/
/*
----+----+----+----
| A | B | C | D 1线A/B/C/D
----+----+----+----
| 1 | 1 | 2 | 2 2A/B/C/D的消息A/B一致C/D一致
----+----+----+----
uiNosIdx = A | B | C | D;
*/
JUDGE_FAIL_WITH_MANY_STAGE, /*收到所有执行体信息,分为多个少数群体*/
/*
----+----+----+----+-----
| A | B | C | D | E 1线A/B/C/D/E
----+----+----+----+-----
| 1 | 1 | 2 | 2 | 3 2A/B全部一致C/D全部一致
----+----+----+----+-----
uiNosIdx = A | B | C | D | E;
*/
JUDGE_FAIL_WITH_TIMEOUT, /*未收到所有执行体消息,达不到裁决条件*/
/*
----+----+-----
| A | B | C | 1线A/B/C
----+----+-----
| 1 | | | 2A/B/C的消息
----+----+-----
uiNosIdx = A;
*/
JUDGE_FAIL_WITH_TIMEOUT_TWO_STAGE, /*未收到所有执行体消息,分为两个少数群体*/
/*
----+----+-----
| A | B | C | 1线A/B/C
----+----+-----
| 1 | 2 | | 2A/B的消息A/B不同, C超时
----+----+-----
uiNosIdx = A | B | C;
*/
JUDGE_FAIL_WITH_TIMEOUT_MANY_STAGE, /*未收到所有执行体消息,分为多个少数群体*/
/*
----+----+----+----+-----
| A | B | C | D | E 1线A/B/C/D/E
----+----+----+----+-----
| 1 | 1 | 2 | 2 | 2A/B全部一致C/D全部一致,E超时
----+----+----+----+-----
uiNosIdx = A | B | C | D | E;
*/
JUDGE_RET_MAX,
JUDGE_SYS_RUNNING, /* Nos正常运行 */
JUDGE_EXCESSIVE_CPU_OCCUPY, /*CPU占用率偏高*/
JUDGE_EXCESSIVE_MEM_OCCUPY, /*内存占用率偏高*/
JUDGE_EXCESSIVE_TCP_SOCKET, /*TCP SOCKET连接数过多*/
JUDGE_EXCESSIVE_PROGRESS, /*进程总数过多*/
JUDGE_SOMEONE_BROKEN_INTO, /*执行体被登入*/
JUDGE_EXCEPTION_SHELL, /*执行体运行了异常的shell命令*/
JUDGE_EXCEPTION_USER, /*执行体系统用户账户信息发生变化*/
JUDGE_EXCEPTION_GROUP, /*执行体系统用户组信息发生变化*/
JUDGE_CHANGE_CRON, /*计划任务个数产生变动*/
JUDGE_CHANGE_FILE_IN_PATH, /*PATH目录下文件个数产生变动*/
JUDGE_CHANGE_FILE_IN_HOME, /*用户目录下文件个数产生变动*/
JUDGE_EXCEPTION_APP, /*关键可执行文件被篡改*/
JUDGE_EXCEPTION_AUTOSTART, /*开机自启文件被篡改*/
JUDGE_EXCEPTION_MANAGER, /*管理进程被异常停止*/
JUDGE_EXCEPTION_PROTOCOL, /*协议进程被异常停止*/
JUDGE_EXCEPTION_LOCAL_CONFIG_MANAGER, /*本地配置管理器被异常停止*/
JUDGE_EXCEPTION_FIREWALL, /*防火墙被异常关闭*/
JUDGE_TIME_OUT, /*某执行体状态信息上报超时*/
ERROR_CODE_MAX
}Judge_Error_Code_T;
typedef struct Judge_Error_Msg_S
{
Judge_Error_Code_T uiErrorCode; //错误代码
#define NOS1_FLAG 1<<0
#define NOS2_FLAG 1<<1
#define NOS3_FLAG 1<<2
#define NOS4_FLAG 1<<3
#define NOS5_FLAG 1<<4
#define NOS6_FLAG 1<<5
#define NOS7_FLAG 1<<6
#define NOS8_FLAG 1<<7
#define NOS9_FLAG 1<<8
#define NOS10_FLAG 1<<9
uint uiNosIdx;
char szReserve[32];
}Judge_Error_Msg_T;
typedef enum {
HB_JUDGE_E = 1,
HB_SHD_E,
HB_MYSQL_E,
HB_WEB_E,
HB_CFG_MANAGER_E,
HB_MAX_E
}HEARBEAT_E;
typedef enum {
NOS_STATE_INVALID_E,
NOS_STATE_STOP_E,
NOS_STATE_START_E
}NOS_STATE_E;
#endif /*CSWITCHCOMMON_H*/