-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcmd-pkt.xp
156 lines (133 loc) · 3.51 KB
/
cmd-pkt.xp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
namespace ipc;
const CMD_BASE = 0x100;
const TYPE_BASE = 0x01000100;
const ERR_BASE = 0x02000100;
enum Cmds {
RESPONSE = CMD_BASE + 0,
STATUS = CMD_BASE + 1,
DATA_REQ = CMD_BASE + 2,
WD_REGISTER_STATIC = CMD_BASE + 3,
WD_REG_INFO = CMD_BASE + 4,
};
enum types {
VOID = 0,
OPAQUE_STRUCT= TYPE_BASE + 1,
OPAQUE_STRUCT_ARR = TYPE_BASE + 2,
COMMAND = TYPE_BASE + 3,
RESPONSE = TYPE_BASE + 4,
DATAREQ = TYPE_BASE + 5,
RESPONSE_HDR = TYPE_BASE + 6,
HEARTBEAT = TYPE_BASE + 7,
POPULATOR_ERROR = TYPE_BASE + 8,
WD_PROC_NAME = TYPE_BASE + 9,
WD_REG_INFO = TYPE_BASE + 10,
};
command "proc-status" {
summary "Reports the general health status of the test process";
} = cmds::STATUS;
command "proc-data-req" {
summary "Requests a specific set of telemetry items from the processes";
param types::DATAREQ;
} = cmds::DATA_REQ;
command "proc-heartbeat" {
summary "Returns process aliveness status information";
types = types::HEARTBEAT;
};
struct Void {
void;
} = types::VOID;
union CommandParameters {
};
union Data {
};
struct Command {
Cmds cmd;
unsigned int ipcref;
CommandParameters parameters;
} = types::COMMAND;
struct Heartbeat {
unsigned hyper commands {
name "Commands";
key proc_commands;
description "The number of commands received by the process";
};
unsigned hyper responses {
name "Responses";
key proc_responses;
description "The number of command responses received by the process";
};
unsigned hyper heartbeats {
name "Heartbeats";
key proc_heartbeats;
description "The number of heartbeat commands received by the process";
};
} = types::HEARTBEAT;
struct WDProcName {
string name<128> {
key name;
name "Name";
description "The name of the process to query details about";
};
} = types::WD_PROC_NAME;
struct WDRegInfo {
string name<128> {
key name;
name "Name";
description "The name of the process being watched";
};
unsigned int pid {
key pid;
name "Process ID";
description "The system's process id for the process being watched";
};
bool watched {
key watched;
name "Watched";
description "Flag indicating that the process is being watched or not";
};
} = types::WD_REG_INFO;
enum ResultCode {
SUCCESS = ERR_BASE + 0,
INCORRECT_PARAMETER_TYPE = ERR_BASE + 1,
UNSUPPORTED = ERR_BASE + 2,
ALLOCATION_ERR = ERR_BASE + 3,
NO_SUCH_PROCESS = ERR_BASE + 4,
};
error ResultCode::SUCCESS = "No error - success";
error ResultCode::INCORRECT_PARAMETER_TYPE = "Type of command parameter didn't match the expected type";
error ResultCode::UNSUPPORTED = "The target process does not support the command sent";
error ResultCode::ALLOCATION_ERR = "Failed to allocate heap memory";
error ResultCode::NO_SUCH_PROCESS = "The requested process can not be found";
struct DataReq {
int length;
types reqs<length> {
key types;
};
} = types::DATAREQ;
struct OpaqueStruct {
int length;
opaque data<length>;
} = types::OPAQUE_STRUCT;
struct OpaqueStructArr {
int length;
OpaqueStruct structs<length>;
} = types::OPAQUE_STRUCT_ARR;
struct Response {
Cmds cmd;
unsigned int ipcref;
ResultCode result;
Data data;
} = types::RESPONSE;
struct ResponseHeader {
Cmds cmd;
unsigned int ipcref;
ResultCode result;
} = types::RESPONSE_HDR;
struct PopulatorError {
types type {
key struct_type;
};
ResultCode error {
key error_code;
};
} = types::POPULATOR_ERROR;