forked from marco-pag/fred-linux-test-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfred_msg.h
More file actions
66 lines (54 loc) · 1.38 KB
/
fred_msg.h
File metadata and controls
66 lines (54 loc) · 1.38 KB
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
/*
* Fred for Linux. Experimental support.
*
* Copyright (C) 2018-2021, Marco Pagani, ReTiS Lab.
* <marco.pag(at)outlook.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.
*/
#ifndef FRED_MSG_H_
#define FRED_MSG_H_
#include <stdint.h>
//-------------------------------------------------------------------------------
enum msg_head_ {
// Client requests
FRED_MSG_INIT = 101,
FRED_MSG_BIND = 201,
FRED_MSG_RUN = 301,
FRED_MSG_DONE = 401,
// Server Replies
FRED_MSG_ACK = 501,
FRED_MSG_BUFFS = 601,
FRED_MSG_ERROR = 701, // Client request error
// Server notices
FRED_MSG_CRIT = 801, // Server internal error
};
struct fred_msg {
enum msg_head_ head;
uint32_t arg;
};
//-------------------------------------------------------------------------------
static inline
int fred_msg_get_head(const struct fred_msg *msg)
{
return msg->head;
}
static inline
void fred_msg_set_head(struct fred_msg *msg, int head)
{
msg->head = head;
}
static inline
uint32_t fred_msg_get_arg(const struct fred_msg *msg)
{
return msg->arg;
}
static inline
void fred_msg_set_arg(struct fred_msg *msg, uint32_t arg)
{
msg->arg = arg;
}
//-------------------------------------------------------------------------------
#endif /* FRED_MSG_H_ */