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

refactor: msg format reserved

This commit is contained in:
Steffen Vogel 2019-09-03 22:06:23 +02:00
parent 9cbcef4fc1
commit fd3c732771
6 changed files with 13 additions and 11 deletions

View file

@ -568,9 +568,9 @@ struct msg
#if BYTE_ORDER == BIG_ENDIAN #if BYTE_ORDER == BIG_ENDIAN
unsigned version: 4; /**< Specifies the format of the remaining message (see MGS_VERSION) */ unsigned version: 4; /**< Specifies the format of the remaining message (see MGS_VERSION) */
unsigned type : 2; /**< Data or control message (see MSG_TYPE_*) */ unsigned type : 2; /**< Data or control message (see MSG_TYPE_*) */
unsigned rsvd1 : 2; /**< Reserved bits */ unsigned reserved1 : 2; /**< Reserved bits */
#elif BYTE_ORDER == LITTLE_ENDIAN #elif BYTE_ORDER == LITTLE_ENDIAN
unsigned rsvd1 : 2; /**< Reserved bits */ unsigned reserved1 : 2; /**< Reserved bits */
unsigned type : 2; /**< Data or control message (see MSG_TYPE_*) */ unsigned type : 2; /**< Data or control message (see MSG_TYPE_*) */
unsigned version: 4; /**< Specifies the format of the remaining message (see MGS_VERSION) */ unsigned version: 4; /**< Specifies the format of the remaining message (see MGS_VERSION) */
#else #else
@ -730,7 +730,8 @@ struct sockaddr_in rec_addr;
msg->version = MSG_VERSION; msg->version = MSG_VERSION;
msg->type = MSG_TYPE_DATA; msg->type = MSG_TYPE_DATA;
msg->rsvd1 = 0; msg->reserved1 = 0;
msg->reserved2 = 0;
msg->id = 0; msg->id = 0;
msg->length = NO_SEND_DATA; msg->length = NO_SEND_DATA;
msg->sequence = sequence++; msg->sequence = sequence++;

View file

@ -66,9 +66,9 @@ struct msg
#if BYTE_ORDER == BIG_ENDIAN #if BYTE_ORDER == BIG_ENDIAN
unsigned version: 4; /**< Specifies the format of the remaining message (see MGS_VERSION) */ unsigned version: 4; /**< Specifies the format of the remaining message (see MGS_VERSION) */
unsigned type : 2; /**< Data or control message (see MSG_TYPE_*) */ unsigned type : 2; /**< Data or control message (see MSG_TYPE_*) */
unsigned rsvd1 : 2; /**< Reserved bits */ unsigned reserved1 : 2; /**< Reserved bits */
#elif BYTE_ORDER == LITTLE_ENDIAN #elif BYTE_ORDER == LITTLE_ENDIAN
unsigned rsvd1 : 2; /**< Reserved bits */ unsigned reserved1 : 2; /**< Reserved bits */
unsigned type : 2; /**< Data or control message (see MSG_TYPE_*) */ unsigned type : 2; /**< Data or control message (see MSG_TYPE_*) */
unsigned version: 4; /**< Specifies the format of the remaining message (see MGS_VERSION) */ unsigned version: 4; /**< Specifies the format of the remaining message (see MGS_VERSION) */
#else #else

View file

@ -118,7 +118,8 @@ static void * SendToIPPort(void *arg)
msg->version = MSG_VERSION; msg->version = MSG_VERSION;
msg->type = MSG_TYPE_DATA; msg->type = MSG_TYPE_DATA;
msg->rsvd1 = 0; msg->reserved1 = 0;
msg->reserved2 = 0;
msg->id = SendID; msg->id = SendID;
msg->length = cnt; msg->length = cnt;
msg->sequence = Sequence++; msg->sequence = Sequence++;

View file

@ -63,7 +63,7 @@ int msg_verify(struct msg *m)
return -1; return -1;
else if (m->type != MSG_TYPE_DATA) else if (m->type != MSG_TYPE_DATA)
return -2; return -2;
else if (m->rsvd1 != 0) else if (m->reserved1 != 0)
return -3; return -3;
else else
return 0; return 0;

View file

@ -56,16 +56,16 @@ struct msg
#if BYTE_ORDER == BIG_ENDIAN #if BYTE_ORDER == BIG_ENDIAN
unsigned version: 4; /**< Specifies the format of the remaining message (see MGS_VERSION) */ unsigned version: 4; /**< Specifies the format of the remaining message (see MGS_VERSION) */
unsigned type : 2; /**< Data or control message (see MSG_TYPE_*) */ unsigned type : 2; /**< Data or control message (see MSG_TYPE_*) */
unsigned rsvd1 : 2; /**< Reserved bits */ unsigned reserved1 : 2; /**< Reserved bits */
#elif BYTE_ORDER == LITTLE_ENDIAN #elif BYTE_ORDER == LITTLE_ENDIAN
unsigned rsvd1 : 2; /**< Reserved bits */ unsigned reserved1 : 2; /**< Reserved bits */
unsigned type : 2; /**< Data or control message (see MSG_TYPE_*) */ unsigned type : 2; /**< Data or control message (see MSG_TYPE_*) */
unsigned version: 4; /**< Specifies the format of the remaining message (see MGS_VERSION) */ unsigned version: 4; /**< Specifies the format of the remaining message (see MGS_VERSION) */
#else #else
#error Invalid byte-order #error Invalid byte-order
#endif #endif
uint8_t resv2; /**< An id which identifies the source of this sample. */ uint8_t reserved2; /**< An id which identifies the source of this sample. */
uint16_t length; /**< The number of values in msg::data[]. */ uint16_t length; /**< The number of values in msg::data[]. */
uint32_t sequence; /**< The sequence number is incremented by one for consecutive messages. */ uint32_t sequence; /**< The sequence number is incremented by one for consecutive messages. */

View file

@ -67,7 +67,7 @@ int msg_verify(struct msg *m)
return -1; return -1;
else if (m->type != MSG_TYPE_DATA) else if (m->type != MSG_TYPE_DATA)
return -2; return -2;
else if (m->rsvd1 != 0) else if (m->reserved1 != 0)
return -3; return -3;
else else
return 0; return 0;