diff --git a/server/include/msg.h b/server/include/msg.h index 8fbac2686..73fd3b6bc 100644 --- a/server/include/msg.h +++ b/server/include/msg.h @@ -1,4 +1,4 @@ -/** Message format and message related functions +/** Message related functions * * @author Steffen Vogel * @copyright 2014, Institute for Automation of Complex Power Systems, EONERC @@ -8,41 +8,12 @@ #ifndef _MSG_H_ #define _MSG_H_ -#include #include -#include "config.h" -#include "node.h" - -#define MSG_VERSION 0 - -/** @todo Implement more message types */ -#define MSG_TYPE_DATA 0 -#define MSG_TYPE_START 1 -#define MSG_TYPE_STOP 2 +#include "msg_format.h" struct node; -/** This message format is used by all clients - * - * @diafile msg_format.dia - **/ -struct msg -{ - /** The version specifies the format of the remaining message */ - unsigned version : 4; - /** Data or control message */ - unsigned type : 2; - /** These bits are reserved for future extensions */ - unsigned __padding : 2; - /** Length in dwords of the whole message */ - uint8_t length; - /** The sequence number gets incremented by one for consecutive messages */ - uint16_t sequence; - /** The message payload */ - float data[MAX_VALUES]; -} __attribute__((packed)); - /** Print a raw UDP message in human readable form. * * @param f The file stream diff --git a/server/include/msg_format.h b/server/include/msg_format.h new file mode 100644 index 000000000..f827d297c --- /dev/null +++ b/server/include/msg_format.h @@ -0,0 +1,42 @@ +/** Message format + * + * @author Steffen Vogel + * @copyright 2014, Institute for Automation of Complex Power Systems, EONERC + * @file + */ + +#ifndef _MSG_FORMAT_H_ +#define _MSG_FORMAT_H_ + +#include + +#include "config.h" + +#define MSG_VERSION 0 + +/** @todo Implement more message types */ +#define MSG_TYPE_DATA 0 +#define MSG_TYPE_START 1 +#define MSG_TYPE_STOP 2 + +/** This message format is used by all clients + * + * @diafile msg_format.dia + **/ +struct msg +{ + /** The version specifies the format of the remaining message */ + unsigned version : 4; + /** Data or control message */ + unsigned type : 2; + /** These bits are reserved for future extensions */ + unsigned __padding : 2; + /** Length in dwords of the whole message */ + uint8_t length; + /** The sequence number gets incremented by one for consecutive messages */ + uint16_t sequence; + /** The message payload */ + float data[MAX_VALUES]; +} __attribute__((packed)); + +#endif /* _MSG_FORMAT_H_ */ diff --git a/server/src/msg.c b/server/src/msg.c index 72ba15f03..c1588db27 100644 --- a/server/src/msg.c +++ b/server/src/msg.c @@ -10,6 +10,7 @@ #include #include "msg.h" +#include "node.h" #include "utils.h" int msg_fprint(FILE *f, struct msg *msg) diff --git a/server/src/receive.c b/server/src/receive.c index acf9d79e7..2e0e20ddb 100644 --- a/server/src/receive.c +++ b/server/src/receive.c @@ -18,6 +18,7 @@ #include "config.h" #include "utils.h" +#include "node.h" #include "msg.h" int sd; diff --git a/server/src/send.c b/server/src/send.c index e7adb4408..72918e803 100644 --- a/server/src/send.c +++ b/server/src/send.c @@ -18,6 +18,7 @@ #include "config.h" #include "utils.h" +#include "node.h" #include "msg.h" int sd; diff --git a/server/src/test.c b/server/src/test.c index 0ba5eaee0..ed5a9f520 100644 --- a/server/src/test.c +++ b/server/src/test.c @@ -14,6 +14,7 @@ #include #include "msg.h" +#include "node.h" #include "utils.h" int sd;