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:
parent
e03f5eece0
commit
30fbc53e06
6 changed files with 48 additions and 31 deletions
|
@ -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
|
||||
|
|
42
server/include/msg_format.h
Normal file
42
server/include/msg_format.h
Normal 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_ */
|
|
@ -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)
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include "config.h"
|
||||
#include "utils.h"
|
||||
#include "node.h"
|
||||
#include "msg.h"
|
||||
|
||||
int sd;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include "config.h"
|
||||
#include "utils.h"
|
||||
#include "node.h"
|
||||
#include "msg.h"
|
||||
|
||||
int sd;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <arpa/inet.h>
|
||||
|
||||
#include "msg.h"
|
||||
#include "node.h"
|
||||
#include "utils.h"
|
||||
|
||||
int sd;
|
||||
|
|
Loading…
Add table
Reference in a new issue