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

seperated msg_* prototypes and msg type declaration

git-svn-id: https://zerberus.eonerc.rwth-aachen.de:8443/svn/s2ss/trunk@136 8ec27952-4edc-4aab-86aa-e87bb2611832
This commit is contained in:
Steffen Vogel 2014-07-07 07:53:42 +00:00
parent e03f5eece0
commit 30fbc53e06
6 changed files with 48 additions and 31 deletions

View file

@ -1,4 +1,4 @@
/** Message format and message related functions
/** Message related functions
*
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
* @copyright 2014, Institute for Automation of Complex Power Systems, EONERC
@ -8,41 +8,12 @@
#ifndef _MSG_H_
#define _MSG_H_
#include <stdint.h>
#include <stdio.h>
#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

View file

@ -0,0 +1,42 @@
/** Message format
*
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
* @copyright 2014, Institute for Automation of Complex Power Systems, EONERC
* @file
*/
#ifndef _MSG_FORMAT_H_
#define _MSG_FORMAT_H_
#include <stdint.h>
#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_ */

View file

@ -10,6 +10,7 @@
#include <arpa/inet.h>
#include "msg.h"
#include "node.h"
#include "utils.h"
int msg_fprint(FILE *f, struct msg *msg)

View file

@ -18,6 +18,7 @@
#include "config.h"
#include "utils.h"
#include "node.h"
#include "msg.h"
int sd;

View file

@ -18,6 +18,7 @@
#include "config.h"
#include "utils.h"
#include "node.h"
#include "msg.h"
int sd;

View file

@ -14,6 +14,7 @@
#include <arpa/inet.h>
#include "msg.h"
#include "node.h"
#include "utils.h"
int sd;