diff --git a/include/villas/config.h.in b/include/villas/config.h.in
index 082579cd8..419f0fa61 100644
--- a/include/villas/config.h.in
+++ b/include/villas/config.h.in
@@ -24,8 +24,6 @@
* along with this program. If not, see .
*********************************************************************************/
-
-
#pragma once
#ifdef __cplusplus
@@ -63,7 +61,6 @@ extern "C"{
#define KERNEL_VERSION_MAJ 3
#define KERNEL_VERSION_MIN 6
-
#ifdef __cplusplus
}
-#endif
\ No newline at end of file
+#endif
diff --git a/include/villas/formats/json-reserve.h b/include/villas/formats/json-reserve.h
index c715bc659..f6e6c227b 100644
--- a/include/villas/formats/json-reserve.h
+++ b/include/villas/formats/json-reserve.h
@@ -40,4 +40,4 @@ int json_reserve_scan(struct io *io, struct sample *smps[], unsigned cnt);
#ifdef __cplusplus
}
-#endif
\ No newline at end of file
+#endif
diff --git a/include/villas/formats/msg.h b/include/villas/formats/msg.h
index 2d88ec92a..c69e21bbc 100644
--- a/include/villas/formats/msg.h
+++ b/include/villas/formats/msg.h
@@ -60,4 +60,4 @@ int msg_from_sample(struct msg *msg, struct sample *smp);
#ifdef __cplusplus
}
-#endif
\ No newline at end of file
+#endif
diff --git a/include/villas/formats/msg_format.h b/include/villas/formats/msg_format.h
index 99069089a..1dc4f87b5 100644
--- a/include/villas/formats/msg_format.h
+++ b/include/villas/formats/msg_format.h
@@ -30,68 +30,71 @@ extern "C" {
#endif
/** The current version number for the message format */
-#define MSG_VERSION 2
+#define MSG_VERSION 2
/** @todo Implement more message types */
-#define MSG_TYPE_DATA 0 /**< Message contains float / integer values */
-#define MSG_TYPE_START 1 /**< Message marks the beginning of a new simulation case */
-#define MSG_TYPE_STOP 2 /**< Message marks the end of a simulation case */
+#define MSG_TYPE_DATA 0 /**< Message contains float / integer values */
+#define MSG_TYPE_START 1 /**< Message marks the beginning of a new simulation case */
+#define MSG_TYPE_STOP 2 /**< Message marks the end of a simulation case */
/** The total size in bytes of a message */
-#define MSG_LEN(values) (sizeof(struct msg) + MSG_DATA_LEN(values))
+#define MSG_LEN(values) (sizeof(struct msg) + MSG_DATA_LEN(values))
/** The length of \p values values in bytes. */
-#define MSG_DATA_LEN(values) (sizeof(float) * (values))
+#define MSG_DATA_LEN(values) (sizeof(float) * (values))
/** The offset to the first data value in a message. */
-#define MSG_DATA_OFFSET(msg) ((char *) (msg) + offsetof(struct msg, data))
+#define MSG_DATA_OFFSET(msg) ((char *) (msg) + offsetof(struct msg, data))
/** Initialize a message with default values */
#define MSG_INIT(len, seq) (struct msg) {\
- .version = MSG_VERSION, \
- .type = MSG_TYPE_DATA, \
- .length = len, \
- .sequence = seq, \
+ .version = MSG_VERSION, \
+ .type = MSG_TYPE_DATA, \
+ .length = len, \
+ .sequence = seq, \
}
/** The timestamp of a message in struct timespec format */
-#define MSG_TS(msg) (struct timespec) { \
- .tv_sec = (msg)->ts.sec, \
- .tv_nsec = (msg)->ts.nsec \
+#define MSG_TS(msg) (struct timespec) { \
+ .tv_sec = (msg)->ts.sec, \
+ .tv_nsec = (msg)->ts.nsec \
}
/** This message format is used by all clients
*
* @diafile msg_format.dia
**/
-struct msg {
+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 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 */
#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) */
+ 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 resv2; /**< An id which identifies the source of this sample. */
- uint16_t length; /**< The number of values in msg::data[]. */
- uint32_t sequence; /**< The sequence number is incremented by one for consecutive messages. */
+ uint8_t resv2; /**< An id which identifies the source of this sample. */
+ uint16_t length; /**< The number of values in msg::data[]. */
+ uint32_t sequence; /**< The sequence number is incremented by one for consecutive messages. */
/** A timestamp per message. */
struct {
- uint32_t sec; /**< Seconds since 1970-01-01 00:00:00 */
- uint32_t nsec; /**< Nanoseconds of the current second. */
+ uint32_t sec; /**< Seconds since 1970-01-01 00:00:00 */
+ uint32_t nsec; /**< Nanoseconds of the current second. */
} ts;
/** The message payload. */
union {
- float f; /**< Floating point values. */
- uint32_t i; /**< Integer values. */
+ float f; /**< Floating point values. */
+ uint32_t i; /**< Integer values. */
} data[];
} __attribute__((packed));
#ifdef __cplusplus
}
-#endif
\ No newline at end of file
+#endif
diff --git a/include/villas/formats/protobuf.h b/include/villas/formats/protobuf.h
index 343920189..d6dda00dc 100644
--- a/include/villas/formats/protobuf.h
+++ b/include/villas/formats/protobuf.h
@@ -40,4 +40,4 @@ int protobuf_sscan(struct io *io, char *buf, size_t len, size_t *rbytes, struct
#ifdef __cplusplus
}
-#endif
\ No newline at end of file
+#endif
diff --git a/include/villas/formats/raw.h b/include/villas/formats/raw.h
index d10eea879..3ee518b2f 100644
--- a/include/villas/formats/raw.h
+++ b/include/villas/formats/raw.h
@@ -33,28 +33,28 @@ extern "C" {
struct sample;
enum raw_flags {
- RAW_FAKE = (1 << 16), /**< Treat the first three values as: sequenceno, seconds, nanoseconds */
+ RAW_FAKE = (1 << 16), /**< Treat the first three values as: sequenceno, seconds, nanoseconds */
- RAW_BE_INT = (1 << 17), /**< Byte-order for integer data: big-endian if set. */
- RAW_BE_FLT = (1 << 18), /**< Byte-order for floating point data: big-endian if set. */
- RAW_BE_HDR = (1 << 19), /**< Byte-order for fake header fields: big-endian if set. */
+ RAW_BE_INT = (1 << 17), /**< Byte-order for integer data: big-endian if set. */
+ RAW_BE_FLT = (1 << 18), /**< Byte-order for floating point data: big-endian if set. */
+ RAW_BE_HDR = (1 << 19), /**< Byte-order for fake header fields: big-endian if set. */
/** Byte-order for all fields: big-endian if set. */
- RAW_BE = RAW_BE_INT | RAW_BE_FLT | RAW_BE_HDR,
+ RAW_BE = RAW_BE_INT | RAW_BE_FLT | RAW_BE_HDR,
/** Mix floating and integer types.
*
* io_raw_sscan() parses all values as single / double precission fp.
* io_raw_sprint() uses sample::format to determine the type.
*/
- RAW_AUTO = (1 << 22),
- RAW_FLT = (1 << 23), /**< Data-type: floating point otherwise integer. */
+ RAW_AUTO = (1 << 22),
+ RAW_FLT = (1 << 23), /**< Data-type: floating point otherwise integer. */
//RAW_1 = (0 << 24), /**< Pack each value as a single bit. */
- RAW_8 = (3 << 24), /**< Pack each value as a byte. */
- RAW_16 = (4 << 24), /**< Pack each value as a word. */
- RAW_32 = (5 << 24), /**< Pack each value as a double word. */
- RAW_64 = (6 << 24) /**< Pack each value as a quad word. */
+ RAW_8 = (3 << 24), /**< Pack each value as a byte. */
+ RAW_16 = (4 << 24), /**< Pack each value as a word. */
+ RAW_32 = (5 << 24), /**< Pack each value as a double word. */
+ RAW_64 = (6 << 24) /**< Pack each value as a quad word. */
};
/** Copy / read struct msg's from buffer \p buf to / fram samples \p smps. */
@@ -62,6 +62,7 @@ int raw_sprint(struct io *io, char *buf, size_t len, size_t *wbytes, struct samp
/** Read struct sample's from buffer \p buf into samples \p smps. */
int raw_sscan(struct io *io, char *buf, size_t len, size_t *rbytes, struct sample *smps[], unsigned cnt);
+
#ifdef __cplusplus
}
-#endif
\ No newline at end of file
+#endif
diff --git a/include/villas/formats/villas_binary.h b/include/villas/formats/villas_binary.h
index ff520919f..8fd4428c3 100644
--- a/include/villas/formats/villas_binary.h
+++ b/include/villas/formats/villas_binary.h
@@ -35,12 +35,11 @@ struct msg;
struct io;
enum villas_binary_flags {
- VILLAS_BINARY_WEB = (1 << 16) /**< Use webmsg format (everying little endian) */
+ VILLAS_BINARY_WEB = (1 << 16) /**< Use webmsg format (everying little endian) */
};
/** Copy / read struct msg's from buffer \p buf to / fram samples \p smps. */
-int
-villas_binary_sprint(struct io *io, char *buf, size_t len, size_t *wbytes, struct sample *smps[], unsigned cnt);
+int villas_binary_sprint(struct io *io, char *buf, size_t len, size_t *wbytes, struct sample *smps[], unsigned cnt);
/** Read struct sample's from buffer \p buf into samples \p smps. */
int villas_binary_sscan(struct io *io, char *buf, size_t len, size_t *rbytes, struct sample *smps[], unsigned cnt);
diff --git a/include/villas/hist.h b/include/villas/hist.h
index ca8a4d10a..477470956 100644
--- a/include/villas/hist.h
+++ b/include/villas/hist.h
@@ -32,39 +32,39 @@
extern "C" {
#endif
-#define HIST_HEIGHT (LOG_WIDTH - 55)
-#define HIST_SEQ 17
+#define HIST_HEIGHT (LOG_WIDTH - 55)
+#define HIST_SEQ 17
typedef uintmax_t hist_cnt_t;
/** Histogram structure used to collect statistics. */
struct hist {
- double resolution; /**< The distance between two adjacent buckets. */
+ double resolution; /**< The distance between two adjacent buckets. */
- double high; /**< The value of the highest bucket. */
- double low; /**< The value of the lowest bucket. */
+ double high; /**< The value of the highest bucket. */
+ double low; /**< The value of the lowest bucket. */
- double highest; /**< The highest value observed (may be higher than #high). */
- double lowest; /**< The lowest value observed (may be lower than #low). */
- double last; /**< The last value which has been put into the buckets */
+ double highest; /**< The highest value observed (may be higher than #high). */
+ double lowest; /**< The lowest value observed (may be lower than #low). */
+ double last; /**< The last value which has been put into the buckets */
- int length; /**< The number of buckets in #data. */
+ int length; /**< The number of buckets in #data. */
- hist_cnt_t total; /**< Total number of counted values. */
- hist_cnt_t warmup; /**< Number of values which are used during warmup phase. */
+ hist_cnt_t total; /**< Total number of counted values. */
+ hist_cnt_t warmup; /**< Number of values which are used during warmup phase. */
- hist_cnt_t higher; /**< The number of values which are higher than #high. */
- hist_cnt_t lower; /**< The number of values which are lower than #low. */
+ hist_cnt_t higher; /**< The number of values which are higher than #high. */
+ hist_cnt_t lower; /**< The number of values which are lower than #low. */
- hist_cnt_t *data; /**< Pointer to dynamically allocated array of size length. */
+ hist_cnt_t *data; /**< Pointer to dynamically allocated array of size length. */
- double _m[2], _s[2]; /**< Private variables for online variance calculation */
+ double _m[2], _s[2]; /**< Private variables for online variance calculation */
};
-#define hist_last(h) ((h)->last)
-#define hist_highest(h) ((h)->highest)
-#define hist_lowest(h) ((h)->lowest)
-#define hist_total(h) ((h)->total)
+#define hist_last(h) ((h)->last)
+#define hist_highest(h) ((h)->highest)
+#define hist_lowest(h) ((h)->lowest)
+#define hist_total(h) ((h)->total)
/** Initialize struct hist with supplied values and allocate memory for buckets. */
int hist_init(struct hist *h, int buckets, hist_cnt_t warmup);
@@ -97,7 +97,7 @@ void hist_plot(struct hist *h);
*
* @return The string containing the dump. The caller is responsible to free() the buffer.
*/
-char *hist_dump(struct hist *h);
+char * hist_dump(struct hist *h);
/** Prints Matlab struct containing all infos to file. */
int hist_dump_matlab(struct hist *h, FILE *f);
@@ -106,8 +106,8 @@ int hist_dump_matlab(struct hist *h, FILE *f);
int hist_dump_json(struct hist *h, FILE *f);
/** Build a libjansson / JSON object of the histogram. */
-json_t *hist_json(struct hist *h);
+json_t * hist_json(struct hist *h);
#ifdef __cplusplus
}
-#endif
\ No newline at end of file
+#endif
diff --git a/include/villas/hook.h b/include/villas/hook.h
index 66ec85e8d..9af46b333 100644
--- a/include/villas/hook.h
+++ b/include/villas/hook.h
@@ -48,17 +48,17 @@ struct list;
/** Descriptor for user defined hooks. See hooks[]. */
struct hook {
- enum state state;
+ enum state state;
- struct path *path;
- struct node *node;
+ struct path *path;
+ struct node *node;
- struct hook_type *_vt; /**< C++ like Vtable pointer. */
- void *_vd; /**< Private data for this hook. This pointer can be used to pass data between consecutive calls of the callback. */
+ struct hook_type *_vt; /**< C++ like Vtable pointer. */
+ void *_vd; /**< Private data for this hook. This pointer can be used to pass data between consecutive calls of the callback. */
- int priority; /**< A priority to change the order of execution within one type of hook. */
+ int priority; /**< A priority to change the order of execution within one type of hook. */
- json_t *cfg; /**< A JSON object containing the configuration of the hook. */
+ json_t *cfg; /**< A JSON object containing the configuration of the hook. */
};
int hook_init(struct hook *h, struct hook_type *vt, struct path *p, struct node *n);
@@ -103,4 +103,4 @@ int hook_parse_list(struct list *list, json_t *cfg, struct path *p, struct node
#ifdef __cplusplus
}
-#endif
\ No newline at end of file
+#endif
diff --git a/include/villas/io.h b/include/villas/io.h
index b471a0764..3370b26de 100644
--- a/include/villas/io.h
+++ b/include/villas/io.h
@@ -36,16 +36,16 @@ struct sample;
struct format_type;
enum io_flags {
- IO_FLUSH = (1 << 8), /**< Flush the output stream after each chunk of samples. */
- IO_NONBLOCK = (1 << 9), /**< Dont block io_read() while waiting for new samples. */
- IO_NEWLINES = (1 << 10) /**< The samples of this format are newline delimited. */
+ IO_FLUSH = (1 << 8), /**< Flush the output stream after each chunk of samples. */
+ IO_NONBLOCK = (1 << 9), /**< Dont block io_read() while waiting for new samples. */
+ IO_NEWLINES = (1 << 10) /**< The samples of this format are newline delimited. */
};
struct io {
enum state state;
int flags;
- char delimiter; /**< Newline delimiter. */
- char separator; /**< Column separator (used by csv and villas.human formats only) */
+ char delimiter; /**< Newline delimiter. */
+ char separator; /**< Column separator (used by csv and villas.human formats only) */
struct {
/** A format type can use this file handle or overwrite the
@@ -110,8 +110,8 @@ int io_stream_fd(struct io *io);
int io_stream_flush(struct io *io);
-FILE *io_stream_input(struct io *io);
-FILE *io_stream_output(struct io *io);
+FILE * io_stream_input(struct io *io);
+FILE * io_stream_output(struct io *io);
/** Parse samples from the buffer \p buf with a length of \p len bytes.
*
diff --git a/include/villas/kernel/kernel.h b/include/villas/kernel/kernel.h
index 60ceb4312..265e125f4 100644
--- a/include/villas/kernel/kernel.h
+++ b/include/villas/kernel/kernel.h
@@ -89,7 +89,7 @@ int kernel_get_page_size();
int kernel_get_hugepage_size();
/** Set SMP affinity of IRQ */
-int kernel_irq_setaffinity(unsigned irq, uintmax_t new , uintmax_t *old ) ;
+int kernel_irq_setaffinity(unsigned irq, uintmax_t new , uintmax_t *old );
#ifdef __cplusplus
}
diff --git a/include/villas/kernel/nl-private.h b/include/villas/kernel/nl-private.h
index f67051dc7..ded3b0a97 100644
--- a/include/villas/kernel/nl-private.h
+++ b/include/villas/kernel/nl-private.h
@@ -6,39 +6,44 @@ extern "C" {
#define SCH_NETEM_ATTR_DIST 0x2000
-struct rtnl_netem_corr {
- uint32_t nmc_delay;
- uint32_t nmc_loss;
- uint32_t nmc_duplicate;
+struct rtnl_netem_corr
+{
+ uint32_t nmc_delay;
+ uint32_t nmc_loss;
+ uint32_t nmc_duplicate;
};
-struct rtnl_netem_reo {
- uint32_t nmro_probability;
- uint32_t nmro_correlation;
+struct rtnl_netem_reo
+{
+ uint32_t nmro_probability;
+ uint32_t nmro_correlation;
};
-struct rtnl_netem_crpt {
- uint32_t nmcr_probability;
- uint32_t nmcr_correlation;
+struct rtnl_netem_crpt
+{
+ uint32_t nmcr_probability;
+ uint32_t nmcr_correlation;
};
-struct rtnl_netem_dist {
- int16_t *dist_data;
- size_t dist_size;
+struct rtnl_netem_dist
+{
+ int16_t * dist_data;
+ size_t dist_size;
};
-struct rtnl_netem {
- uint32_t qnm_latency;
- uint32_t qnm_limit;
- uint32_t qnm_loss;
- uint32_t qnm_gap;
- uint32_t qnm_duplicate;
- uint32_t qnm_jitter;
- uint32_t qnm_mask;
- struct rtnl_netem_corr qnm_corr;
- struct rtnl_netem_reo qnm_ro;
- struct rtnl_netem_crpt qnm_crpt;
- struct rtnl_netem_dist qnm_dist;
+struct rtnl_netem
+{
+ uint32_t qnm_latency;
+ uint32_t qnm_limit;
+ uint32_t qnm_loss;
+ uint32_t qnm_gap;
+ uint32_t qnm_duplicate;
+ uint32_t qnm_jitter;
+ uint32_t qnm_mask;
+ struct rtnl_netem_corr qnm_corr;
+ struct rtnl_netem_reo qnm_ro;
+ struct rtnl_netem_crpt qnm_crpt;
+ struct rtnl_netem_dist qnm_dist;
};
void *rtnl_tc_data(struct rtnl_tc *tc);
diff --git a/include/villas/mapping.h b/include/villas/mapping.h
index af26b3918..1db78444e 100644
--- a/include/villas/mapping.h
+++ b/include/villas/mapping.h
@@ -42,8 +42,8 @@ struct list;
struct mapping_entry {
struct node *node;
- int offset; /**< Offset of this mapping entry within sample::data */
- int length; /**< The number of values which is covered by this mapping entry. */
+ int offset; /**< Offset of this mapping entry within sample::data */
+ int length; /**< The number of values which is covered by this mapping entry. */
enum {
MAPPING_TYPE_DATA,
@@ -88,10 +88,9 @@ struct mapping_entry {
};
};
-int
-mapping_remap(struct list *m, struct sample *remapped, struct sample *original, struct stats *s);
+int mapping_remap(struct list *m, struct sample *remapped, struct sample *original, struct stats *s);
-int mapping_update(struct mapping_entry *e, struct sample *remapped, struct sample * new , struct stats *s ) ;
+int mapping_update(struct mapping_entry *e, struct sample *remapped, struct sample *new, struct stats *s);
int mapping_parse(struct mapping_entry *e, json_t *cfg, struct list *nodes);
diff --git a/include/villas/memory.h b/include/villas/memory.h
index a680b65ff..54da2bbc0 100644
--- a/include/villas/memory.h
+++ b/include/villas/memory.h
@@ -21,16 +21,16 @@
* along with this program. If not, see .
*********************************************************************************/
+#pragma once
+
#include
#include
-#pragma once
-
#ifdef __cplusplus
extern "C" {
#endif
-#define HUGEPAGESIZE (1 << 21)
+#define HUGEPAGESIZE (1 << 21)
struct memtype;
@@ -38,10 +38,10 @@ typedef void *(*memzone_allocator_t)(struct memtype *mem, size_t len, size_t ali
typedef int (*memzone_deallocator_t)(struct memtype *mem, void *ptr, size_t len);
enum memtype_flags {
- MEMORY_MMAP = (1 << 0),
- MEMORY_DMA = (1 << 1),
- MEMORY_HUGEPAGE = (1 << 2),
- MEMORY_HEAP = (1 << 3)
+ MEMORY_MMAP = (1 << 0),
+ MEMORY_DMA = (1 << 1),
+ MEMORY_HUGEPAGE = (1 << 2),
+ MEMORY_HEAP = (1 << 3)
};
struct memtype {
@@ -86,13 +86,13 @@ int memory_init(int hugepages);
* @retval NULL If allocation failed.
* @retval <>0 If allocation was successful.
*/
-void *memory_alloc(struct memtype *m, size_t len);
+void * memory_alloc(struct memtype *m, size_t len);
-void *memory_alloc_aligned(struct memtype *m, size_t len, size_t alignment);
+void * memory_alloc_aligned(struct memtype *m, size_t len, size_t alignment);
int memory_free(struct memtype *m, void *ptr, size_t len);
-struct memtype *memtype_managed_init(void *ptr, size_t len);
+struct memtype * memtype_managed_init(void *ptr, size_t len);
extern struct memtype memtype_heap;
extern struct memtype memtype_hugepage;
diff --git a/include/villas/node.h b/include/villas/node.h
index 8ec6f7523..d8c5b4c58 100644
--- a/include/villas/node.h
+++ b/include/villas/node.h
@@ -26,7 +26,6 @@
* @{
*/
-
#pragma once
#include
diff --git a/include/villas/nodes/amqp.h b/include/villas/nodes/amqp.h
index aa453ec75..b343190c1 100644
--- a/include/villas/nodes/amqp.h
+++ b/include/villas/nodes/amqp.h
@@ -68,7 +68,7 @@ struct amqp {
};
/** @see node_type::print */
-char *amqp_print(struct node *n);
+char * amqp_print(struct node *n);
/** @see node_type::parse */
int amqp_parse(struct node *n, json_t *json);
diff --git a/include/villas/nodes/comedi.h b/include/villas/nodes/comedi.h
index 6cc282b64..3aa01f5b3 100644
--- a/include/villas/nodes/comedi.h
+++ b/include/villas/nodes/comedi.h
@@ -49,23 +49,22 @@ struct comedi_chanspec {
};
struct comedi_direction {
- int subdevice; ///< Comedi subdevice
- int buffer_size; ///< Comedi's kernel buffer size in kB
- int sample_size; ///< Size of a single measurement sample
- int sample_rate_hz; ///< Sample rate in Hz
- bool present; ///< Config present
- bool enabled; ///< Card is started successfully
- bool running; ///< Card is actively transfering samples
- struct timespec started; ///< Timestamp when sampling started
- struct timespec last_debug; ///< Timestamp of last debug output
- size_t counter; ///< Number of villas samples transfered
- struct comedi_chanspec *chanspecs; ///< Range and maxdata config of channels
- unsigned *chanlist; ///< Channel list in comedi's packed format
- size_t chanlist_len; ///< Number of channels for this direction
+ int subdevice; ///< Comedi subdevice
+ int buffer_size; ///< Comedi's kernel buffer size in kB
+ int sample_size; ///< Size of a single measurement sample
+ int sample_rate_hz; ///< Sample rate in Hz
+ bool present; ///< Config present
+ bool enabled; ///< Card is started successfully
+ bool running; ///< Card is actively transfering samples
+ struct timespec started; ///< Timestamp when sampling started
+ struct timespec last_debug; ///< Timestamp of last debug output
+ size_t counter; ///< Number of villas samples transfered
+ struct comedi_chanspec *chanspecs; ///< Range and maxdata config of channels
+ unsigned *chanlist; ///< Channel list in comedi's packed format
+ size_t chanlist_len; ///< Number of channels for this direction
-
- char *buffer;
- char *bufptr;
+ char* buffer;
+ char* bufptr;
};
struct comedi {
@@ -77,16 +76,16 @@ struct comedi {
char *buf;
char *bufptr;
#else
- char *map;
- size_t bufpos;
- size_t front;
- size_t back;
+ char *map;
+ size_t bufpos;
+ size_t front;
+ size_t back;
#endif
};
/** @see node_type::print */
-char *comedi_print(struct node *n);
+char * comedi_print(struct node *n);
/** @see node_type::parse */
int comedi_parse(struct node *n, json_t *cfg);
@@ -103,8 +102,8 @@ int comedi_read(struct node *n, struct sample *smps[], unsigned cnt);
/** @see node_type::write */
int comedi_write(struct node *n, struct sample *smps[], unsigned cnt);
+/** @} */
+
#ifdef __cplusplus
}
#endif
-
-/** @} */
diff --git a/include/villas/nodes/file.h b/include/villas/nodes/file.h
index aa13409f8..498afb0a4 100644
--- a/include/villas/nodes/file.h
+++ b/include/villas/nodes/file.h
@@ -37,19 +37,19 @@
extern "C" {
#endif
-#define FILE_MAX_PATHLEN 512
+#define FILE_MAX_PATHLEN 512
struct file {
- struct io io; /**< Format and file IO */
+ struct io io; /**< Format and file IO */
struct format_type *format;
- char *uri_tmpl; /**< Format string for file name. */
- char *uri; /**< Real file name. */
- char *mode; /**< File access mode. */
+ char *uri_tmpl; /**< Format string for file name. */
+ char *uri; /**< Real file name. */
+ char *mode; /**< File access mode. */
- int flush; /**< Flush / upload file contents after each write. */
- struct task task; /**< Timer file descriptor. Blocks until 1 / rate seconds are elapsed. */
- double rate; /**< The read rate. */
+ int flush; /**< Flush / upload file contents after each write. */
+ struct task task; /**< Timer file descriptor. Blocks until 1 / rate seconds are elapsed. */
+ double rate; /**< The read rate. */
enum epoch_mode {
FILE_EPOCH_DIRECT,
@@ -57,21 +57,21 @@ struct file {
FILE_EPOCH_RELATIVE,
FILE_EPOCH_ABSOLUTE,
FILE_EPOCH_ORIGINAL
- } epoch_mode; /**< Specifies how file::offset is calculated. */
+ } epoch_mode; /**< Specifies how file::offset is calculated. */
enum {
- FILE_EOF_EXIT, /**< Terminate when EOF is reached. */
- FILE_EOF_REWIND, /**< Rewind the file when EOF is reached. */
- FILE_EOF_WAIT /**< Blocking wait when EOF is reached. */
+ FILE_EOF_EXIT, /**< Terminate when EOF is reached. */
+ FILE_EOF_REWIND, /**< Rewind the file when EOF is reached. */
+ FILE_EOF_WAIT /**< Blocking wait when EOF is reached. */
} eof;
- struct timespec first; /**< The first timestamp in the file file::{read,write}::uri */
- struct timespec epoch; /**< The epoch timestamp from the configuration. */
- struct timespec offset; /**< An offset between the timestamp in the input file and the current time */
+ struct timespec first; /**< The first timestamp in the file file::{read,write}::uri */
+ struct timespec epoch; /**< The epoch timestamp from the configuration. */
+ struct timespec offset; /**< An offset between the timestamp in the input file and the current time */
};
/** @see node_type::print */
-char *file_print(struct node *n);
+char * file_print(struct node *n);
/** @see node_type::parse */
int file_parse(struct node *n, json_t *cfg);
@@ -88,7 +88,8 @@ int file_read(struct node *n, struct sample *smps[], unsigned cnt);
/** @see node_type::write */
int file_write(struct node *n, struct sample *smps[], unsigned cnt);
+/** @} */
+
#ifdef __cplusplus
}
#endif
-/** @} */
diff --git a/include/villas/nodes/influxdb.h b/include/villas/nodes/influxdb.h
index 7eb4ea9b2..3abbde1f9 100644
--- a/include/villas/nodes/influxdb.h
+++ b/include/villas/nodes/influxdb.h
@@ -53,7 +53,7 @@ struct influxdb {
};
/** @see node_type::print */
-char *influxdb_print(struct node *n);
+char * influxdb_print(struct node *n);
/** @see node_type::parse */
int influxdb_parse(struct node *n, json_t *cfg);
diff --git a/include/villas/nodes/loopback.h b/include/villas/nodes/loopback.h
index 4560928c8..4cff73eb6 100644
--- a/include/villas/nodes/loopback.h
+++ b/include/villas/nodes/loopback.h
@@ -51,7 +51,7 @@ struct loopback {
};
/** @see node_type::print */
-char *loopback_print(struct node *n);
+char * loopback_print(struct node *n);
/** @see node_type::parse */
int loopback_parse(struct node *n, json_t *cfg);
diff --git a/include/villas/nodes/nanomsg.h b/include/villas/nodes/nanomsg.h
index e2c775d6a..11b5d2a3e 100644
--- a/include/villas/nodes/nanomsg.h
+++ b/include/villas/nodes/nanomsg.h
@@ -59,7 +59,7 @@ struct nanomsg {
};
/** @see node_type::print */
-char *nanomsg_print(struct node *n);
+char * nanomsg_print(struct node *n);
/** @see node_type::parse */
int nanomsg_parse(struct node *n, json_t *cfg);
diff --git a/include/villas/nodes/ngsi.h b/include/villas/nodes/ngsi.h
index 486d3f3e4..6160907a5 100644
--- a/include/villas/nodes/ngsi.h
+++ b/include/villas/nodes/ngsi.h
@@ -50,22 +50,22 @@ extern "C" {
struct node;
struct ngsi {
- const char *endpoint; /**< The NGSI context broker endpoint URL. */
- const char *entity_id; /**< The context broker entity id related to this node */
- const char *entity_type; /**< The type of the entity */
- const char *access_token; /**< An optional authentication token which will be sent as HTTP header. */
+ const char *endpoint; /**< The NGSI context broker endpoint URL. */
+ const char *entity_id; /**< The context broker entity id related to this node */
+ const char *entity_type; /**< The type of the entity */
+ const char *access_token; /**< An optional authentication token which will be sent as HTTP header. */
- double timeout; /**< HTTP timeout in seconds */
- double rate; /**< Rate used for polling. */
+ double timeout; /**< HTTP timeout in seconds */
+ double rate; /**< Rate used for polling. */
- struct task task; /**< Timer for periodic events. */
- int ssl_verify; /**< Boolean flag whether SSL server certificates should be verified or not. */
+ struct task task; /**< Timer for periodic events. */
+ int ssl_verify; /**< Boolean flag whether SSL server certificates should be verified or not. */
- struct curl_slist *headers; /**< List of HTTP request headers for libcurl */
+ struct curl_slist *headers; /**< List of HTTP request headers for libcurl */
- CURL *curl; /**< libcurl: handle */
+ CURL *curl; /**< libcurl: handle */
- struct list mapping; /**< A mapping between indices of the VILLASnode samples and the attributes in ngsi::context */
+ struct list mapping; /**< A mapping between indices of the VILLASnode samples and the attributes in ngsi::context */
};
/** Initialize global NGSI settings and maps shared memory regions.
@@ -84,7 +84,7 @@ int ngsi_deinit();
int ngsi_parse(struct node *n, json_t *cfg);
/** @see node_type::print */
-char *ngsi_print(struct node *n);
+char * ngsi_print(struct node *n);
/** @see node_type::open */
int ngsi_start(struct node *n);
@@ -98,8 +98,8 @@ int ngsi_read(struct node *n, struct sample *smps[], unsigned cnt);
/** @see node_type::write */
int ngsi_write(struct node *n, struct sample *smps[], unsigned cnt);
+/** @} */
+
#ifdef __cplusplus
}
#endif
-
-/** @} */
diff --git a/include/villas/nodes/opal.h b/include/villas/nodes/opal.h
index 4584e270d..370b58957 100644
--- a/include/villas/nodes/opal.h
+++ b/include/villas/nodes/opal.h
@@ -72,7 +72,7 @@ int opal_deinit();
int opal_parse(struct node *n, json_t *cfg);
/** @see node_type::print */
-char *opal_print(struct node *n);
+char * opal_print(struct node *n);
/** Print global settings of the OPAL node type. */
int opal_print_global();
diff --git a/include/villas/nodes/shmem.h b/include/villas/nodes/shmem.h
index 00225b2b8..0426645ce 100644
--- a/include/villas/nodes/shmem.h
+++ b/include/villas/nodes/shmem.h
@@ -44,15 +44,15 @@ extern "C" {
* @see node_type
*/
struct shmem {
- const char *out_name; /**< Name of the shm object for the output queue. */
- const char *in_name; /**< Name of the shm object for the input queue. */
- struct shmem_conf conf; /**< Interface configuration struct. */
- char **exec; /**< External program to execute on start. */
- struct shmem_int intf; /**< Shmem interface */
+ const char* out_name; /**< Name of the shm object for the output queue. */
+ const char* in_name; /**< Name of the shm object for the input queue. */
+ struct shmem_conf conf; /**< Interface configuration struct. */
+ char **exec; /**< External program to execute on start. */
+ struct shmem_int intf; /**< Shmem interface */
};
/** @see node_type::print */
-char *shmem_print(struct node *n);
+char * shmem_print(struct node *n);
/** @see node_type::parse */
int shmem_parse(struct node *n, json_t *cfg);
@@ -69,8 +69,8 @@ int shmem_read(struct node *n, struct sample *smps[], unsigned cnt);
/** @see node_type::write */
int shmem_write(struct node *n, struct sample *smps[], unsigned cnt);
+/** @} */
+
#ifdef __cplusplus
}
#endif
-
-/** @} */
diff --git a/include/villas/nodes/signal_generator.h b/include/villas/nodes/signal_generator.h
index 6c08b99d4..18d0c0b48 100644
--- a/include/villas/nodes/signal_generator.h
+++ b/include/villas/nodes/signal_generator.h
@@ -55,29 +55,29 @@ enum signal_generator_type {
* @see node_type
*/
struct signal_generator {
- struct task task; /**< Timer for periodic events. */
- int rt; /**< Real-time mode? */
+ struct task task; /**< Timer for periodic events. */
+ int rt; /**< Real-time mode? */
enum signal_generator_type type; /**< Signal type */
- double rate; /**< Sampling rate. */
- double frequency; /**< Frequency of the generated signals. */
- double amplitude; /**< Amplitude of the generated signals. */
- double stddev; /**< Standard deviation of random signals (normal distributed). */
- double offset; /**< A constant bias. */
+ double rate; /**< Sampling rate. */
+ double frequency; /**< Frequency of the generated signals. */
+ double amplitude; /**< Amplitude of the generated signals. */
+ double stddev; /**< Standard deviation of random signals (normal distributed). */
+ double offset; /**< A constant bias. */
- double *last; /**< The values from the previous period which are required for random walk. */
+ double *last; /**< The values from the previous period which are required for random walk. */
- int values; /**< The number of values which will be emitted by this node. */
- int limit; /**< The number of values which should be generated by this node. <0 for infinitve. */
+ int values; /**< The number of values which will be emitted by this node. */
+ int limit; /**< The number of values which should be generated by this node. <0 for infinitve. */
- struct timespec started; /**< Point in time when this node was started. */
- int counter; /**< The number of packets already emitted. */
- int missed_steps; /**< Total number of missed steps. */
+ struct timespec started; /**< Point in time when this node was started. */
+ int counter; /**< The number of packets already emitted. */
+ int missed_steps; /**< Total number of missed steps. */
};
/** @see node_type::print */
-char *signal_generator_print(struct node *n);
+char * signal_generator_print(struct node *n);
/** @see node_type::parse */
int signal_generator_parse(struct node *n, json_t *cfg);
@@ -93,8 +93,8 @@ int signal_generator_read(struct node *n, struct sample *smps[], unsigned cnt);
enum signal_generator_type signal_generator_lookup_type(const char *type);
+/** @} */
+
#ifdef __cplusplus
}
#endif
-
-/** @} */
diff --git a/include/villas/nodes/socket.h b/include/villas/nodes/socket.h
index 3499c7329..6cccdf848 100644
--- a/include/villas/nodes/socket.h
+++ b/include/villas/nodes/socket.h
@@ -79,29 +79,29 @@ union sockaddr_union {
};
struct socket {
- int sd; /**< The socket descriptor */
- int mark; /**< Socket mark for netem, routing and filtering */
- int verify_source; /**< Verify the source address of incoming packets against socket::remote. */
+ int sd; /**< The socket descriptor */
+ int mark; /**< Socket mark for netem, routing and filtering */
+ int verify_source; /**< Verify the source address of incoming packets against socket::remote. */
- enum socket_layer layer; /**< The OSI / IP layer which should be used for this socket */
+ enum socket_layer layer; /**< The OSI / IP layer which should be used for this socket */
- union sockaddr_union local; /**< Local address of the socket */
- union sockaddr_union remote; /**< Remote address of the socket */
+ union sockaddr_union local; /**< Local address of the socket */
+ union sockaddr_union remote; /**< Remote address of the socket */
struct format_type *format;
struct io io;
/* Multicast options */
struct multicast {
- int enabled; /**< Is multicast enabled? */
- unsigned char loop; /** Loopback multicast packets to local host? */
- unsigned char ttl; /**< The time to live for multicast packets. */
- struct ip_mreq mreq; /**< A multicast group to join. */
+ int enabled; /**< Is multicast enabled? */
+ unsigned char loop; /** Loopback multicast packets to local host? */
+ unsigned char ttl; /**< The time to live for multicast packets. */
+ struct ip_mreq mreq; /**< A multicast group to join. */
} multicast;
#ifdef WITH_NETEM
- struct rtnl_qdisc *tc_qdisc; /**< libnl3: Network emulator queuing discipline */
- struct rtnl_cls *tc_classifier; /**< libnl3: Firewall mark classifier */
+ struct rtnl_qdisc *tc_qdisc; /**< libnl3: Network emulator queuing discipline */
+ struct rtnl_cls *tc_classifier; /**< libnl3: Firewall mark classifier */
#endif /* WITH_NETEM */
};
@@ -128,7 +128,7 @@ int socket_read(struct node *n, struct sample *smps[], unsigned cnt);
int socket_parse(struct node *n, json_t *cfg);
/** @see node_type::print */
-char *socket_print(struct node *n);
+char * socket_print(struct node *n);
/** Generate printable socket address depending on the address family
*
@@ -138,7 +138,7 @@ char *socket_print(struct node *n);
* @param sa A pointer to the socket address.
* @return The buffer containing the textual representation of the address. The caller is responsible to free() this buffer!
*/
-char *socket_print_addr(struct sockaddr *saddr);
+char * socket_print_addr(struct sockaddr *saddr);
/** Parse a socket address depending on the address family
*
@@ -158,8 +158,8 @@ int socket_parse_addr(const char *str, struct sockaddr *sa, enum socket_layer la
int socket_compare_addr(struct sockaddr *x, struct sockaddr *y);
+/** @} */
+
#ifdef __cplusplus
}
#endif
-
-/** @} */
diff --git a/include/villas/nodes/test_rtt.h b/include/villas/nodes/test_rtt.h
index 97b615a26..20f204410 100644
--- a/include/villas/nodes/test_rtt.h
+++ b/include/villas/nodes/test_rtt.h
@@ -45,29 +45,29 @@ struct sample;
struct test_rtt_case {
double rate;
int values;
- int limit; /**< The number of samples we take per test. */
+ int limit; /**< The number of samples we take per test. */
char *filename;
};
struct test_rtt {
- struct task task; /**< The periodic task for test_rtt_read() */
- struct io io; /**< The format of the output file */
+ struct task task; /**< The periodic task for test_rtt_read() */
+ struct io io; /**< The format of the output file */
struct format_type *format;
- double cooldown; /**< Number of seconds to wait beween tests. */
+ double cooldown; /**< Number of seconds to wait beween tests. */
- int current; /**< Index of current test in test_rtt::cases */
+ int current; /**< Index of current test in test_rtt::cases */
int counter;
- struct list cases; /**< List of test cases */
+ struct list cases; /**< List of test cases */
- char *output; /**< The directory where we place the results. */
- char *prefix; /**< An optional prefix in the filename. */
+ char *output; /**< The directory where we place the results. */
+ char *prefix; /**< An optional prefix in the filename. */
};
/** @see node_type::print */
-char *test_rtt_print(struct node *n);
+char * test_rtt_print(struct node *n);
/** @see node_type::parse */
int test_rtt_parse(struct node *n, json_t *cfg);
@@ -84,8 +84,8 @@ int test_rtt_read(struct node *n, struct sample *smps[], unsigned cnt);
/** @see node_type::write */
int test_rtt_write(struct node *n, struct sample *smps[], unsigned cnt);
+/** @} */
+
#ifdef __cplusplus
}
#endif
-
-/** @} */
diff --git a/include/villas/nodes/websocket.h b/include/villas/nodes/websocket.h
index 7ea510d4b..0e5097a17 100644
--- a/include/villas/nodes/websocket.h
+++ b/include/villas/nodes/websocket.h
@@ -42,56 +42,56 @@
extern "C" {
#endif
-#define DEFAULT_WEBSOCKET_QUEUELEN (DEFAULT_QUEUELEN * 64)
-#define DEFAULT_WEBSOCKET_SAMPLELEN DEFAULT_SAMPLELEN
+#define DEFAULT_WEBSOCKET_QUEUELEN (DEFAULT_QUEUELEN * 64)
+#define DEFAULT_WEBSOCKET_SAMPLELEN DEFAULT_SAMPLELEN
/* Forward declaration */
struct lws;
/** Internal data per websocket node */
struct websocket {
- struct list destinations; /**< List of websocket servers connect to in client mode (struct websocket_destination). */
+ struct list destinations; /**< List of websocket servers connect to in client mode (struct websocket_destination). */
- struct pool pool;
- struct queue_signalled queue; /**< For samples which are received from WebSockets */
+ struct pool pool;
+ struct queue_signalled queue; /**< For samples which are received from WebSockets */
};
/* Internal datastructures */
struct websocket_connection {
- enum websocket_connection_state {
- WEBSOCKET_CONNECTION_STATE_DESTROYED,
- WEBSOCKET_CONNECTION_STATE_INITIALIZED,
- WEBSOCKET_CONNECTION_STATE_CONNECTING,
- WEBSOCKET_CONNECTION_STATE_RECONNECTING,
- WEBSOCKET_CONNECTION_STATE_ESTABLISHED,
- WEBSOCKET_CONNECTION_STATE_SHUTDOWN,
- WEBSOCKET_CONNECTION_STATE_ERROR
- } state; /**< The current status of this connection. */
+ enum websocket_connection_state {
+ WEBSOCKET_CONNECTION_STATE_DESTROYED,
+ WEBSOCKET_CONNECTION_STATE_INITIALIZED,
+ WEBSOCKET_CONNECTION_STATE_CONNECTING,
+ WEBSOCKET_CONNECTION_STATE_RECONNECTING,
+ WEBSOCKET_CONNECTION_STATE_ESTABLISHED,
+ WEBSOCKET_CONNECTION_STATE_SHUTDOWN,
+ WEBSOCKET_CONNECTION_STATE_ERROR
+ } state; /**< The current status of this connection. */
- enum {
- WEBSOCKET_MODE_CLIENT,
- WEBSOCKET_MODE_SERVER,
- } mode;
+ enum {
+ WEBSOCKET_MODE_CLIENT,
+ WEBSOCKET_MODE_SERVER,
+ } mode;
- struct lws *wsi;
- struct node *node;
- struct io io;
- struct queue queue; /**< For samples which are sent to the WebSocket */
+ struct lws *wsi;
+ struct node *node;
+ struct io io;
+ struct queue queue; /**< For samples which are sent to the WebSocket */
- struct format_type *format;
- struct websocket_destination *destination;
+ struct format_type *format;
+ struct websocket_destination *destination;
- struct {
- struct buffer recv; /**< A buffer for reconstructing fragmented messags. */
- struct buffer send; /**< A buffer for contsructing messages before calling lws_write() */
- } buffers;
+ struct {
+ struct buffer recv; /**< A buffer for reconstructing fragmented messags. */
+ struct buffer send; /**< A buffer for contsructing messages before calling lws_write() */
+ } buffers;
- char *_name;
+ char *_name;
};
struct websocket_destination {
- char *uri;
- struct lws_client_connect_info info;
+ char *uri;
+ struct lws_client_connect_info info;
};
int websocket_protocol_cb(struct lws *wsi, enum lws_callback_reasons reason, void *user, void *in, size_t len);
@@ -117,8 +117,8 @@ int websocket_read(struct node *n, struct sample *smps[], unsigned cnt);
/** @see node_type::write */
int websocket_write(struct node *n, struct sample *smps[], unsigned cnt);
+/** @} */
+
#ifdef __cplusplus
}
#endif
-
-/** @} */
diff --git a/include/villas/nodes/zeromq.h b/include/villas/nodes/zeromq.h
index d883aaf07..4f31de46e 100644
--- a/include/villas/nodes/zeromq.h
+++ b/include/villas/nodes/zeromq.h
@@ -40,7 +40,7 @@ extern "C" {
#endif
#if ZMQ_BUILD_DRAFT_API && (ZMQ_VERSION_MAJOR > 4 || (ZMQ_VERSION_MAJOR == 4 && ZMQ_VERSION_MINOR >= 2))
-#define ZMQ_BUILD_DISH 1
+ #define ZMQ_BUILD_DISH 1
#endif
/* Forward declarations */
@@ -72,19 +72,19 @@ struct zeromq {
} pattern;
struct {
- void *socket; /**< ZeroMQ socket. */
+ void *socket; /**< ZeroMQ socket. */
void *mon_socket;
char *endpoint;
} subscriber;
struct {
- void *socket; /**< ZeroMQ socket. */
+ void *socket; /**< ZeroMQ socket. */
struct list endpoints;
} publisher;
};
/** @see node_type::print */
-char *zeromq_print(struct node *n);
+char * zeromq_print(struct node *n);
/** @see node_type::parse */
int zeromq_parse(struct node *n, json_t *cfg);
@@ -107,8 +107,8 @@ int zeromq_read(struct node *n, struct sample *smps[], unsigned cnt);
/** @see node_type::write */
int zeromq_write(struct node *n, struct sample *smps[], unsigned cnt);
+/** @} */
+
#ifdef __cplusplus
}
#endif
-
-/** @} */
diff --git a/include/villas/path.h b/include/villas/path.h
index cef9b76ab..b8c2de58a 100644
--- a/include/villas/path.h
+++ b/include/villas/path.h
@@ -56,7 +56,7 @@ struct path_source {
bool masked;
struct pool pool;
- struct list mappings; /**< List of mappings (struct mapping_entry). */
+ struct list mappings; /**< List of mappings (struct mapping_entry). */
};
struct path_destination {
@@ -67,15 +67,15 @@ struct path_destination {
/** The register mode determines under which condition the path is triggered. */
enum path_mode {
- PATH_MODE_ANY, /**< The path is triggered whenever one of the sources receives samples. */
- PATH_MODE_ALL /**< The path is triggered only after all sources have received at least 1 sample. */
+ PATH_MODE_ANY, /**< The path is triggered whenever one of the sources receives samples. */
+ PATH_MODE_ALL /**< The path is triggered only after all sources have received at least 1 sample. */
};
/** The datastructure for a path. */
struct path {
- enum state state; /**< Path state. */
+ enum state state; /**< Path state. */
- enum path_mode mode; /**< Determines when this path is triggered. */
+ enum path_mode mode; /**< Determines when this path is triggered. */
struct {
int nfds;
@@ -86,27 +86,27 @@ struct path {
struct sample *last_sample;
int last_sequence;
- struct list sources; /**< List of all incoming nodes (struct path_source). */
- struct list destinations; /**< List of all outgoing nodes (struct path_destination). */
- struct list hooks; /**< List of processing hooks (struct hook). */
+ struct list sources; /**< List of all incoming nodes (struct path_source). */
+ struct list destinations; /**< List of all outgoing nodes (struct path_destination). */
+ struct list hooks; /**< List of processing hooks (struct hook). */
struct task timeout;
- double rate; /**< A timeout for */
- int enabled; /**< Is this path enabled. */
- int poll; /**< Weather or not to use poll(2). */
- int reverse; /**< This path as a matching reverse path. */
- int builtin; /**< This path should use built-in hooks by default. */
- int queuelen; /**< The queue length for each path_destination::queue */
- int samplelen; /**< Will be calculated based on path::sources.mappings */
+ double rate; /**< A timeout for */
+ int enabled; /**< Is this path enabled. */
+ int poll; /**< Weather or not to use poll(2). */
+ int reverse; /**< This path as a matching reverse path. */
+ int builtin; /**< This path should use built-in hooks by default. */
+ int queuelen; /**< The queue length for each path_destination::queue */
+ int samplelen; /**< Will be calculated based on path::sources.mappings */
- char *_name; /**< Singleton: A string which is used to print this path to screen. */
+ char *_name; /**< Singleton: A string which is used to print this path to screen. */
- struct bitset mask; /**< A mask of path_sources which are enabled for poll(). */
- struct bitset received; /**< A mask of path_sources for which we already received samples. */
+ struct bitset mask; /**< A mask of path_sources which are enabled for poll(). */
+ struct bitset received; /**< A mask of path_sources for which we already received samples. */
- pthread_t tid; /**< The thread id for this path. */
- json_t *cfg; /**< A JSON object containing the configuration of the path. */
+ pthread_t tid; /**< The thread id for this path. */
+ json_t *cfg; /**< A JSON object containing the configuration of the path. */
};
/** Initialize internal data structures. */
@@ -154,7 +154,7 @@ void path_print_stats(struct path *p);
* @param p A pointer to the path structure.
* @return A pointer to a string containing a textual representation of the path.
*/
-const char *path_name(struct path *p);
+const char * path_name(struct path *p);
/** Reverse a path */
int path_reverse(struct path *p, struct path *r);
@@ -172,8 +172,8 @@ int path_uses_node(struct path *p, struct node *n);
*/
int path_parse(struct path *p, json_t *cfg, struct list *nodes);
+/** @} */
+
#ifdef __cplusplus
}
#endif
-
-/** @} */
diff --git a/include/villas/pool.h b/include/villas/pool.h
index 662336d99..c8075128d 100644
--- a/include/villas/pool.h
+++ b/include/villas/pool.h
@@ -38,15 +38,15 @@ extern "C" {
/** A thread-safe memory pool */
struct pool {
- off_t buffer_off; /**< Offset from the struct address to the underlying memory area */
+ off_t buffer_off; /**< Offset from the struct address to the underlying memory area */
struct memtype *mem;
enum state state;
- size_t len; /**< Length of the underlying memory area */
+ size_t len; /**< Length of the underlying memory area */
- size_t blocksz; /**< Length of a block in bytes */
- size_t alignment; /**< Alignment of a block in bytes */
+ size_t blocksz; /**< Length of a block in bytes */
+ size_t alignment; /**< Alignment of a block in bytes */
struct queue queue; /**< The queue which is used to keep track of free blocks */
};
@@ -73,23 +73,27 @@ int pool_destroy(struct pool *p);
* This number can be smaller than the requested \p cnt blocks
* in case the pool currently holds less than \p cnt blocks.
*/
-INLINE ssize_t pool_get_many(struct pool *p, void *blocks[], size_t cnt) {
+INLINE ssize_t pool_get_many(struct pool *p, void *blocks[], size_t cnt)
+{
return queue_pull_many(&p->queue, blocks, cnt);
}
/** Push \p cnt values which are giving by the array values to the stack. */
-INLINE ssize_t pool_put_many(struct pool *p, void *blocks[], size_t cnt) {
+INLINE ssize_t pool_put_many(struct pool *p, void *blocks[], size_t cnt)
+{
return queue_push_many(&p->queue, blocks, cnt);
}
/** Get a free memory block from pool. */
-INLINE void *pool_get(struct pool *p) {
+INLINE void * pool_get(struct pool *p)
+{
void *ptr;
return queue_pull(&p->queue, &ptr) == 1 ? ptr : NULL;
}
/** Release a memory block back to the pool. */
-INLINE int pool_put(struct pool *p, void *buf) {
+INLINE int pool_put(struct pool *p, void *buf)
+{
return queue_push(&p->queue, buf);
}
diff --git a/include/villas/queue.h b/include/villas/queue.h
index e75a95368..3bc7c969a 100644
--- a/include/villas/queue.h
+++ b/include/villas/queue.h
@@ -33,9 +33,6 @@
#pragma once
-
-
-
#include
#include
#include
@@ -121,4 +118,4 @@ int queue_close(struct queue *q);
#ifdef __cplusplus
}
-#endif
\ No newline at end of file
+#endif
diff --git a/include/villas/sample.h b/include/villas/sample.h
index 4102f7f00..fcc0326c2 100644
--- a/include/villas/sample.h
+++ b/include/villas/sample.h
@@ -21,8 +21,6 @@
* along with this program. If not, see .
*********************************************************************************/
-
-
#pragma once
#include "atomic.h"
diff --git a/include/villas/signal.h b/include/villas/signal.h
index 729cbb1f3..09487bda7 100644
--- a/include/villas/signal.h
+++ b/include/villas/signal.h
@@ -34,7 +34,7 @@ struct list;
struct node;
struct signal {
- char *name; /**< The name of the signal. */
+ char *name; /**< The name of the signal. */
char *unit;
int enabled;
enum {
@@ -53,4 +53,4 @@ int signal_get_offset(const char *str, struct node *n);
#ifdef __cplusplus
}
-#endif
\ No newline at end of file
+#endif
diff --git a/include/villas/stats.h b/include/villas/stats.h
index 70b044f2d..0d3660232 100644
--- a/include/villas/stats.h
+++ b/include/villas/stats.h
@@ -44,19 +44,19 @@ enum stats_format {
};
enum stats_id {
- STATS_SKIPPED, /**< Counter for skipped samples due to hooks. */
- STATS_TIME, /**< The processing time per sample within VILLAsnode. */
- STATS_REORDERED, /**< Counter for reordered samples. */
- STATS_GAP_SAMPLE, /**< Histogram for inter sample timestamps (as sent by remote). */
- STATS_GAP_RECEIVED, /**< Histogram for inter sample arrival time (as seen by this instance). */
- STATS_OWD, /**< Histogram for one-way-delay (OWD) of received samples. */
- STATS_COUNT /**< Just here to have an updated number of statistics. */
+ STATS_SKIPPED, /**< Counter for skipped samples due to hooks. */
+ STATS_TIME, /**< The processing time per sample within VILLAsnode. */
+ STATS_REORDERED, /**< Counter for reordered samples. */
+ STATS_GAP_SAMPLE, /**< Histogram for inter sample timestamps (as sent by remote). */
+ STATS_GAP_RECEIVED, /**< Histogram for inter sample arrival time (as seen by this instance). */
+ STATS_OWD, /**< Histogram for one-way-delay (OWD) of received samples. */
+ STATS_COUNT /**< Just here to have an updated number of statistics. */
};
struct stats_delta {
double values[STATS_COUNT];
- int update; /**< Bitmask of stats_id. Only those which are masked will be updated */
+ int update; /**< Bitmask of stats_id. Only those which are masked will be updated */
};
struct stats {
@@ -77,7 +77,7 @@ void stats_collect(struct stats *s, struct sample *smps[], size_t cnt);
int stats_commit(struct stats *s);
-json_t *stats_json(struct stats *s);
+json_t * stats_json(struct stats *s);
void stats_reset(struct stats *s);
@@ -90,8 +90,7 @@ void stats_print(struct stats *s, FILE *f, enum stats_format fmt, int verbose);
enum stats_id stats_lookup_id(const char *name);
+#endif /* _STATS_H_ */
#ifdef __cplusplus
}
#endif
-
-#endif /* _STATS_H_ */
diff --git a/include/villas/super_node.h b/include/villas/super_node.h
index 4ff019119..d8f70e219 100644
--- a/include/villas/super_node.h
+++ b/include/villas/super_node.h
@@ -35,31 +35,31 @@ extern "C" {
/** Global configuration */
struct super_node {
- int priority; /**< Process priority (lower is better) */
- int affinity; /**< Process affinity of the server and all created threads */
- int hugepages; /**< Number of hugepages to reserve. */
- double stats; /**< Interval for path statistics. Set to 0 to disable them. */
+ int priority; /**< Process priority (lower is better) */
+ int affinity; /**< Process affinity of the server and all created threads */
+ int hugepages; /**< Number of hugepages to reserve. */
+ double stats; /**< Interval for path statistics. Set to 0 to disable them. */
- struct list nodes;
- struct list paths;
- struct list plugins;
+ struct list nodes;
+ struct list paths;
+ struct list plugins;
- struct log log;
- struct api api;
- struct web web;
+ struct log log;
+ struct api api;
+ struct web web;
- char *name; /**< A name of this super node. Usually the hostname. */
+ char *name; /**< A name of this super node. Usually the hostname. */
- enum state state;
+ enum state state;
- char *uri; /**< URI of configuration */
+ char *uri; /**< URI of configuration */
- json_t *cfg; /**< JSON representation of the configuration. */
+ json_t *cfg; /**< JSON representation of the configuration. */
};
/* Compatibility with libconfig < 1.5 */
#if (LIBCONFIG_VER_MAJOR <= 1) && (LIBCONFIG_VER_MINOR < 5)
-#define config_setting_lookup config_lookup_from
+ #define config_setting_lookup config_lookup_from
#endif
/** Inititalize configuration object before parsing the configuration. */
@@ -90,4 +90,4 @@ int super_node_destroy(struct super_node *sn);
#ifdef __cplusplus
}
-#endif
\ No newline at end of file
+#endif
diff --git a/include/villas/table.h b/include/villas/table.h
index 9ecf0d8a1..579903d38 100644
--- a/include/villas/table.h
+++ b/include/villas/table.h
@@ -30,17 +30,17 @@ extern "C" {
#endif
struct table_column {
- int width; /**< Width of the column. */
- char *title; /**< The title as shown in the table header. */
- char *format; /**< The format which is used to print the table rows. */
- char *unit; /**< An optional unit which will be shown in the table header. */
+ int width; /**< Width of the column. */
+ char *title; /**< The title as shown in the table header. */
+ char *format; /**< The format which is used to print the table rows. */
+ char *unit; /**< An optional unit which will be shown in the table header. */
enum {
TABLE_ALIGN_LEFT,
TABLE_ALIGN_RIGHT
} align;
- int _width; /**< The real width of this column. Calculated by table_header() */
+ int _width; /**< The real width of this column. Calculated by table_header() */
};
struct table {
@@ -58,8 +58,8 @@ void table_row(struct table *t, ...);
/** Print the table footer. */
void table_footer(struct table *t);
+/** @} */
+
#ifdef __cplusplus
}
#endif
-
-/** @} */
diff --git a/include/villas/task.h b/include/villas/task.h
index 30b029edd..07eadcb50 100644
--- a/include/villas/task.h
+++ b/include/villas/task.h
@@ -34,25 +34,25 @@ extern "C" {
/** We can choose between two periodic task implementations */
//#define PERIODIC_TASK_IMPL NANOSLEEP
-#define TIMERFD 1
-#define CLOCK_NANOSLEEP 2
-#define NANOSLEEP 3
+#define TIMERFD 1
+#define CLOCK_NANOSLEEP 2
+#define NANOSLEEP 3
#if defined(__MACH__)
-#define PERIODIC_TASK_IMPL NANOSLEEP
+ #define PERIODIC_TASK_IMPL NANOSLEEP
#elif defined(__linux__)
-#define PERIODIC_TASK_IMPL TIMERFD
+ #define PERIODIC_TASK_IMPL TIMERFD
#else
-#error "Platform not supported"
+ #error "Platform not supported"
#endif
struct task {
- int clock; /**< CLOCK_{MONOTONIC,REALTIME} */
+ int clock; /**< CLOCK_{MONOTONIC,REALTIME} */
- struct timespec period; /**< The period of periodic invations of this task */
- struct timespec next; /**< The timer value for the next invocation */
+ struct timespec period; /**< The period of periodic invations of this task */
+ struct timespec next; /**< The timer value for the next invocation */
#if PERIODIC_TASK_IMPL == TIMERFD
- int fd; /**< The timerfd_create(2) file descriptior. */
+ int fd; /**< The timerfd_create(2) file descriptior. */
#endif
};
@@ -81,4 +81,3 @@ int task_fd(struct task *t);
#ifdef __cplusplus
}
#endif
-
diff --git a/include/villas/web.h b/include/villas/web.h
index cb65c8775..37958d35e 100644
--- a/include/villas/web.h
+++ b/include/villas/web.h
@@ -39,13 +39,13 @@ struct web {
enum state state;
- struct lws_context *context; /**< The libwebsockets server context. */
- struct lws_vhost *vhost; /**< The libwebsockets vhost. */
+ struct lws_context *context; /**< The libwebsockets server context. */
+ struct lws_vhost *vhost; /**< The libwebsockets vhost. */
- int port; /**< Port of the build in HTTP / WebSocket server. */
- char *htdocs; /**< The root directory for files served via HTTP. */
- char *ssl_cert; /**< Path to the SSL certitifcate for HTTPS / WSS. */
- char *ssl_private_key; /**< Path to the SSL private key for HTTPS / WSS. */
+ int port; /**< Port of the build in HTTP / WebSocket server. */
+ char *htdocs; /**< The root directory for files served via HTTP. */
+ char *ssl_cert; /**< Path to the SSL certitifcate for HTTPS / WSS. */
+ char *ssl_private_key; /**< Path to the SSL private key for HTTPS / WSS. */
pthread_t thread;
};