summaryrefslogtreecommitdiff
path: root/cesar/cp/eoc/multi_sta/action/test
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/cp/eoc/multi_sta/action/test')
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/Makefile12
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/actions-Config14
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/actions-Makefile26
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/actions-override/cp/inc/context.h97
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/actions-override/cp/sta/core/core.h52
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/actions-override/cp/sta/core/defs.h57
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/actions-override/cyg/kernel/kapi.h37
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/fsm-Config13
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/fsm-Makefile25
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/fsm-override/cp/inc/context.h94
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/fsm-override/cp/sta/core/core.h53
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/fsm-override/cp/sta/core/defs.h57
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/fsm-override/cyg/kernel/kapi.h37
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/inc/scenario_defs.h135
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/src/actions.c41
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/src/actions_stub.c81
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/src/beacon_stub.c30
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/src/cl_interf_stub.c44
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/src/cp_eoc_sta_misc_stub.c23
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/src/cp_stub.c59
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/src/cyg_stub.c40
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/src/dataplane_stub.c32
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/src/fsm_stub.c201
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/src/hal_phy_stub.c26
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/src/mgr_stub.c63
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/src/test_actions.c284
-rw-r--r--cesar/cp/eoc/multi_sta/action/test/utest/src/test_fsm.c125
27 files changed, 1758 insertions, 0 deletions
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/Makefile b/cesar/cp/eoc/multi_sta/action/test/utest/Makefile
new file mode 100644
index 0000000000..b238673cdd
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/Makefile
@@ -0,0 +1,12 @@
+all: fsm actions
+
+fsm: fsm-Makefile
+ make -f fsm-Makefile
+
+actions: actions-Makefile
+ make -f actions-Makefile
+
+clean: fsm-Makefile actions-Makefile
+ make -f fsm-Makefile clean
+ make -f actions-Makefile clean
+ rmdir obj
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/actions-Config b/cesar/cp/eoc/multi_sta/action/test/utest/actions-Config
new file mode 100644
index 0000000000..53b2b131ce
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/actions-Config
@@ -0,0 +1,14 @@
+CONFIG_CP_EOC = y
+CONFIG_DEBUG_FATAL_CATCH = y
+CONFIG_CP_EOC_MULTI_STA_FSM_DEF="cp/eoc/multi_sta_fsm/src/fsm/multi_sta.fsm"
+CONFIG_CP_EOC_IS_MASTER = y
+CONFIG_MAC_PBPROC_EOC_FC = y
+CONFIG_CP_FSM_DEF = "cp/eoc/fsm/src/fsm/cp_eoc_cco.fsm"
+CONFIG_CP_EOC_SCHEDULER = y
+CONFIG_MAC_COMMON_EOC_SCHED = y
+CONFIG_TRACE_ON_FATAL = y
+CONFIG_TRACE = n
+CONFIG_CP_MSG_EOC_MULTI_STA_MME = y
+CONFIG_MAC_COMMON_EOC_TEI = y
+CONFIG_CL_EOC_ROUTE = y
+CONFIG_RESTRACK = y
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/actions-Makefile b/cesar/cp/eoc/multi_sta/action/test/utest/actions-Makefile
new file mode 100644
index 0000000000..2b4ce872ba
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/actions-Makefile
@@ -0,0 +1,26 @@
+BASE = ../../../../../..
+
+VARIANT = actions
+
+DEFS = -DSTA_CORE_UNIT_TEST=1
+
+INCLUDES = cp/eoc/multi_sta/action/test/utest/actions-override
+
+HOST_PROGRAMS = test_actions
+
+test_actions_SOURCES = test_actions.c cl_interf_stub.c \
+ hal_phy_stub.c cyg_stub.c cp_stub.c dataplane_stub.c
+
+test_actions_MODULES = lib mac/common \
+ cp/eoc/multi_sta_fsm cp/eoc/multi_sta/action \
+ cp/eoc/sta/mgr cp/eoc/sta/action cp/sta/core/stub \
+ cp/eoc/cco/action/stub cp/eoc/cco/bw \
+ cp/eoc/msg cp/eoc/fsm cp/secu \
+ cp/eoc/beacon/stub mac/sar/stub mac/ca/stub cl/stub \
+ interface/stub ce/tx/stub bsu/stub bufmgr/stub \
+ ce/rx/stub mac/pbproc/stub
+
+test_actions_CONFIG_MODULES = cl cp/eoc mac/sar
+test_actions_LDLIBS = -lm
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/actions-override/cp/inc/context.h b/cesar/cp/eoc/multi_sta/action/test/utest/actions-override/cp/inc/context.h
new file mode 100644
index 0000000000..0b432a120e
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/actions-override/cp/inc/context.h
@@ -0,0 +1,97 @@
+#ifndef override_cp_inc_context_h
+#define override_cp_inc_context_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file override/cp/inc/context.h
+ * \brief Control plane context override.
+ * \ingroup test
+ */
+
+#include "cp/eoc/beacon/beacon.h"
+#include "cp/eoc/beacon/inc/beacon.h"
+#include "cp/fsm/fsm.h"
+#include "cp/fsm/inc/context.h"
+#include "cp/inc/trace.h"
+#include "cp/sta/mgr/sta_mgr.h"
+#include "cp/sta/mgr/inc/sta_mgr.h"
+#include "mac/common/config.h"
+#include "mac/common/store.h"
+#include "mac/sar/sar.h"
+#include "cl/cl.h"
+#include "cp/msg/inc/context.h"
+#include "lib/rnd.h"
+#include "interface/interface.h"
+#include "cp/sta/core/defs.h"
+#include "cp/sta/action/inc/context.h"
+#include "cp/cco/bw/bw.h"
+#include "cp/cco/bw/inc/context.h"
+#include "cp/eoc/cco/bw/inc/bw.h"
+#include "cp/cl_interf/cl_interf.h"
+#include "cp/cl_interf/inc/context.h"
+#include "cp/eoc/cco/action/inc/cco_action.h"
+#include "cp/cco/action/inc/cco_action.h"
+#include "ce/tx/inc/tx.h"
+#include "bsu/aclf/aclf.h"
+#include "config/cl/eoc/route.h"
+#include "bufmgr/bufmgr.h"
+#include "cp/eoc/inc/dbg_print.h"
+
+struct cp_t
+{
+#if CONFIG_TRACE
+ /** Trace context. */
+ trace_buffer_t trace;
+ /** Verbose trace context. */
+ trace_buffer_t trace_verbose;
+#endif /* CONFIG_TRACE */
+
+ /** FSM context. */
+ cp_fsm_t fsm;
+ /** STA core flag. */
+ bool sta_core_flag;
+ /** STA core urgent flag. */
+ bool sta_core_urgent_flag;
+ /** station manager context*/
+ cp_sta_mgr_t sta_mgr;
+ /** Mac store /dataplane */
+ mac_store_t *mac_store;
+ /** MAC config contest*/
+ mac_config_t *mac_config;
+ /** Convergence Layer context */
+ cl_t *cl;
+ /** Phy context. */
+ phy_t *phy;
+ /** Segmentation and reassembly context */
+ sar_t *sar;
+ /** PBProc. */
+ pbproc_t *pbproc;
+ /** Context of the aclf. */
+ bsu_aclf_t *bsu_aclf;
+
+ cp_beacon_t beacon;
+ cp_msg_t msg;
+ lib_rnd_t rnd;
+ interface_t *interface;
+ cp_sta_action_t sta_action;
+ cp_eoc_cco_bw_sched_t schedule;
+ ca_t *ca;
+ cp_cco_bw_t bw;
+ cp_cl_interf_t cl_interf;
+ cp_cco_action_t cco_action;
+ ce_tx_t ce_tx;
+ ce_rx_t *ce_rx;
+
+ /** BSU context. */
+ bsu_t *bsu;
+
+ /** Buffer manager. */
+ bufmgr_t *bufmgr;
+};
+
+#endif /* override_cp_inc_context_h */
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/actions-override/cp/sta/core/core.h b/cesar/cp/eoc/multi_sta/action/test/utest/actions-override/cp/sta/core/core.h
new file mode 100644
index 0000000000..de8319d615
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/actions-override/cp/sta/core/core.h
@@ -0,0 +1,52 @@
+#ifndef override_cp_sta_core_core_h
+#define override_cp_sta_core_core_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file override/cp/sta/core/core.h
+ * \brief STA Core override.
+ * \ingroup test
+ */
+
+#include "cp/inc/context.h"
+
+BEGIN_DECLS
+
+void
+cp_sta_core_signal_fsm_event (cp_t *ctx);
+
+void
+cp_sta_core_signal_fsm_urgent_event (cp_t *ctx);
+
+u32
+cp_sta_core_get_date_ms (cp_t *ctx);
+
+void
+cp_sta_core_checkpoint (cp_t *ctx);
+
+void
+cp_sta_core_signal_recv_mme_event(cp_t *cp_ctx);
+
+void
+cp_sta_core_gen_timed_event(cp_t *cp_ctx,
+ cp_sta_core_timed_event_def_t *sta_core_timed_event,
+ cp_fsm_event_t *fsm_event,
+ uint event_delay_ms);
+
+void
+cp_sta_core_stop_timed_or_cyclic_event(cp_t *cp_ctx,
+ cp_sta_core_timed_event_def_t *sta_core_timed_event);
+
+int
+cp_sta_core_ms_to_cyg_tick (cp_t *ctx, const uint ms);
+
+u32
+cp_sta_core_tck_per_rtc (cp_t *ctx);
+END_DECLS
+
+#endif /* override_cp_sta_core_core_h */
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/actions-override/cp/sta/core/defs.h b/cesar/cp/eoc/multi_sta/action/test/utest/actions-override/cp/sta/core/defs.h
new file mode 100644
index 0000000000..9698b44e93
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/actions-override/cp/sta/core/defs.h
@@ -0,0 +1,57 @@
+#ifndef cp_sta_core_defs_h
+#define cp_sta_core_defs_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/core/defs.h
+ * \brief Sta core defs.
+ * \ingroup cp/sta/core
+ *
+ */
+#include "cp/fsm/forward.h"
+
+/** Forward declaration. */
+typedef struct cp_sta_core_t cp_sta_core_t;
+
+/*
+ * the sta core event flags
+ * these are some flags, so take care to give a value with all bits set to 0 but one.
+ */
+enum cp_sta_core_event_flag_t
+{
+ CP_STA_CORE_EVENT_FLAG_RECV_BEACON = 0x1,
+ CP_STA_CORE_EVENT_FLAG_RECV_MME = 0x2,
+ CP_STA_CORE_EVENT_FLAG_FSM = 0x4,
+ CP_STA_CORE_EVENT_FLAG_GARBAGE = 0x8,
+ CP_STA_CORE_EVENT_FLAG_TERMINATE = 0x10
+};
+typedef enum cp_sta_core_event_flag_t cp_sta_core_event_flag_t;
+
+/** Definition of alarm info structure
+ * (applications should not use it directly but use "alias" defined just below) */
+struct cp_sta_core_timed_event_def_t
+{
+ /* eCos alarm. */
+ uint alarm;
+ /* eCos alarm handle. */
+ uint alarm_handle;
+ /* the sta core event flag to set
+ * (auto or user-specified when creating/launching timer alarm). */
+ cp_sta_core_event_flag_t event_flag;
+ /* FSM event specified when creating/launching timer alarm
+ * (set if the previous flag is CP_STA_CORE_EVENT_FLAG_FSM). */
+ cp_fsm_event_t *fsm_event;
+ /* flag indicating a periodic alarm (if set to true)
+ * or one-shot alarm (if set to false). */
+ bool cyclic_alarm;
+ /* pointer to CP context. */
+ cp_t *cp_ctx;
+};
+typedef struct cp_sta_core_timed_event_def_t cp_sta_core_timed_event_def_t;
+
+#endif /* cp_sta_core_defs_h */
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/actions-override/cyg/kernel/kapi.h b/cesar/cp/eoc/multi_sta/action/test/utest/actions-override/cyg/kernel/kapi.h
new file mode 100644
index 0000000000..019e5d3a07
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/actions-override/cyg/kernel/kapi.h
@@ -0,0 +1,37 @@
+#ifndef override_cyg_kernel_kapi_h
+#define override_cyg_kernel_kapi_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2010 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file override/cyg/kernel/kapi.h
+ * \brief override some kernel api from <cyg/kernel/kapi.h>.
+ * \ingroup cp_msg
+ *
+ *
+ */
+
+struct cyg_resolution_t
+{
+ u32 dividend;
+ u32 divisor;
+} ;
+
+typedef struct cyg_resolution_t cyg_resolution_t;
+
+typedef u64 cyg_tick_count_t;
+
+int
+cyg_real_time_clock (void);
+
+cyg_resolution_t
+cyg_clock_get_resolution (int clock);
+
+cyg_tick_count_t
+cyg_current_time (void);
+
+#endif
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/fsm-Config b/cesar/cp/eoc/multi_sta/action/test/utest/fsm-Config
new file mode 100644
index 0000000000..4e2aa9e19f
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/fsm-Config
@@ -0,0 +1,13 @@
+CONFIG_CP_EOC = y
+CONFIG_DEBUG_FATAL_CATCH = y
+CONFIG_CP_EOC_MULTI_STA_FSM_DEF="cp/eoc/multi_sta_fsm/src/fsm/multi_sta.fsm"
+CONFIG_CP_EOC_IS_MASTER = y
+CONFIG_CP_FSM_DEF = "cp/eoc/fsm/src/fsm/cp_eoc_cco.fsm"
+CONFIG_MAC_PBPROC_EOC_FC = y
+CONFIG_CP_EOC_SCHEDULER = y
+CONFIG_MAC_COMMON_EOC_SCHED = y
+CONFIG_MAC_COMMON_EOC_TEI = y
+CONFIG_CP_STA_MGR_CCO_EOC = y
+CONFIG_CP_EOC_DBG_PRINT_LEVEL = 1
+CONFIG_RESTRACK = y
+CONFIG_CL_EOC_ROUTE = y
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/fsm-Makefile b/cesar/cp/eoc/multi_sta/action/test/utest/fsm-Makefile
new file mode 100644
index 0000000000..8bb820104e
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/fsm-Makefile
@@ -0,0 +1,25 @@
+BASE = ../../../../../..
+
+VARIANT = fsm
+
+DEFS = -DSTA_CORE_UNIT_TEST=1
+
+INCLUDES = cp/eoc/multi_sta/action/test/utest \
+ cp/eoc/multi_sta/action/test/utest/fsm-override
+
+HOST_PROGRAMS = test_fsm
+
+test_fsm_SOURCES = test_fsm.c actions.c cl_interf_stub.c\
+ hal_phy_stub.c cyg_stub.c cp_stub.c fsm_stub.c
+
+test_fsm_MODULES = lib lib/scenario \
+ cp/eoc/multi_sta_fsm cp/eoc/multi_sta/action/stub \
+ cp/eoc/sta/mgr cp/eoc/sta/action/stub cp/sta/core/stub \
+ cp/eoc/cco/action cp/eoc/cco/bw \
+ cp/eoc/fsm cp/eoc/msg mac/common cp/secu cp/eoc/beacon/stub \
+ mac/sar/stub mac/ca/stub interface/stub cl/stub ce/tx/stub \
+ bsu/stub bufmgr/stub mac/pbproc/stub ce/rx/stub
+
+test_fsm_CONFIG_MODULES = cl mac/sar cp/eoc
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/fsm-override/cp/inc/context.h b/cesar/cp/eoc/multi_sta/action/test/utest/fsm-override/cp/inc/context.h
new file mode 100644
index 0000000000..a869013f23
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/fsm-override/cp/inc/context.h
@@ -0,0 +1,94 @@
+#ifndef override_cp_inc_context_h
+#define override_cp_inc_context_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file override/cp/inc/context.h
+ * \brief Control plane context override.
+ * \ingroup test
+ */
+
+#include "cp/eoc/beacon/beacon.h"
+#include "cp/eoc/beacon/inc/beacon.h"
+#include "cp/fsm/fsm.h"
+#include "cp/fsm/inc/context.h"
+#include "cp/inc/trace.h"
+#include "cp/sta/mgr/sta_mgr.h"
+#include "cp/sta/mgr/inc/sta_mgr.h"
+#include "mac/common/config.h"
+#include "mac/common/store.h"
+#include "mac/sar/sar.h"
+#include "cl/cl.h"
+#include "cp/msg/inc/context.h"
+#include "lib/rnd.h"
+#include "interface/interface.h"
+#include "cp/sta/core/defs.h"
+#include "cp/sta/action/inc/context.h"
+#include "cp/cco/bw/bw.h"
+#include "cp/cco/bw/inc/context.h"
+#include "cp/eoc/cco/bw/inc/bw.h"
+#include "cp/cl_interf/cl_interf.h"
+#include "cp/cl_interf/inc/context.h"
+#include "cp/cl_interf/cl_interf.h"
+#include "cp/cl_interf/inc/context.h"
+#include "cp/eoc/cco/action/inc/cco_action.h"
+#include "cp/cco/action/inc/cco_action.h"
+#include "ce/tx/inc/tx.h"
+#include "bsu/aclf/aclf.h"
+#include "bufmgr/bufmgr.h"
+
+struct cp_t
+{
+#if CONFIG_TRACE
+ /** Trace context. */
+ trace_buffer_t trace;
+#endif /* CONFIG_TRACE */
+
+
+
+ /** FSM context. */
+ cp_fsm_t fsm;
+
+ /** STA core flag. */
+ bool sta_core_flag;
+ /** STA core urgent flag. */
+ bool sta_core_urgent_flag;
+ /** station manager context*/
+ cp_sta_mgr_t sta_mgr;
+ /** Mac store /dataplane */
+ mac_store_t *mac_store;
+ /** MAC config contest*/
+ mac_config_t *mac_config;
+ /** Convergence Layer context */
+ cl_t *cl;
+ /** Segmentation and reassembly context */
+ sar_t *sar;
+ /** PBProc. */
+ pbproc_t *pbproc;
+ /** Context of the aclf. */
+ bsu_aclf_t *bsu_aclf;
+
+ cp_beacon_t beacon;
+ cp_cco_bw_t bw;
+ cp_msg_t msg;
+ lib_rnd_t rnd;
+ interface_t *interface;
+ cp_sta_action_t sta_action;
+ cp_eoc_cco_bw_sched_t schedule;
+ ca_t *ca;
+ cp_cl_interf_t cl_interf;
+ cp_cco_action_t cco_action;
+ ce_tx_t ce_tx;
+ ce_rx_t *ce_rx;
+ /** BSU context. */
+ bsu_t *bsu;
+ /** Buffer manager. */
+ bufmgr_t *bufmgr;
+};
+
+#endif /* override_cp_inc_context_h */
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/fsm-override/cp/sta/core/core.h b/cesar/cp/eoc/multi_sta/action/test/utest/fsm-override/cp/sta/core/core.h
new file mode 100644
index 0000000000..57f7eee028
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/fsm-override/cp/sta/core/core.h
@@ -0,0 +1,53 @@
+#ifndef override_cp_sta_core_core_h
+#define override_cp_sta_core_core_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file override/cp/sta/core/core.h
+ * \brief STA Core override.
+ * \ingroup test
+ */
+
+#include "cp/inc/context.h"
+
+BEGIN_DECLS
+
+void
+cp_sta_core_signal_fsm_event (cp_t *ctx);
+
+void
+cp_sta_core_signal_fsm_urgent_event (cp_t *ctx);
+
+u32
+cp_sta_core_get_date_ms (cp_t *ctx);
+
+void
+cp_sta_core_checkpoint (cp_t *ctx);
+
+void
+cp_sta_core_signal_recv_mme_event(cp_t *cp_ctx);
+
+void
+cp_sta_core_gen_timed_event(cp_t *cp_ctx,
+ cp_sta_core_timed_event_def_t *sta_core_timed_event,
+ cp_fsm_event_t *fsm_event,
+ uint event_delay_ms);
+
+void
+cp_sta_core_stop_timed_or_cyclic_event(cp_t *cp_ctx,
+ cp_sta_core_timed_event_def_t *sta_core_timed_event);
+
+int
+cp_sta_core_ms_to_cyg_tick (cp_t *ctx, const uint ms);
+
+u32
+cp_sta_core_tck_per_rtc (cp_t *ctx);
+
+END_DECLS
+
+#endif /* override_cp_sta_core_core_h */
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/fsm-override/cp/sta/core/defs.h b/cesar/cp/eoc/multi_sta/action/test/utest/fsm-override/cp/sta/core/defs.h
new file mode 100644
index 0000000000..9698b44e93
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/fsm-override/cp/sta/core/defs.h
@@ -0,0 +1,57 @@
+#ifndef cp_sta_core_defs_h
+#define cp_sta_core_defs_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/core/defs.h
+ * \brief Sta core defs.
+ * \ingroup cp/sta/core
+ *
+ */
+#include "cp/fsm/forward.h"
+
+/** Forward declaration. */
+typedef struct cp_sta_core_t cp_sta_core_t;
+
+/*
+ * the sta core event flags
+ * these are some flags, so take care to give a value with all bits set to 0 but one.
+ */
+enum cp_sta_core_event_flag_t
+{
+ CP_STA_CORE_EVENT_FLAG_RECV_BEACON = 0x1,
+ CP_STA_CORE_EVENT_FLAG_RECV_MME = 0x2,
+ CP_STA_CORE_EVENT_FLAG_FSM = 0x4,
+ CP_STA_CORE_EVENT_FLAG_GARBAGE = 0x8,
+ CP_STA_CORE_EVENT_FLAG_TERMINATE = 0x10
+};
+typedef enum cp_sta_core_event_flag_t cp_sta_core_event_flag_t;
+
+/** Definition of alarm info structure
+ * (applications should not use it directly but use "alias" defined just below) */
+struct cp_sta_core_timed_event_def_t
+{
+ /* eCos alarm. */
+ uint alarm;
+ /* eCos alarm handle. */
+ uint alarm_handle;
+ /* the sta core event flag to set
+ * (auto or user-specified when creating/launching timer alarm). */
+ cp_sta_core_event_flag_t event_flag;
+ /* FSM event specified when creating/launching timer alarm
+ * (set if the previous flag is CP_STA_CORE_EVENT_FLAG_FSM). */
+ cp_fsm_event_t *fsm_event;
+ /* flag indicating a periodic alarm (if set to true)
+ * or one-shot alarm (if set to false). */
+ bool cyclic_alarm;
+ /* pointer to CP context. */
+ cp_t *cp_ctx;
+};
+typedef struct cp_sta_core_timed_event_def_t cp_sta_core_timed_event_def_t;
+
+#endif /* cp_sta_core_defs_h */
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/fsm-override/cyg/kernel/kapi.h b/cesar/cp/eoc/multi_sta/action/test/utest/fsm-override/cyg/kernel/kapi.h
new file mode 100644
index 0000000000..019e5d3a07
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/fsm-override/cyg/kernel/kapi.h
@@ -0,0 +1,37 @@
+#ifndef override_cyg_kernel_kapi_h
+#define override_cyg_kernel_kapi_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2010 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file override/cyg/kernel/kapi.h
+ * \brief override some kernel api from <cyg/kernel/kapi.h>.
+ * \ingroup cp_msg
+ *
+ *
+ */
+
+struct cyg_resolution_t
+{
+ u32 dividend;
+ u32 divisor;
+} ;
+
+typedef struct cyg_resolution_t cyg_resolution_t;
+
+typedef u64 cyg_tick_count_t;
+
+int
+cyg_real_time_clock (void);
+
+cyg_resolution_t
+cyg_clock_get_resolution (int clock);
+
+cyg_tick_count_t
+cyg_current_time (void);
+
+#endif
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/inc/scenario_defs.h b/cesar/cp/eoc/multi_sta/action/test/utest/inc/scenario_defs.h
new file mode 100644
index 0000000000..e004a95476
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/inc/scenario_defs.h
@@ -0,0 +1,135 @@
+#ifndef inc_scenario_defs_h
+#define inc_scenario_defs_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file inc/scenario_defs.h
+ * \brief Scenario definitions.
+ * \ingroup test
+ */
+
+#include "cp/types.h"
+#include "cp/mme.h"
+#include "cp/eoc/multi_sta_fsm/fsm.h"
+
+/* Scenario globals. */
+#define SCENARIO_DEFS_GLOBALS \
+ cp_t *cp;
+
+/* Scenario actions. */
+#define SCENARIO_DEFS_ACTIONS \
+ post_and_process, \
+ post, \
+ trigger, \
+ post_urgent, \
+ process, \
+ process_urgent
+
+
+typedef struct
+{
+ cp_eoc_multi_sta_fsm_event_type_t type;
+ cp_sta_t *sta;
+} scenario_action_param_t;
+
+typedef scenario_action_param_t scenario_action_post_and_process_t;
+typedef scenario_action_param_t scenario_action_post_t;
+typedef scenario_action_param_t scenario_action_trigger_t;
+typedef scenario_action_param_t scenario_action_post_urgent_t;
+typedef scenario_action_param_t scenario_action_process_t;
+typedef scenario_empty_t scenario_action_process_urgent_t;
+
+void
+scenario_action_post_and_process_cb (scenario_globals_t *globals,
+ scenario_params_t *params);
+
+void
+scenario_action_post_cb (scenario_globals_t *globals,
+ scenario_params_t *params);
+
+void
+scenario_action_trigger_cb (scenario_globals_t *globals,
+ scenario_params_t *params);
+
+void
+scenario_action_post_urgent_cb (scenario_globals_t *globals,
+ scenario_params_t *params);
+
+void
+scenario_action_process_cb (scenario_globals_t *globals,
+ scenario_params_t *params);
+
+void
+scenario_action_process_urgent_cb (scenario_globals_t *globals,
+ scenario_params_t *params);
+
+/* Scenario events. */
+
+#define SCENARIO_DEFS_EVENTS \
+ cp_eoc_multi_sta_fsm_handled_event,\
+ cp_eoc_multi_sta_fsm__unassociated__timeout_assoc,\
+ cp_eoc_multi_sta_fsm__associated__CC_GET_KEY_REQ,\
+ cp_eoc_multi_sta_fsm__associated__timeout_auth,\
+ cp_eoc_multi_sta_fsm__associated__cc_leave,\
+ cp_eoc_multi_sta_fsm__authenticated__cc_leave,\
+ cp_eoc_multi_sta_fsm__authenticated__CC_SLEEP_ENTER_REQ,\
+ cp_eoc_multi_sta_fsm__authenticated__lost_connection,\
+ cp_eoc_multi_sta_fsm__sleep_authenticated__lost_connection,\
+ cp_eoc_multi_sta_fsm__sleep_authenticated__CC_SLEEP_EXIT_IND,\
+ cp_eoc_multi_sta_fsm__disconnected__CC_ASSOC_REQ,\
+ cp_eoc_multi_sta_fsm__unassociated__CC_ASSOC_REQ
+
+
+typedef struct
+{
+ cp_eoc_multi_sta_fsm_branch_t branch;
+ cp_sta_t *sta;
+} scenario_event_transition_with_branch_t;
+
+
+typedef scenario_event_transition_with_branch_t
+scenario_event_cp_eoc_multi_sta_fsm__disconnected__CC_ASSOC_REQ_t;
+
+typedef scenario_event_transition_with_branch_t
+scenario_event_cp_eoc_multi_sta_fsm__associated__CC_GET_KEY_REQ_t;
+
+typedef scenario_empty_t
+scenario_event_cp_eoc_multi_sta_fsm_handled_event_t;
+
+typedef scenario_empty_t
+scenario_event_cp_eoc_multi_sta_fsm__unassociated__timeout_assoc_t;
+
+
+typedef scenario_empty_t
+scenario_event_cp_eoc_multi_sta_fsm__unassociated__CC_ASSOC_REQ_t;
+
+typedef scenario_empty_t
+scenario_event_cp_eoc_multi_sta_fsm__associated__timeout_auth_t;
+
+typedef scenario_empty_t
+scenario_event_cp_eoc_multi_sta_fsm__associated__cc_leave_t;
+
+typedef scenario_empty_t
+scenario_event_cp_eoc_multi_sta_fsm__authenticated__cc_leave_t;
+
+typedef scenario_empty_t
+scenario_event_cp_eoc_multi_sta_fsm__authenticated__CC_SLEEP_ENTER_REQ_t;
+
+typedef scenario_empty_t
+scenario_event_cp_eoc_multi_sta_fsm__authenticated__lost_connection_t;
+
+typedef scenario_empty_t
+scenario_event_cp_eoc_multi_sta_fsm__sleep_authenticated__lost_connection_t;
+
+typedef scenario_empty_t
+scenario_event_cp_eoc_multi_sta_fsm__sleep_authenticated__CC_SLEEP_EXIT_IND_t;
+
+
+
+
+#endif /* inc_scenario_defs_h */
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/src/actions.c b/cesar/cp/eoc/multi_sta/action/test/utest/src/actions.c
new file mode 100644
index 0000000000..6438b5e34e
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/src/actions.c
@@ -0,0 +1,41 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/actions.c
+ * \brief Scenario actions.
+ * \ingroup test
+ */
+#include "common/std.h"
+#include "lib/scenario/scenario.h"
+#include "cp/inc/context.h"
+#include "cp/eoc/multi_sta_fsm/fsm.h"
+#include "cp/eoc/multi_sta_fsm/inc/events.h"
+#include "cp/inc/context.h"
+
+
+static cp_eoc_multi_sta_fsm_event_t event;
+
+static
+cp_eoc_multi_sta_fsm_event_t *scenario_action_make_event (cp_t *cp,
+scenario_action_param_t *ap)
+{
+
+ cp_eoc_multi_sta_fsm_event_t *e = &event;
+ cp_eoc_multi_sta_fsm_event_new (cp, ap->type, e);
+ return e;
+}
+
+void
+scenario_action_process_cb (scenario_globals_t *globals,
+ scenario_params_t *params)
+{
+ scenario_action_process_t *p = (scenario_action_process_t*)params;
+ cp_eoc_multi_sta_fsm_handled_event (globals->cp, p->sta,
+ scenario_action_make_event(globals->cp, p));
+}
+
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/src/actions_stub.c b/cesar/cp/eoc/multi_sta/action/test/utest/src/actions_stub.c
new file mode 100644
index 0000000000..b76f3f7754
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/src/actions_stub.c
@@ -0,0 +1,81 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/actions_stub.c
+ * \brief Override Multi STA FSM tables.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "lib/scenario/scenario.h"
+
+
+void
+cp_eoc_multi_sta_fsm__unassociated__CC_ASSOC_REQ(cp_t *ctx);
+
+void
+cp_eoc_multi_sta_fsm__unassociated__timeout_assoc(cp_t *ctx);
+
+void
+cp_eoc_multi_sta_fsm__associated__CC_GET_KEY_REQ(cp_t *ctx);
+
+void
+cp_eoc_multi_sta_fsm__associated__timeout_auth(cp_t *ctx);
+
+void
+cp_eoc_multi_sta_fsm__associated__cc_leave(cp_t *ctx);
+
+void
+cp_eoc_multi_sta_fsm__authenticated__cc_leave(cp_t *ctx);
+
+void
+cp_eoc_multi_sta_fsm__authenticated__CC_SLEEP_ENTER_REQ(cp_t *ctx);
+
+void
+cp_eoc_multi_sta_fsm__authenticated__lost_connection(cp_t *ctx);
+
+void
+cp_eoc_multi_sta_fsm__sleep_authenticated__lost_connection(cp_t *ctx);
+
+void
+cp_eoc_multi_sta_fsm__sleep_authenticated__CC_SLEEP_EXIT_IND(cp_t *ctx);
+
+void
+cp_eoc_multi_sta_action__assoc_req(cp_t *ctx,cp_mme_rx_t *mme);
+
+void
+cp_sta_action_vs__started__vs_get_tonemap_req (cp_t *ctx, cp_mme_rx_t *mme_rx);
+
+void
+cp_eoc_multi_sta_action__get_key_req(cp_t *ctx,cp_mme_rx_t *mme);
+
+void
+cp_sta_action_process_cm_sta_cap_req (cp_t *ctx, cp_mme_rx_t *rx_mme)
+{
+}
+
+void
+cp_sta_action_process_cm_nw_info_req (cp_t *ctx, cp_mme_rx_t *rx_mme)
+{
+}
+
+void
+cp_sta_action_process_cm_nw_stats_req (cp_t *ctx, cp_mme_rx_t *rx_mme)
+{
+}
+
+void
+cp_sta_action_process_cm_link_stats_req (cp_t *ctx, cp_mme_rx_t *rx_mme)
+{
+}
+
+
+void
+cp_eoc_cco_action_vs__cco__vs_set_out_lev_ind (cp_t *ctx, cp_mme_peer_t *peer)
+{
+}
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/src/beacon_stub.c b/cesar/cp/eoc/multi_sta/action/test/utest/src/beacon_stub.c
new file mode 100644
index 0000000000..123dcb9f0b
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/src/beacon_stub.c
@@ -0,0 +1,30 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/beacon_stub.c
+ * \brief Beacon stub.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "cp/beacon/beacon.h"
+
+#include "lib/scenario/scenario.h"
+
+
+void
+cp_beacon_deactivate (cp_t *ctx)
+{
+
+}
+
+void
+cp_beacon_poweron_init (cp_t *ctx)
+{
+
+}
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/src/cl_interf_stub.c b/cesar/cp/eoc/multi_sta/action/test/utest/src/cl_interf_stub.c
new file mode 100644
index 0000000000..910786a8a5
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/src/cl_interf_stub.c
@@ -0,0 +1,44 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2012 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eoc/cco/action/test/utest3/src/cl_interf_stub.c
+ * \brief « brief description »
+ * \ingroup cp_eoc_cco_action_test_utest3
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+#include "cp/mme.h"
+
+static u8 buffer[2048];
+
+u8 *
+cp_cl_interf_get_buffer_tx (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ return buffer;
+}
+
+/**
+ * Send a MME over the PWL or the HLE.
+ * \param ctx the module context.
+ * \param mme The MME to send.
+ *
+ */
+void
+cp_cl_interf_mme_send (cp_t *ctx, cp_mme_tx_t * mme)
+{
+ mme->p_mme = NULL;
+}
+
+void
+cp_cl_interf_init (cp_t *ctx)
+{
+ dbg_assert (ctx);
+}
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/src/cp_eoc_sta_misc_stub.c b/cesar/cp/eoc/multi_sta/action/test/utest/src/cp_eoc_sta_misc_stub.c
new file mode 100644
index 0000000000..0c7a2e5520
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/src/cp_eoc_sta_misc_stub.c
@@ -0,0 +1,23 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eoc/cco/action/test/utest/src/cp_eoc_sta_misc_stub.c
+ * \brief STA action, miscellaneous definitions.
+ * \ingroup cp_sta_action
+ */
+ #include "common/std.h"
+ #include "cp/inc/context.h"
+ #include "cp/msg/msg.h"
+
+void
+cp_eoc_sta_mgr_get_ports (cp_t *ctx, uint *numStas, mac_t *stas_macs, bool stas_port_ed[][PORT_NB],
+ u8 stas_port_service[][PORT_NB])
+{
+
+}
+
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/src/cp_stub.c b/cesar/cp/eoc/multi_sta/action/test/utest/src/cp_stub.c
new file mode 100644
index 0000000000..edf5563e27
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/src/cp_stub.c
@@ -0,0 +1,59 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2009 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file eoc/sta/action/test/utest/src/cp_stub.c
+ * \brief cp/cp.c stub
+ * \ingroup test
+ *
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+#include "cp/mme.h"
+#include "cp/inc/context.h"
+#include "cp/msg/inc/cc_assoc.h"
+#include "cp/sta/mgr/inc/sta.h"
+#include "cp/eoc/sta/mgr/sta_mgr.h"
+
+/**
+ * Compute the NID and the NMK from the network password.
+ * \param ctx the CP context.
+ * \param npw the network password.
+ * \param sl the security level of the station.
+ *
+ * This function will generate the NID and the NMK from the NPW and store it
+ * in the station own data.
+ */
+void
+cp_compute_nmk_and_nid_from_npw (cp_t *ctx, const char *npw,
+ cp_security_level_t sl)
+{
+ u64 nid;
+ cp_key_t nmk;
+ uint length;
+
+ dbg_assert (ctx);
+ dbg_assert (npw);
+
+ length = strlen (npw);
+
+ nmk = cp_secu_npw2nmk (ctx, (const u8*) npw, length);
+ nid = cp_secu_nmk2nid (ctx, nmk, sl);
+
+ /* Store the nid and the nmk to the station own data. */
+ cp_sta_own_data_set_nid (ctx, nid);
+ cp_sta_own_data_set_nmk (ctx, nmk,
+ CP_MSG_DRV_STA_SET_KEY_TYPE_CHANGE_NID);
+}
+
+u32
+cp_sta_core_get_date_ms (cp_t *ctx)
+{
+ static uint time=0;
+ time+=2000;
+ return time;
+}
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/src/cyg_stub.c b/cesar/cp/eoc/multi_sta/action/test/utest/src/cyg_stub.c
new file mode 100644
index 0000000000..f9f9784e0e
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/src/cyg_stub.c
@@ -0,0 +1,40 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2012 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/cyg_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+#include "bsu/aclf/aclf.h"
+#include <cyg/kernel/kapi.h>
+
+#define BSU_ACLF_BP_CABLE_TCK 2500000
+#define TCK_PER_RTC 250000
+
+u32
+cp_sta_core_tck_per_rtc (cp_t *ctx)
+{
+ return TCK_PER_RTC;
+}
+
+u32
+bsu_aclf_beacon_period_tck (bsu_aclf_t *ctx)
+{
+ return BSU_ACLF_BP_CABLE_TCK;
+}
+
+cyg_tick_count_t
+cyg_current_time (void)
+{
+ /* For tests purpose we can simulate 1000 beacon periods */
+ return (u32)((BSU_ACLF_BP_CABLE_TCK * 1000ull) / TCK_PER_RTC);
+}
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/src/dataplane_stub.c b/cesar/cp/eoc/multi_sta/action/test/utest/src/dataplane_stub.c
new file mode 100644
index 0000000000..e6cbb08815
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/src/dataplane_stub.c
@@ -0,0 +1,32 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/dataplane_stub.c
+ * \brief Data plane layers stub.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "cl/cl_mactotei.h"
+#include "mac/pbproc/pbproc.h"
+#include "cp/inc/context.h"
+#include "mac/sar/inc/context.h"
+
+void
+sar_sta_remove (sar_t *ctx, u8 tei)
+{
+ if (MAC_TEI_IS_STA (tei))
+ {
+ bool ok;
+ ok = mac_store_sta_remove (ctx->mac_store, tei);
+
+ dbg_assert (ok);
+ }
+}
+
+
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/src/fsm_stub.c b/cesar/cp/eoc/multi_sta/action/test/utest/src/fsm_stub.c
new file mode 100644
index 0000000000..5fb2316451
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/src/fsm_stub.c
@@ -0,0 +1,201 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/fsm_stub.c
+ * \brief Override Multi STA FSM tables.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "lib/scenario/scenario.h"
+
+#include "cp/eoc/multi_sta_fsm/fsm.h"
+#include "cp/eoc/multi_sta_fsm/inc/tables.h"
+
+
+void
+cp_eoc_multi_sta_fsm__unassociated__CC_ASSOC_REQ(cp_t *ctx);
+
+void
+cp_eoc_multi_sta_fsm__unassociated__timeout_assoc(cp_t *ctx);
+
+void
+cp_eoc_multi_sta_fsm__associated__timeout_auth(cp_t *ctx);
+
+void
+cp_eoc_multi_sta_fsm__associated__cc_leave(cp_t *ctx);
+
+void
+cp_eoc_multi_sta_fsm__authenticated__cc_leave(cp_t *ctx);
+
+void
+cp_eoc_multi_sta_fsm__authenticated__CC_SLEEP_ENTER_REQ(cp_t *ctx);
+
+void
+cp_eoc_multi_sta_fsm__authenticated__lost_connection(cp_t *ctx);
+
+void
+cp_eoc_multi_sta_fsm__sleep_authenticated__lost_connection(cp_t *ctx);
+
+void
+cp_eoc_multi_sta_fsm__sleep_authenticated__CC_SLEEP_EXIT_IND(cp_t *ctx);
+
+void
+cp_eoc_multi_sta_action__assoc_req(cp_t *ctx,cp_mme_rx_t *mme);
+
+void
+cp_eoc_multi_sta_action__get_key_req(cp_t *ctx,cp_mme_rx_t *mme);
+
+void
+cp_sta_action_vs__started__vs_get_tonemap_req (cp_t *ctx, cp_mme_rx_t *mme_rx);
+
+void
+cp_sta_action_process_cm_sta_cap_req (cp_t *ctx, cp_mme_rx_t *rx_mme);
+
+void
+cp_sta_action_process_cm_nw_info_req (cp_t *ctx, cp_mme_rx_t *rx_mme);
+
+void
+cp_sta_action_vs__started__vs_get_snr_req (cp_t *ctx, cp_mme_rx_t *mme);
+
+void
+cp_sta_action_vs__started__vs_get_ce_stats_req (cp_t *ctx, cp_mme_rx_t *mme);
+
+void
+cp_sta_action_vs__started__vs_get_pb_stats_req (cp_t *ctx, cp_mme_rx_t *mme);
+
+void
+cp_sta_action_vs__started__vs_get_mactotei_req (cp_t *ctx, cp_mme_rx_t *mme);
+
+void
+cp_sta_action_process_cm_sta_cap_req (cp_t *ctx, cp_mme_rx_t *rx_mme)
+{
+}
+
+void
+cp_sta_action_process_cm_nw_info_req (cp_t *ctx, cp_mme_rx_t *rx_mme)
+{
+}
+
+void
+cp_sta_action_process_cm_nw_stats_req (cp_t *ctx, cp_mme_rx_t *rx_mme)
+{
+}
+
+void
+cp_sta_action_process_cm_link_stats_req (cp_t *ctx, cp_mme_rx_t *rx_mme)
+{
+}
+
+void
+cp_sta_action_vs__started__vs_get_stats_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+}
+
+void
+cp_eoc_multi_sta_action__assoc_req(cp_t *ctx,cp_mme_rx_t *mme)
+{
+ scenario_event (cp_eoc_multi_sta_fsm__disconnected__CC_ASSOC_REQ, param);
+ cp_eoc_multi_sta_fsm_branch_ (ctx, param->branch, param->sta);
+}
+
+
+void
+cp_eoc_multi_sta_action__get_key_req(cp_t *ctx,cp_mme_rx_t *mme)
+{
+ scenario_event (cp_eoc_multi_sta_fsm__associated__CC_GET_KEY_REQ, param);
+ cp_eoc_multi_sta_fsm_branch_ (ctx, param->branch, param->sta);
+}
+
+
+void
+cp_eoc_multi_sta_fsm__unassociated__CC_ASSOC_REQ(cp_t *ctx)
+{
+ scenario_event (cp_eoc_multi_sta_fsm__unassociated__CC_ASSOC_REQ);
+}
+
+void
+cp_eoc_multi_sta_fsm__unassociated__timeout_assoc(cp_t *ctx)
+{
+ scenario_event (cp_eoc_multi_sta_fsm__unassociated__timeout_assoc);
+}
+
+void
+cp_eoc_multi_sta_fsm__associated__CC_GET_KEY_REQ(cp_t *ctx)
+{
+ scenario_event(cp_eoc_multi_sta_fsm__associated__CC_GET_KEY_REQ);
+}
+
+void
+cp_eoc_multi_sta_fsm__associated__timeout_auth(cp_t *ctx)
+{
+ scenario_event(cp_eoc_multi_sta_fsm__associated__timeout_auth);
+}
+
+void
+cp_eoc_multi_sta_fsm__associated__cc_leave(cp_t *ctx)
+{
+ scenario_event(cp_eoc_multi_sta_fsm__associated__cc_leave);
+}
+
+void
+cp_eoc_multi_sta_fsm__authenticated__cc_leave(cp_t *ctx)
+{
+ scenario_event(cp_eoc_multi_sta_fsm__authenticated__cc_leave);
+}
+
+void
+cp_eoc_multi_sta_fsm__authenticated__CC_SLEEP_ENTER_REQ(cp_t *ctx)
+{
+ scenario_event(cp_eoc_multi_sta_fsm__authenticated__CC_SLEEP_ENTER_REQ);
+}
+
+void
+cp_eoc_multi_sta_fsm__authenticated__lost_connection(cp_t *ctx)
+{
+ scenario_event(cp_eoc_multi_sta_fsm__authenticated__lost_connection);
+}
+
+void
+cp_eoc_multi_sta_fsm__sleep_authenticated__lost_connection(cp_t *ctx)
+{
+ scenario_event(cp_eoc_multi_sta_fsm__sleep_authenticated__lost_connection);
+}
+
+
+void
+cp_eoc_multi_sta_fsm__sleep_authenticated__CC_SLEEP_EXIT_IND(cp_t *ctx)
+{
+ scenario_event
+ (cp_eoc_multi_sta_fsm__sleep_authenticated__CC_SLEEP_EXIT_IND);
+}
+
+void
+cp_sta_action_vs__started__vs_get_tonemap_req (cp_t *ctx, cp_mme_rx_t *mme_rx)
+{
+}
+
+void
+cp_sta_action_vs__started__vs_get_snr_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+}
+
+void
+cp_sta_action_vs__started__vs_get_ce_stats_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+}
+
+void
+cp_sta_action_vs__started__vs_get_pb_stats_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+}
+
+void
+cp_sta_action_vs__started__vs_get_mactotei_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+}
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/src/hal_phy_stub.c b/cesar/cp/eoc/multi_sta/action/test/utest/src/hal_phy_stub.c
new file mode 100644
index 0000000000..5e8eb8cc99
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/src/hal_phy_stub.c
@@ -0,0 +1,26 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2012 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/hal_phy_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "hal/phy/forward.h"
+
+void
+phy_tx_scale_adapt_exp_set (phy_t *ctx, u8 exp)
+{
+}
+
+void
+phy_tx_scale_adapt_set (phy_t *ctx, u16 value)
+{
+}
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/src/mgr_stub.c b/cesar/cp/eoc/multi_sta/action/test/utest/src/mgr_stub.c
new file mode 100644
index 0000000000..d6fe512dce
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/src/mgr_stub.c
@@ -0,0 +1,63 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2009 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file eoc/sta/action/test/utest/src/msg_stub.c
+ * \brief cp/sta/mgr/sta_mgr stub
+ * \ingroup test
+ *
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+#include "cp/mme.h"
+#include "cp/inc/context.h"
+#include "cp/msg/inc/cc_assoc.h"
+
+bool
+cp_msg_cc_assoc_cnf_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_msg_cc_assoc_cnf_t *data)
+{
+ dbg_assert (ctx);
+ return true;
+}
+
+void
+cp_msg_cc_assoc_cnf_send (cp_t *ctx, cp_mme_peer_t *peer,
+ const cp_msg_cc_assoc_cnf_t *data)
+{
+ dbg_assert (ctx);
+ dbg_assert (peer);
+ dbg_assert (data);
+}
+
+void
+cp_cco_action_tei_release (cp_t *ctx, u8 tei)
+{
+ dbg_assert (ctx);
+ dbg_assert (tei);
+}
+
+u32
+cp_sta_core_get_date_ms (cp_t *ctx)
+{
+ return 0;
+}
+
+void
+cp_sta_core_checkpoint (cp_t *ctx)
+{
+}
+
+void
+sar_activate (sar_t *ctx, bool activate)
+{
+}
+
+void
+pbproc_activate (pbproc_t *ctx, bool flag)
+{
+}
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/src/test_actions.c b/cesar/cp/eoc/multi_sta/action/test/utest/src/test_actions.c
new file mode 100644
index 0000000000..82c39ceb0c
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/src/test_actions.c
@@ -0,0 +1,284 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/test_actions.c
+ * \brief Test multi_sta module.
+ * \ingroup test
+ */
+
+#include "stdio.h"
+#include "common/std.h"
+#include "lib/blk.h"
+#include "lib/test.h"
+#include "cp/eoc/multi_sta/action/multi_sta_action.h"
+#include "cp/eoc/multi_sta_fsm/fsm.h"
+#include "cp/inc/context.h"
+#include "cp/inc/trace.h"
+#include "cp/sta/core/core.h"
+#include "cp/sta/mgr/inc/sta.h"
+#include "cp/msg/msg.h"
+#include "lib/test.h"
+#include "lib/utils.h"
+#include "lib/swap.h"
+#include "lib/slab.h"
+#include "cl/cl.h"
+#include "cl/inc/context.h"
+#include "mac/sar/inc/context.h"
+
+cp_t *
+test_cp_init (void)
+{
+ static cp_t cp;
+ static mac_config_t mac_config;
+ static sar_t sar;
+ static cl_t cl;
+
+ memset (&cp, 0, sizeof (cp));
+ memset (&mac_config, 0, sizeof (mac_config));
+ memset (&sar, 0, sizeof (sar));
+ memset (&cl, 0, sizeof (cl));
+
+ cl.mactotei = NULL;
+ cp.sar = &sar;
+ cp.cl = (cl_t *) &cl;
+ cp.mac_config = &mac_config;
+ cp.mac_store = mac_store_init ();
+ sar.mac_store = cp.mac_store;
+
+ cp_eoc_sta_mgr_init (&cp);
+ cp_msg_init (&cp);
+ cp_sta_own_data_init (&cp);
+ cp_cl_interf_init (&cp);
+ lib_rnd_init (&cp.rnd, 1234);
+ cp_trace_init (&cp);
+
+ return &cp;
+}
+
+void
+test_cp_uninit (cp_t *ctx)
+{
+ cp_sta_mgr_uninit (ctx);
+ cp_eoc_cco_action_uninit (ctx);
+ cp_beacon_uninit (ctx);
+#if CONFIG_TRACE
+ trace_buffer_dbg_dump (ctx->trace);
+#endif /* CONFIG_TRACE */
+ cp_trace_uninit (ctx);
+}
+
+void
+cp_eoc_cco_action_test_release_mac_store (cp_t *ctx)
+{
+ uint tei, i;
+ for (tei = MAC_TEI_STA_MIN_EOC; tei < MAC_TEI_STA_MAX; tei++)
+ {
+ mfs_t *mfs;
+ for (i = 0; i < MAC_CAP_NB; i++)
+ {
+ mfs = mac_store_mfs_get (ctx->mac_store, true, false, false,
+ MAC_LLID_MIN + i, tei);
+ if (mfs)
+ {
+ mac_store_mfs_remove (ctx->mac_store, mfs);
+ blk_release (mfs);
+ }
+ }
+ mfs = mac_store_mfs_get (ctx->mac_store, true, false, true,
+ MAC_LID_NONE, tei);
+ if (mfs)
+ {
+ mac_store_mfs_remove (ctx->mac_store, mfs);
+ blk_release (mfs);
+ }
+ }
+}
+
+void
+test_case_sta_assoc_procedure (test_t test)
+{
+ cp_sta_t *sta;
+
+ u8 buffer[1024];
+ uint req_type = CP_MSG_CC_ASSOC_REQ_TYPE_NEW;
+ cp_tei_t tei = 5;
+ cp_net_t *net;
+ cp_nid_t nid = 12;
+ cp_snid_t snid = 34;
+ uint cco_cap = 2;
+ uint pco_cap = true;
+ cp_mme_rx_t mme_rx;
+ bitstream_t bitstream;
+
+ cp_t *ctx = test_cp_init();
+
+ net = cp_sta_mgr_add_avln (ctx, 1, 1);
+ cp_sta_mgr_set_our_avln (ctx, net);
+
+ ctx->sta_mgr.our_avln->snid = snid;
+ ctx->sta_mgr.our_avln->nid = nid;
+
+ test_case_begin (test, "Receiving CC_ASSOC.REQ");
+
+ test_begin (test, "Test 1: Receiving a CC_ASSOC.REQ join")
+ {
+ /* Construct the MME to associate the first station. */
+ mme_rx.peer.mac = 2;
+ mme_rx.peer.eth_type = HPAV_MTYPE_MME;
+ mme_rx.peer.vlan_tci = 0x0;
+ mme_rx.peer.tei = 0;
+
+ DBG_PRINT ("Receiving a CC_ASSOC.REQ join ENTERED");
+
+ /* Write the request. */
+ bitstream_init (&mme_rx.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+ bitstream_init (&bitstream, buffer, sizeof (buffer), BITSTREAM_WRITE);
+ bitstream_access (&bitstream, &req_type, 8);
+ bitstream_access (&bitstream, &nid, 56);
+ bitstream_access (&bitstream, &cco_cap, 8);
+ bitstream_access (&bitstream, &pco_cap, 8);
+ bitstream_finalise (&bitstream);
+
+ /* Initialise the MME Rx object. */
+ mme_rx.p_mme = buffer;
+ mme_rx.length = 60;
+
+ sta = cp_sta_mgr_sta_add (ctx, net, tei, mme_rx.peer.mac);
+ dbg_assert (sta);
+ slab_release (sta);
+ cp_eoc_multi_sta_action__assoc_req (ctx, &mme_rx);
+
+ sta = cp_sta_mgr_sta_get_from_mac (ctx, mme_rx.peer.mac);
+ dbg_assert (sta);
+ slab_release (sta);
+
+ test_fail_unless (sta->fsm.state
+ == CP_EOC_MULTI_STA_FSM_STATE_associated);
+
+ cp_eoc_multi_sta_fsm_uninit (ctx, sta);
+ cp_eoc_cco_action_test_release_mac_store (ctx);
+ cp_sta_mgr_sta_remove (ctx, sta);
+ }
+ test_end;
+
+ test_cp_uninit (ctx);
+}
+
+
+
+void
+test_case_sta_authentication (test_t test)
+{
+ test_case_begin (test, "Authentication status.");
+
+ cp_net_t *net;
+ bitstream_t bitstream;
+ cp_mme_rx_t mme;
+ u64 data;
+ u8 buffer[1024];
+ cp_sta_t *sta;
+
+ cp_t * ctx = test_cp_init ();
+ memset (&mme, 0, sizeof (cp_mme_rx_t));
+
+ /* Update the net NID and SNID. */
+ cp_sta_own_data_set_nid (ctx, 0x1);
+ cp_sta_own_data_set_snid (ctx, 0x2);
+
+ net = cp_sta_mgr_add_avln (ctx, 2, 1);
+ cp_sta_mgr_set_our_avln (ctx, net);
+ cp_sta_own_data_set_tei (ctx, 1);
+ cp_sta_own_data_set_cco_status (ctx, true);
+
+ sta = cp_sta_mgr_sta_add (ctx, net, 2, 2);
+ dbg_assert (sta);
+ slab_release (sta);
+ cp_sta_set_assoc_confirmed (ctx, sta, false);
+ cp_eoc_multi_sta_fsm_init (ctx,sta);
+ sta->fsm.state = CP_EOC_MULTI_STA_FSM_STATE_associated;
+
+
+ test_case_begin (test, "Sta authentication procedure");
+
+ test_begin (test, "assoc")
+ {
+ bitstream_init (&mme.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+
+ /* relayed. */
+ data = 0;
+ bitstream_access (&bitstream, &data, 8);
+ /* Request key type. */
+ data = CP_MSG_KEY_TEK;
+ bitstream_access (&bitstream, &data, 8);
+ /* NID. */
+ data = cp_net_get_nid (ctx, net);
+ bitstream_access (&bitstream, &data, 56);
+ /* Nonce. */
+ data = 0xc;
+ bitstream_access (&bitstream, &data, 32);
+ /* PID. */
+ data = 0;
+ bitstream_access (&bitstream, &data, 8);
+ /* prn. */
+ data = 0xA;
+ bitstream_access (&bitstream, &data, 16);
+ /* Pmn. */
+ data = 1;
+ bitstream_access (&bitstream, &data, 8);
+ bitstream_finalise (&bitstream);
+
+ mme.length = 0;
+ mme.peer.tei = 0x2;
+ mme.peer.mac = 2;
+ cp_secu_protocol_run_new (&mme.prun, 0, &ctx->rnd);
+
+ cp_eoc_multi_sta_action__get_key_req (ctx, &mme);
+ sta = cp_sta_mgr_sta_get_from_mac(ctx, mme.peer.mac);
+ test_fail_unless (sta->fsm.state
+ == CP_EOC_MULTI_STA_FSM_STATE_authenticated);
+
+ slab_release (sta);
+ cp_sta_mgr_sta_remove (ctx, sta);
+ }
+ test_end;
+
+ test_cp_uninit (ctx);
+}
+
+
+void
+test_action_test_suite (test_t t)
+{
+ test_suite_begin (t, "multi_sta fsm");
+ test_case_sta_assoc_procedure (t);
+ test_case_sta_authentication(t);
+}
+
+int
+main (int argc, char **argv)
+{
+ test_t t;
+ lib_stats_init();
+ trace_init ();
+ test_init (t, argc, argv);
+ test_action_test_suite (t);
+ trace_uninit ();
+ lib_stats_uninit();
+ test_case_begin (t, "Memory allocation");
+ test_begin (t, "memory leaks")
+ {
+ test_fail_if (blk_check_memory () != true, "Memory leaks");
+ }
+ test_end;
+ test_result (t);
+ return test_nb_failed (t) == 0 ? 0 : 1;
+}
diff --git a/cesar/cp/eoc/multi_sta/action/test/utest/src/test_fsm.c b/cesar/cp/eoc/multi_sta/action/test/utest/src/test_fsm.c
new file mode 100644
index 0000000000..befe1715a7
--- /dev/null
+++ b/cesar/cp/eoc/multi_sta/action/test/utest/src/test_fsm.c
@@ -0,0 +1,125 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/test_fsm.c
+ * \brief Test multi_sta module.
+ * \ingroup test
+ */
+
+#include "stdio.h"
+#include "common/std.h"
+#include "lib/blk.h"
+#include "lib/test.h"
+#include "lib/scenario/scenario.h"
+#include "cp/eoc/multi_sta_fsm/fsm.h"
+#include "cp/inc/context.h"
+#include "cp/sta/core/core.h"
+#include "cp/msg/msg.h"
+#include "lib/test.h"
+#include "lib/utils.h"
+#include "lib/swap.h"
+#include "lib/slab.h"
+
+
+void
+test_fsm_basic_test_case (test_t t)
+{
+ test_case_begin (t, "basic");
+ cp_t cp;
+ cp_sta_t sta;
+ cp.sta_core_urgent_flag = false;
+ cp_trace_init (&cp);
+
+ test_begin (t, "Disconnected-Authenticated")
+ {
+ cp_eoc_multi_sta_fsm_init (&cp, &sta);
+ cp.sta_core_flag = false;
+ scenario_entry_t entries[] = {
+ /* Disconnected */
+ SCENARIO_ACTION (process,
+ .type = CP_EOC_MULTI_STA_FSM_EVENT_TYPE_CC_ASSOC_REQ,
+ .sta = &sta),
+
+ SCENARIO_EVENT (cp_eoc_multi_sta_fsm__disconnected__CC_ASSOC_REQ,
+ .sta = &sta,
+ .branch =
+ CP_EOC_MULTI_STA_FSM_BRANCH(disconnected, CC_ASSOC_REQ, sta_in_wl)), //state, event, branch
+
+
+
+
+ SCENARIO_ACTION (process,
+ .type = CP_EOC_MULTI_STA_FSM_EVENT_TYPE_CC_GET_KEY_REQ,
+ .sta = &sta),
+
+ SCENARIO_EVENT (cp_eoc_multi_sta_fsm__associated__CC_GET_KEY_REQ,
+ .sta = &sta,
+ .branch =
+ CP_EOC_MULTI_STA_FSM_BRANCH(associated, CC_GET_KEY_REQ, all_keys_granted)),
+
+ SCENARIO_END
+ };
+
+
+ scenario_globals_t globals = {
+ .cp = &cp,
+ };
+ scenario_run (t, entries, &globals);
+
+ test_fail_unless (sta.fsm.state == CP_EOC_MULTI_STA_FSM_STATE_authenticated);
+
+ cp_eoc_multi_sta_fsm_uninit (&cp, &sta);
+ } test_end;
+
+
+
+#if CONFIG_TRACE
+ trace_buffer_dbg_dump (&cp.trace);
+#endif /* CONFIG_TRACE */
+ cp_trace_uninit (&cp);
+}
+
+void
+test_fsm_test_suite (test_t t)
+{
+ test_suite_begin (t, "multi_sta fsm");
+ test_fsm_basic_test_case (t);
+}
+
+void
+cp_sta_core_signal_fsm_event (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ ctx->sta_core_flag = true;
+}
+
+void
+cp_sta_core_signal_fsm_urgent_event (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ ctx->sta_core_urgent_flag = true;
+}
+
+int
+main (int argc, char **argv)
+{
+ test_t t;
+ trace_init ();
+ test_init (t, argc, argv);
+ test_fsm_test_suite (t);
+ trace_uninit ();
+ test_case_begin (t, "Memory allocation");
+ test_begin (t, "memory leaks")
+ {
+ test_fail_if (blk_check_memory () != true, "Memory leaks");
+ }
+ test_end;
+ test_result (t);
+ return test_nb_failed (t) == 0 ? 0 : 1;
+}
+