summaryrefslogtreecommitdiff
path: root/cesar/host/station/station.h
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/host/station/station.h')
-rw-r--r--cesar/host/station/station.h66
1 files changed, 22 insertions, 44 deletions
diff --git a/cesar/host/station/station.h b/cesar/host/station/station.h
index 774caf8c2e..7a7d931a0d 100644
--- a/cesar/host/station/station.h
+++ b/cesar/host/station/station.h
@@ -8,15 +8,15 @@
* <<<Licence>>>
*
* }}} */
-
- /**
+
+/**
* \file station.h
* \brief The station structures for fulminata.
* \ingroup host
*
* This file descibe the content of station structure used by fulminata station
*
- * \todo
+ * \todo
*/
#include <sys/types.h>
@@ -28,22 +28,13 @@
#include "host/fcall/fcall.h"
#include "host/system/system.h"
-#define STATION_PIPE_PATH "/tmp"
-#define STATION_PIPE_PREFIX "station"
-#define STATION_SOCK_PATH STATION_PIPE_PATH
-#define STATION_SOCK_PREFIX STATION_PIPE_PREFIX
#define STATION_MAX_LOG_SIZE 4096
#define STATION_MAX_LOG_MSG " [...] <WARNING> Log exceeds max size"
-#define STATION_MAX_SOCK_BUFFER_SIZE (256*1024)
#define STATION_MAX_FD 16
#define TICK_PERIOD_NS 40 /** period of a tick in nanosecond */
#define TICK_HZ 25000000 /** frequence of tick (tick number per second) */
-#ifndef MAXPATHLEN
-#define MAXPATHLEN 256
-#endif
-
struct sci_ctx;
struct netclock_ctx;
struct fcall_ctx;
@@ -91,20 +82,16 @@ struct station_ctx
struct fcall_ctx *fcall;
struct probe_ctx *probe;
struct system_ctx *system;
- tick_t current_tick_tck; /** current global clock tick got from sci msg */
- u32 seed; /** station seed (may be needed for cesar initialization) */
-#ifdef STATION_SOCK
- int sock_fd; /** file descriptor for messaging input/output */
- int sock_pair_fd; /** file descriptor for socket pair, used by unit test */
- char sock_name[MAXPATHLEN]; /** filename of messaging input/output */
-#else /* STATION_SOCK */
- int pipe_in_fd; /** file descriptor for messaging input pipe */
- char pipe_in_name[MAXPATHLEN]; /** filename of messaging input file */
- int pipe_out_fd; /** file descriptor for messaging output pipe */
- char pipe_out_name[MAXPATHLEN]; /** filename of messaging output pipe */
-#endif /* STATION_SOCK */
- int pipe_log_fd; /** output pipe file desc to send debug data */
- char pipe_log_name[MAXPATHLEN]; /** output pipe filename to send debug data */
+ /** current global clock tick got from sci msg */
+ tick_t current_tick_tck;
+ /** station seed (may be needed for cesar initialization) */
+ u32 seed;
+ /** File descriptor for messaging input. */
+ int fd_in;
+ /** File descriptor for messaging output. */
+ int fd_out;
+ /** Output file descriptor to send debug data. */
+ int fd_log;
station_log_level_t log_level;
unsigned long log_mask;
struct netclock_callback *ecos_tick_cb;
@@ -137,10 +124,10 @@ void station_free(station_ctx_t *station);
int station_init(station_ctx_t *station);
/**
- * station context to clean and reset, with pipe closing
+ * Free station resources.
* \param station pointer to station context to stop
*/
-void station_down(station_ctx_t *station);
+void station_uninit (station_ctx_t *station);
/**
* station is into idle state; it sends a sci 'idle' message and waits for sci message reception
@@ -160,15 +147,6 @@ int station_idle(station_ctx_t *station);
* - EINVAL if station id NULL or if wanted tick is to old
*/
int station_ecos_set_itimer(station_ctx_t *station, tick_t tick);
-
-static inline int station_is_initialized(station_ctx_t *station)
-{
-#ifdef STATION_SOCK
- return (station->sock_fd >= 0);
-#else /* STATION_SOCK */
- return ((station->pipe_in_fd >= 0) && (station->pipe_out_fd >= 0));
-#endif /* STATION_SOCK */
-}
/**
* set the station log level
@@ -203,15 +181,15 @@ extern inline unsigned long station_log_get_mask(station_ctx_t *station)
* send message to station log system
* \param station pointer to station context
* \param level level of log message
- * \param format string structure describing the data log format
+ * \param format string structure describing the data log format
* \param ... suite of parameters to fit the format
*/
-void station_log(station_ctx_t *station,
- station_log_level_t level,
- unsigned long type,
- const char *format,
- ...);
-
+void station_log(station_ctx_t *station,
+ station_log_level_t level,
+ unsigned long type,
+ const char *format,
+ ...);
+
//END_DECLS
#endif /*STATION_H_*/