forked from Alkass/cRPC
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinc.h
More file actions
48 lines (40 loc) · 633 Bytes
/
Copy pathinc.h
File metadata and controls
48 lines (40 loc) · 633 Bytes
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
#ifndef INC_H
#define INC_H
#define ACK 0xA
typedef char byte;
typedef enum {
ADD = 0,
SUB,
MUL,
DIV
} OpType;
typedef struct {
byte ack;
byte id;
OpType op;
byte params[2];
} Request;
typedef struct {
byte ack;
byte id;
byte status;
byte data;
} Response;
void printRequest(Request req) {
printf("Request: ACK: %d, ID: %d, OP: %d, PARAMS: [%d, %d]\n",
req.ack,
req.id,
req.op,
req.params[0],
req.params[1]
);
}
void printResponse(Response res) {
printf("Response: ACK: %d, ID: %d, STATUS: %d, DATA: %d\n",
res.ack,
res.id,
res.status,
res.data
);
}
#endif