1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

opal: fix incompatability of UDP message format

This commit is contained in:
Steffen Vogel 2017-06-29 19:36:06 +02:00
parent 5fdc041ebc
commit ebd289dac8
2 changed files with 14 additions and 2 deletions

View file

@ -62,11 +62,19 @@
**/
struct msg
{
#if BYTE_ORDER == BIG_ENDIAN
unsigned version: 4; /**< Specifies the format of the remaining message (see MGS_VERSION) */
unsigned type : 2; /**< Data or control message (see MSG_TYPE_*) */
unsigned rsvd1 : 2; /**< Reserved bits */
unsigned rsvd2 : 8; /**< Reserved bits */
#elif BYTE_ORDER == LITTLE_ENDIAN
unsigned rsvd1 : 2; /**< Reserved bits */
unsigned type : 2; /**< Data or control message (see MSG_TYPE_*) */
unsigned version: 4; /**< Specifies the format of the remaining message (see MGS_VERSION) */
#else
#error Invalid byte-order
#endif
uint8_t rsvd2; /**< Reserved bits */
uint16_t length; /**< The number of values in msg::data[]. */
uint32_t sequence; /**< The sequence number is incremented by one for consecutive messages. */

View file

@ -116,6 +116,10 @@ static void * SendToIPPort(void *arg)
struct timespec now;
clock_gettime(CLOCK_REALTIME, &now);
msg->version = MSG_VERSION;
msg->type = MSG_TYPE_DATA;
msg->rsvd1 = 0;
msg->rsvd2 = 0;
msg->length = cnt;
msg->sequence = Sequence++;
msg->ts.sec = now.tv_sec;