forked from franciozzy/synexec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
synexec_common.h
70 lines (60 loc) · 2.03 KB
/
synexec_common.h
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
/*
* ------------------------------------
* synexec - Synchronised Executioner
* ------------------------------------
* synexec_common.h
* ------------------
* Copyright 2014 (c) Citrix
*
* 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, version only.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Read the README file for the changelog and information on how to
* compile and use this program.
*/
#ifndef SYNEXEC_COMMON_H
#define SYNEXEC_COMMON_H
// Header files
#include <inttypes.h>
// Global definitions
#define MT_PROGNAME "Synchronised Executioner"
#define MT_PROGNAME_LEN strlen(MT_PROGNAME)
// Program defaults
#define MT_NETPORT 5165 // Default network port (udp/tcp)
#define MT_SYNEXEC_VERSION 1
// Available message commands
#define MT_SYNEXEC_MSG_REPLY 0
#define MT_SYNEXEC_MSG_PROBE 1
#define MT_SYNEXEC_MSG_CONF 2
#define MT_SYNEXEC_MSG_CONF_OK 3
#define MT_SYNEXEC_MSG_CONF_NO 4
#define MT_SYNEXEC_MSG_EXEC 5
#define MT_SYNEXEC_MSG_EXEC_OK 6
#define MT_SYNEXEC_MSG_EXEC_NO 7
#define MT_SYNEXEC_MSG_RUNNING 8
#define MT_SYNEXEC_MSG_STOPPED 9
#define MT_SYNEXEC_MSG_FINISHD 10
// Configuration token
#define MT_SYNEXEC_CONF_TOKEN ":CONF:"
// Network message
typedef struct {
uint32_t version;
uint32_t session;
char command;
uint16_t datalen;
}__attribute__((packed)) synexec_msg_t;
// Byte-ordering conversion routines
inline void
net_msg_hton(synexec_msg_t *net_msg);
inline void
net_msg_ntoh(synexec_msg_t *net_msg);
#endif /* SYNEXEC_COMMON_H */