summaryrefslogtreecommitdiff
path: root/cesar/cp/eoc/sta
diff options
context:
space:
mode:
authorThierry Carré2012-05-10 17:15:36 +0200
committerThierry Carré2012-05-10 17:16:26 +0200
commit8b2d7432b331ef2e7f3a2f8ffb3a6a6f1430e5a6 (patch)
tree4eec786dc73c4cb305edabc5600cf0234bf10e56 /cesar/cp/eoc/sta
parent4986c1b1af05da71301b8990e53e885d16ee907a (diff)
parent4847312bc9ff6cabc1a528233d8ac41f98149c64 (diff)
Merge branch 't2928' into eoc, closes #2928
Good luck to understand all modifications done on 3 months. But no functions have been modified in their behaviors. They have been only renamed or moved from file to another file.
Diffstat (limited to 'cesar/cp/eoc/sta')
-rw-r--r--cesar/cp/eoc/sta/action/Module8
-rw-r--r--cesar/cp/eoc/sta/action/action.h21
-rw-r--r--cesar/cp/eoc/sta/action/assoc.h205
-rw-r--r--cesar/cp/eoc/sta/action/assoc_slave.h237
-rw-r--r--cesar/cp/eoc/sta/action/bridge.h32
-rw-r--r--cesar/cp/eoc/sta/action/cco_action.h0
-rw-r--r--cesar/cp/eoc/sta/action/drv.h77
-rw-r--r--cesar/cp/eoc/sta/action/inc/assoc.h45
-rw-r--r--cesar/cp/eoc/sta/action/inc/vs.h35
-rw-r--r--cesar/cp/eoc/sta/action/misc.h31
-rw-r--r--cesar/cp/eoc/sta/action/poweron.h20
-rw-r--r--cesar/cp/eoc/sta/action/sleep.h60
-rw-r--r--cesar/cp/eoc/sta/action/src/action.c24
-rw-r--r--cesar/cp/eoc/sta/action/src/assoc.c680
-rw-r--r--cesar/cp/eoc/sta/action/src/assoc_slave.c657
-rw-r--r--cesar/cp/eoc/sta/action/src/cco_stub.c147
-rw-r--r--cesar/cp/eoc/sta/action/src/drv.c330
-rw-r--r--cesar/cp/eoc/sta/action/src/misc.c121
-rw-r--r--cesar/cp/eoc/sta/action/src/poweron.c61
-rw-r--r--cesar/cp/eoc/sta/action/src/sleep.c36
-rw-r--r--cesar/cp/eoc/sta/action/src/vs.c (renamed from cesar/cp/eoc/sta/action/src/vs_eoc.c)131
-rw-r--r--cesar/cp/eoc/sta/action/stub/Module8
-rw-r--r--cesar/cp/eoc/sta/action/stub/src/action.c15
-rw-r--r--cesar/cp/eoc/sta/action/stub/src/assoc.c26
-rw-r--r--cesar/cp/eoc/sta/action/stub/src/assoc_slave.c181
-rw-r--r--cesar/cp/eoc/sta/action/stub/src/bridge.c43
-rw-r--r--cesar/cp/eoc/sta/action/stub/src/drv.c156
-rw-r--r--cesar/cp/eoc/sta/action/stub/src/poweron.c22
-rw-r--r--cesar/cp/eoc/sta/action/stub/src/vs.c38
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/actions-Config7
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/actions-Makefile36
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/actions-override/cp/inc/context.h10
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/actions-override/cyg/kernel/kapi.h37
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/fsm-Config8
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/fsm-Makefile16
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/inc/scenario_defs.h133
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/src/actions.c1
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/src/actions_stub.c178
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/src/beacon_stub.c36
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/src/bw_stub.c28
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/src/ce_stub.c24
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/src/cl_interf_stub.c44
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/src/cp_stub.c1
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/src/cyg_stub.c39
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/src/dataplane_stub.c28
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/src/fsm_stub.c129
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/src/msg_stub.c478
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/src/pb_proc_stub.c44
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/src/test_actions.c173
-rw-r--r--cesar/cp/eoc/sta/action/test/utest2/Config (renamed from cesar/cp/eoc/sta/action/test/utest_eoc/Config)5
-rw-r--r--cesar/cp/eoc/sta/action/test/utest2/Makefile18
-rw-r--r--cesar/cp/eoc/sta/action/test/utest2/override/cp/inc/context.h (renamed from cesar/cp/eoc/sta/action/test/utest_eoc/assoc-override/cp/inc/context.h)6
-rw-r--r--cesar/cp/eoc/sta/action/test/utest2/override/cp/sta/core/core.h (renamed from cesar/cp/eoc/sta/action/test/utest_eoc/assoc-override/cp/sta/core/core.h)0
-rw-r--r--cesar/cp/eoc/sta/action/test/utest2/override/mac/sar/inc/context.h (renamed from cesar/cp/eoc/sta/action/test/utest_eoc/assoc-override/mac/sar/inc/sar_context.h)13
-rw-r--r--cesar/cp/eoc/sta/action/test/utest2/src/assoc.c (renamed from cesar/cp/eoc/sta/action/test/utest_eoc/src/assoc.c)0
-rw-r--r--cesar/cp/eoc/sta/action/test/utest2/src/core_stub.c (renamed from cesar/cp/eoc/sta/action/test/utest_eoc/src/core_stub.c)0
-rw-r--r--cesar/cp/eoc/sta/action/test/utest2/src/cp_stub.c (renamed from cesar/cp/eoc/sta/action/test/utest_eoc/src/cp_stub.c)0
-rw-r--r--cesar/cp/eoc/sta/action/test/utest2/src/mgr_stub.c (renamed from cesar/cp/eoc/sta/action/test/utest_eoc/src/mgr_stub.c)39
-rw-r--r--cesar/cp/eoc/sta/action/test/utest2/src/msg_stub.c (renamed from cesar/cp/eoc/sta/action/test/utest_eoc/src/msg_stub.c)0
-rw-r--r--cesar/cp/eoc/sta/action/test/utest2/src/phy_stub.c (renamed from cesar/cp/eoc/sta/action/test/utest_eoc/src/phy_stub.c)0
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/Makefile13
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/assoc-override/mac/sar/inc/context.h23
-rw-r--r--cesar/cp/eoc/sta/action/vs.h38
-rw-r--r--cesar/cp/eoc/sta/action/vs_eoc.h50
-rw-r--r--cesar/cp/eoc/sta/mgr/Module4
-rw-r--r--cesar/cp/eoc/sta/mgr/src/sta_mgr.c760
-rw-r--r--cesar/cp/eoc/sta/mgr/src/sta_own_data.c615
-rw-r--r--cesar/cp/eoc/sta/mgr/sta_mgr.h73
-rw-r--r--cesar/cp/eoc/sta/mgr/sta_own_data.h46
-rw-r--r--cesar/cp/eoc/sta/mgr/stub/Module3
-rw-r--r--cesar/cp/eoc/sta/mgr/stub/src/sta_mgr.c101
-rw-r--r--cesar/cp/eoc/sta/mgr/stub/src/sta_own_data.c48
-rw-r--r--cesar/cp/eoc/sta/mgr/test/Makefile13
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/Config (renamed from cesar/cp/eoc/sta/mgr/test/Config)3
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/Makefile14
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/doc/Makefile (renamed from cesar/cp/eoc/sta/mgr/test/doc/Makefile)0
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/doc/net.txt (renamed from cesar/cp/eoc/sta/mgr/test/doc/net.txt)0
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/doc/net_list.txt (renamed from cesar/cp/eoc/sta/mgr/test/doc/net_list.txt)0
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/doc/sta.txt (renamed from cesar/cp/eoc/sta/mgr/test/doc/sta.txt)0
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/doc/sta_mgr.txt (renamed from cesar/cp/eoc/sta/mgr/test/doc/sta_mgr.txt)0
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/doc/sta_own_data.txt (renamed from cesar/cp/eoc/sta/mgr/test/doc/sta_own_data.txt)0
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/override/cp/cco/action/inc/context.h (renamed from cesar/cp/eoc/sta/mgr/test/overide/cp/cco/action/inc/context.h)0
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/override/cp/inc/context.h (renamed from cesar/cp/eoc/sta/mgr/test/overide/cp/inc/context.h)6
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/override/cp/sta/core/core.h (renamed from cesar/cp/eoc/sta/mgr/test/overide/cp/sta/core/core.h)0
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/override/cp/sta/core/defs.h57
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/override/mac/sar/inc/context.h (renamed from cesar/cp/eoc/sta/mgr/test/overide/mac/sar/inc/context.h)0
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/src/core_stub.c (renamed from cesar/cp/eoc/sta/mgr/test/src/core_stub.c)0
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/src/net_test.c (renamed from cesar/cp/eoc/sta/mgr/test/src/net_test.c)14
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/src/sar_stub.c (renamed from cesar/cp/eoc/sta/mgr/test/src/sar_stub.c)0
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/src/sta-test.c (renamed from cesar/cp/eoc/sta/mgr/test/src/sta-test.c)42
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/src/sta_mgr.c (renamed from cesar/cp/eoc/sta/mgr/test/src/sta_mgr.c)363
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/src/station_test.c (renamed from cesar/cp/eoc/sta/mgr/test/src/station_test.c)2
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/src/test_sta_mgr.c (renamed from cesar/cp/eoc/sta/mgr/test/src/test_sta_mgr.c)14
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/test_sta_mgr.h (renamed from cesar/cp/eoc/sta/mgr/test/test_sta_mgr.h)14
94 files changed, 2522 insertions, 4772 deletions
diff --git a/cesar/cp/eoc/sta/action/Module b/cesar/cp/eoc/sta/action/Module
index b3c3b71307..e470bdd0e0 100644
--- a/cesar/cp/eoc/sta/action/Module
+++ b/cesar/cp/eoc/sta/action/Module
@@ -1 +1,7 @@
-SOURCES := action.c assoc.c sleep.c poweron.c drv.c cco_stub.c vs_eoc.c
+SOURCES := action.c poweron.c drv.c vs.c assoc.c
+
+ifeq ($(CONFIG_CP_EOC_IS_MASTER),n)
+ SOURCES += assoc_slave.c
+endif
+
+MODULES := cp/sta/action
diff --git a/cesar/cp/eoc/sta/action/action.h b/cesar/cp/eoc/sta/action/action.h
index 61594459a0..192602ccaf 100644
--- a/cesar/cp/eoc/sta/action/action.h
+++ b/cesar/cp/eoc/sta/action/action.h
@@ -9,21 +9,24 @@
* }}} */
/**
* \file cp/eoc/sta/action/action.h
- * \brief STA public functions.
- * \ingroup cp_eoc_sta
+ * \brief EoC STA public functions.
+ * \ingroup cp_eoc_sta_action
*
*/
-#include "cp/inc/context.h"
+#include "cp/sta/action/action.h"
-#include "cp/eoc/sta/action/sleep.h"
#include "cp/eoc/sta/action/assoc.h"
+#include "cp/eoc/sta/action/assoc_slave.h"
#include "cp/eoc/sta/action/poweron.h"
#include "cp/eoc/sta/action/drv.h"
-#include "cp/eoc/sta/action/bridge.h"
-#include "cp/eoc/sta/action/vs_eoc.h"
-#include "cp/sta/action/vs.h"
+#include "cp/eoc/sta/action/vs.h"
-void
-cp_sta_action_drv__drv_sta_get_key_req (cp_t *ctx, cp_mme_rx_t *mme);
+BEGIN_DECLS
+
+/* Declared in VARIANT :
+ * - cp_sta_action_init
+ */
+
+END_DECLS
#endif
diff --git a/cesar/cp/eoc/sta/action/assoc.h b/cesar/cp/eoc/sta/action/assoc.h
index e162f4c325..0549ffab1f 100644
--- a/cesar/cp/eoc/sta/action/assoc.h
+++ b/cesar/cp/eoc/sta/action/assoc.h
@@ -12,213 +12,14 @@
* \brief STA action, association related definitions.
* \ingroup cp_eoc_sta_action
*
- * Association/authentication
- * ==========================
- *
- * This part relates to association and authentication for a slave STA. A
- * state machine is used to handle the association status of the station:
- *
- * \image html assoc.png "Association state machine"
- *
*/
-#include "cp/sta/mgr/net.h"
BEGIN_DECLS
-/**
- * Start a association procedure.
- * \param ctx control plane context
- *
- * nd_beacon is detected, and association is triggered
+/* Declared in VARIANT :
+ * - cp_eoc_sta_action_assoc_init
+ * - cp_eoc_sta_action_assoc__start_retry_timer
*/
-void
-cp_eoc_sta_action_assoc__detecting_detected (cp_t *ctx);
-
-/**
- * Timeout occurred while station was in the detecting state.
- * \param ctx control plane context
- *
- */
-void
-cp_eoc_sta_action_assoc__detecting_timeout (cp_t *ctx);
-
-/**
- * Timeout occurred while station was in associating state.
- * \param ctx control plane context
- *
- */
-void
-cp_eoc_sta_action_assoc__associating_timeout (cp_t *ctx);
-
-/**
- * CC_ASSOC.CNF was received
- * \param ctx control plane context
- * \param mme received MME handle
- */
-void
-cp_eoc_sta_action_assoc__associating_cnf (cp_t *ctx, cp_mme_rx_t *mme);
-
-/**
- * Several beacons was not detected while station was in asscoiating state
- * \param ctx control plane context
- *
- */
-void
-cp_eoc_sta_action_assoc__associating_no_beacons (cp_t *ctx);
-
-/**
- * Handle UNASSOCIATED => DETECTING transition
- * \param ctx control plane context
- *
- */
-void
-cp_eoc_sta_action_assoc__unassociated_retry (cp_t *ctx);
-
-/**
- * GET_KEY.CNF was received
- * \param ctx control plane context
- * \param mme received MME handle
- */
-void
-cp_eoc_sta_action_assoc__associated_key_cnf (cp_t *ctx, cp_mme_rx_t *mme);
-
-/**
- * GET_KEY.CNF was received for TEK_KEY (used to authenticate station)
- * \param ctx control plane context
- * \param mme received MME handle
- */
-void
-cp_eoc_sta_action_auth__authenticated_key_cnf (cp_t *ctx, cp_mme_rx_t *mme);
-
-/**
- * CM_ENCRYPTED_PAYLOAD.RSP was received
- * \param ctx control plane context
- * \param mme received MME handle
- *
- */
-void
-cp_eoc_sta_action_assoc__associated_encrypt_payload_rsp (cp_t *ctx,
- cp_mme_rx_t *mme);
-
-/**
- * Several beacons was not detected while station was in asscoiated state
- * \param ctx control plane context
- *
- */
-void
-cp_eoc_sta_action_assoc__associated_no_beacons (cp_t *ctx);
-
-/**
- * Timeout during asscoiated state
- * \param ctx control plane context
- *
- */
-void
-cp_eoc_sta_action_assoc__associated_timeout (cp_t *ctx);
-
-/**
- * CC_LEAVE.IND was received while station in associated state
- * \param ctx control plane context
- * \param mme received MME handle
- *
- */
-void
-cp_eoc_sta_action_assoc__associated_leave (cp_t *ctx, cp_mme_rx_t *mme);
-
-/**
- * Several beacons was not detected while station was in authenticated
- * state
- * \param ctx control plane context
- *
- */
-void
-cp_eoc_sta_action_assoc__authenticated_no_beacons (cp_t *ctx);
-
-/**
- * CC_LEAVE.IND was received while station in authenticated state
- * \param ctx control plane context
- * \param mme received MME handle
- *
- */
-void
-cp_eoc_sta_action_assoc__authenticated_leave (cp_t *ctx, cp_mme_rx_t *mme);
-
-/**
- * Several beacons was not detected while station was in sleep
- * authenticated state
- * \param ctx control plane context
- *
- */
-void
-cp_eoc_sta_action_assoc__sleep_authenticated_no_beacons (cp_t *ctx);
-
-void
-cp_eoc_sta_action_assoc__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
- cp_net_t *net, cp_sta_t *sta);
-void
-cp_eoc_sta_action_detect__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
- cp_net_t *net, cp_sta_t *sta);
-
-void
-cp_eoc_sta_action_auth__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
- cp_net_t *net, cp_sta_t *sta);
-
-void
-cp_eoc_sta_action_assoc__beacon_not_received (cp_t *ctx);
-
-void
-cp_eoc_sta_action_sta_clear_status (cp_t *ctx);
-
-void
-cp_sta_action_unassoc__stop_retry_timer (cp_t *ctx);
-
-void
-cp_sta_action_unassoc__start_retry_timer (cp_t *ctx);
-
-void
-cp_sta_action_assoc__stop_retry_timer (cp_t *ctx);
-
-void
-cp_sta_action_assoc__start_retry_timer (cp_t *ctx);
-
-void
-cp_eoc_sta_action_auth__authenticated_set_key_req (cp_t *ctx,
- cp_mme_rx_t *mme);
-
-void
-cp_eoc_sta_action_auth__authenticated_set_out_lev (cp_t *ctx,
- cp_mme_rx_t *mme);
-
-/**
- * Several beacons were not detected while station was in
- * detecting beacon state
- * \param ctx control plane context
- *
- */
-void
-cp_eoc_sta_action_assoc__detecting_no_beacons (cp_t *ctx);
-
-/**
- * Several beacons were not detected while station was in
- * unassociated state
- * \param ctx control plane context
- *
- */
-void
-cp_eoc_sta_action_assoc__unassoc_no_beacons (cp_t *ctx);
-
-/**
- * BEACON was received while station was in unassociated state
- * \param ctx control plane context
- * \param beacon pointer to received beacon
- * \param net pointer to station's network
- * \param sta pointer to control plane station
- *
- */
-void
-cp_eoc_sta_action_unassoc__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
- cp_net_t *net, cp_sta_t *sta);
-
END_DECLS
diff --git a/cesar/cp/eoc/sta/action/assoc_slave.h b/cesar/cp/eoc/sta/action/assoc_slave.h
new file mode 100644
index 0000000000..a31447b059
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/assoc_slave.h
@@ -0,0 +1,237 @@
+#ifndef cp_eoc_sta_action_assoc_slave_h
+#define cp_eoc_sta_action_assoc_slave_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2009 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/eoc/action/assoc_slave.h
+ * \brief EoC STA Slave action, association related definitions.
+ * \ingroup cp_eoc_sta_action
+ *
+ * Association/authentication
+ * ==========================
+ *
+ * This part relates to association and authentication for a slave STA. A
+ * state machine is used to handle the association status of the station:
+ *
+ * \image html assoc.png "Association state machine"
+ *
+ */
+#include "cp/cp.h"
+#include "cp/mme.h"
+#include "cp/sta/mgr/sta.h"
+#include "cp/sta/mgr/net.h"
+
+BEGIN_DECLS
+
+/** Clear status of one station
+ * TODO
+ */
+void
+cp_eoc_sta_action_sta_clear_status (cp_t *ctx);
+
+/**
+ * Start a association procedure.
+ * \param ctx control plane context
+ *
+ * nd_beacon is detected, and association is triggered
+ */
+void
+cp_eoc_sta_action_assoc__detecting_detected (cp_t *ctx);
+
+/**
+ * Timeout occurred while station was in the detecting state.
+ * \param ctx control plane context
+ *
+ */
+void
+cp_eoc_sta_action_assoc__detecting_timeout (cp_t *ctx);
+
+/**
+ * TODO
+ */
+void
+cp_eoc_sta_action_detect__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
+ cp_net_t *net, cp_sta_t *sta);
+
+/**
+ * TODO
+ */
+void
+cp_eoc_sta_action_assoc__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
+ cp_net_t *net, cp_sta_t *sta);
+
+/**
+ * TODO
+ */
+void
+cp_eoc_sta_action_auth__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
+ cp_net_t *net, cp_sta_t *sta);
+
+/**
+ * Timeout occurred while station was in associating state.
+ * \param ctx control plane context
+ *
+ */
+void
+cp_eoc_sta_action_assoc__associating_timeout (cp_t *ctx);
+
+/**
+ * CC_ASSOC.CNF was received
+ * \param ctx control plane context
+ * \param mme received MME handle
+ */
+void
+cp_eoc_sta_action_assoc__associating_cnf (cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Several beacons was not detected while station was in asscoiating state
+ * \param ctx control plane context
+ *
+ */
+void
+cp_eoc_sta_action_assoc__associating_no_beacons (cp_t *ctx);
+
+/**
+ * Handle UNASSOCIATED => DETECTING transition
+ * \param ctx control plane context
+ *
+ */
+void
+cp_eoc_sta_action_assoc__unassociated_retry (cp_t *ctx);
+
+/**
+ * GET_KEY.CNF was received
+ * \param ctx control plane context
+ * \param mme received MME handle
+ */
+void
+cp_eoc_sta_action_assoc__associated_key_cnf (cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * GET_KEY.CNF was received for TEK_KEY (used to authenticate station)
+ * \param ctx control plane context
+ * \param mme received MME handle
+ */
+void
+cp_eoc_sta_action_auth__authenticated_key_cnf (cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * TODO
+ */
+void
+cp_eoc_sta_action_auth__authenticated_set_key_req (cp_t *ctx,
+ cp_mme_rx_t *mme);
+
+/**
+ * Several beacons was not detected while station was in asscoiated state
+ * \param ctx control plane context
+ *
+ */
+void
+cp_eoc_sta_action_assoc__associated_no_beacons (cp_t *ctx);
+
+/**
+ * Timeout during asscoiated state
+ * \param ctx control plane context
+ *
+ */
+void
+cp_eoc_sta_action_assoc__associated_timeout (cp_t *ctx);
+
+/**
+ * CC_LEAVE.IND was received while station in associated state
+ * \param ctx control plane context
+ * \param mme received MME handle
+ *
+ */
+void
+cp_eoc_sta_action_assoc__associated_leave (cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * CC_LEAVE.IND was received while station in authenticated state
+ * \param ctx control plane context
+ * \param mme received MME handle
+ *
+ */
+void
+cp_eoc_sta_action_assoc__authenticated_leave (cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Several beacons was not detected while station was in authenticated
+ * state
+ * \param ctx control plane context
+ *
+ */
+void
+cp_eoc_sta_action_assoc__authenticated_no_beacons (cp_t *ctx);
+
+/**
+ * TODO
+ */
+void
+cp_eoc_sta_action_assoc__beacon_not_received (cp_t *ctx);
+
+/**
+ * TODO
+ */
+void
+cp_eoc_sta_action_unassoc__start_retry_timer (cp_t *ctx);
+
+/**
+ * TODO
+ */
+void
+cp_eoc_sta_action_unassoc__stop_retry_timer (cp_t *ctx);
+
+/**
+ * CM_ENCRYPTED_PAYLOAD.RSP was received
+ * \param ctx control plane context
+ * \param mme received MME handle
+ *
+ */
+void
+cp_eoc_sta_action_assoc__associated_encrypt_payload_rsp (cp_t *ctx,
+ cp_mme_rx_t *mme);
+
+void
+cp_eoc_sta_action_auth__authenticated_set_out_lev (cp_t *ctx,
+ cp_mme_rx_t *mme);
+
+/**
+ * Several beacons were not detected while station was in
+ * detecting beacon state
+ * \param ctx control plane context
+ *
+ */
+void
+cp_eoc_sta_action_assoc__detecting_no_beacons (cp_t *ctx);
+
+/**
+ * Several beacons were not detected while station was in
+ * unassociated state
+ * \param ctx control plane context
+ *
+ */
+void
+cp_eoc_sta_action_assoc__unassoc_no_beacons (cp_t *ctx);
+
+/**
+ * BEACON was received while station was in unassociated state
+ * \param ctx control plane context
+ * \param beacon pointer to received beacon
+ * \param net pointer to station's network
+ * \param sta pointer to control plane station
+ *
+ */
+void
+cp_eoc_sta_action_unassoc__beacon_received (
+ cp_t *ctx, bsu_beacon_t *beacon, cp_net_t *net, cp_sta_t *sta);
+
+END_DECLS
+
+#endif /* cp_eoc_sta_action_assoc_slave_h */
diff --git a/cesar/cp/eoc/sta/action/bridge.h b/cesar/cp/eoc/sta/action/bridge.h
deleted file mode 100644
index 3679caca4e..0000000000
--- a/cesar/cp/eoc/sta/action/bridge.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp/eoc/sta/action/bridge.h
- * \brief STA action, bridge table related declarations.
- * \ingroup cp_sta_action
- *
- * Bridge table request and reception implementations.
- */
-//#include "common/std.h"
-
-#include "cp/mme.h" // cp_mme_rx_t
-#include "cp/msg/msg.h" // to include cp/msg/inc/msg_cm.h
-#include "cp/msg/inc/msg_cm.h" // cp_msg_cm_brg_info_cnf_receive_*
-#include "cp/sta/mgr/sta_mgr.h" // cp_sta_mgr_get_our_avln
-#include "cp/sta/mgr/sta.h" // cp_sta_get_peer
-#include "cp/sta/mgr/net.h" // cp_net_sta_get_*
-#include "cl/cl_mactotei.h" // cl_mactotei_*
-#include "cp/inc/context.h" // cp_t
-#include "cl/bridge_table.h" // bridge_table_*
-#include "lib/utils.h" // less_mod2p32
-#include "cp/sta/action/bridge.h"
-
-
-void
-cp_sta_action_bridge_first_com (cp_t *ctx, cp_net_t *net, cp_sta_t *sta);
-
diff --git a/cesar/cp/eoc/sta/action/cco_action.h b/cesar/cp/eoc/sta/action/cco_action.h
deleted file mode 100644
index e69de29bb2..0000000000
--- a/cesar/cp/eoc/sta/action/cco_action.h
+++ /dev/null
diff --git a/cesar/cp/eoc/sta/action/drv.h b/cesar/cp/eoc/sta/action/drv.h
index 8c73611016..4b5165ad0b 100644
--- a/cesar/cp/eoc/sta/action/drv.h
+++ b/cesar/cp/eoc/sta/action/drv.h
@@ -8,7 +8,7 @@
*
* }}} */
/**
- * \file cp/sta/eoc/action/drv.h
+ * \file cp/eoc/sta/action/drv.h
* \brief Driver messages
* \ingroup cp_eoc_sta_action
*
@@ -20,65 +20,46 @@
* \image html
*
*/
+#include "cp/cp.h"
+#include "cp/mme.h"
BEGIN_DECLS
+/**
+ * TODO
+ */
void
-cp_sta_action_drv__stopped__drv_sta_set_mac_addr_req (cp_t *ctx,
- cp_mme_rx_t *mme);
-void
-cp_sta_action_drv__stopped__drv_sta_set_cco_pref_req (cp_t *ctx,
- cp_mme_rx_t *mme);
-void
-cp_sta_action_drv__stopped__drv_sta_set_was_cco_req (cp_t *ctx,
- cp_mme_rx_t *mme);
-void
-cp_sta_action_drv__stopped__drv_sta_set_dpw_req (cp_t *ctx,
- cp_mme_rx_t *mme);
-void
-cp_sta_action_drv__stopped__drv_sta_set_npw_req (cp_t *ctx,
- cp_mme_rx_t *mme);
-void
-cp_sta_action_drv__stopped__drv_sta_set_nid_req (cp_t *ctx,
- cp_mme_rx_t *mme);
-void
-cp_sta_action_drv__stopped__drv_sta_set_tonemask_req (cp_t *ctx,
- cp_mme_rx_t *mme);
-void
-cp_sta_action_drv__stopped__drv_sta_set_key_req (cp_t *ctx,
- cp_mme_rx_t *mme);
-void
-cp_sta_action_drv__stopped__drv_sta_set_dak_req (cp_t *ctx,
- cp_mme_rx_t *mme);
-void
-cp_sta_action_drv__stopped__drv_sta_mac_start_req (cp_t *ctx,
- cp_mme_rx_t *mme);
-void
-cp_sta_action_drv__started__drv_sta_mac_stop_req (cp_t *ctx,
- cp_mme_rx_t *mme);
-void
-cp_sta_action_drv__stopped__drv_sta_set_sl_req (cp_t *ctx,
- cp_mme_rx_t *mme);
-void
-cp_sta_action_drv__stopped__drv_sta_set_m_sta_hfid_req (cp_t *ctx,
- cp_mme_rx_t *mme);
+cp_eoc_sta_action_drv__stopped__drv_sta_set_tonemask_req (
+ cp_t *ctx, cp_mme_rx_t *mme);
+/**
+ * TODO
+ */
void
-cp_sta_action_drv__stopped__drv_sta_set_u_sta_hfid_req (cp_t *ctx,
- cp_mme_rx_t *mme);
-void
-cp_sta_action_drv__stopped__drv_sta_set_avln_hfid_req (cp_t *ctx,
- cp_mme_rx_t *mme);
+cp_eoc_sta_action_drv__stopped__drv_sta_set_key_req (
+ cp_t *ctx, cp_mme_rx_t *mme);
+/**
+ * TODO
+ */
void
-cp_sta_action_drv__stopping__stopped (cp_t *ctx);
+cp_eoc_sta_action_drv__drv_sta_set_slave_config_req (
+ cp_t *ctx, cp_mme_rx_t *mme);
+/**
+ * TODO
+ */
void
-cp_sta_action_drv__drv_sta_set_config_req (cp_t *ctx, cp_mme_rx_t *mme);
+cp_eoc_sta_action_drv__drv_sta_set_eoc_config_req (
+ cp_t *ctx, cp_mme_rx_t *mme);
+/**
+ * Common handler for DRV_STA_GET_STATUS.IND.
+ * \param ctx control plane context
+ */
void
-cp_sta_action_drv__drv_sta_get_status_ind(cp_t *ctx);
+cp_eoc_sta_action_drv__drv_sta_get_status_ind (cp_t *ctx);
END_DECLS
-#endif /* cp_eoc_sta_action_sleep_h */
+#endif /* cp_eoc_sta_action_drv_h */
diff --git a/cesar/cp/eoc/sta/action/inc/assoc.h b/cesar/cp/eoc/sta/action/inc/assoc.h
new file mode 100644
index 0000000000..c64b9fa2d7
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/inc/assoc.h
@@ -0,0 +1,45 @@
+#ifndef cp_eoc_sta_action_inc_assoc_h
+#define cp_eoc_sta_action_inc_assoc_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2012 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eoc/sta/action/inc/assoc.h
+ * \brief « brief description »
+ * \ingroup cp_eoc_sta_action
+ *
+ * « long description »
+ */
+
+#define UNASSOC_RETRY_TIMEOUT_MS 15*1000
+#define RETRY_TIMEOUT_MS 1200
+#define LEAVING_TIMEOUT_MS (40 * 3)
+#define LEAVE_WAIT_TIMEOUT_MS 1000
+#define CP_EOC_NUM_RETRY 3
+#define CP_EOC_NOT_POLLED_NB 20
+#define CP_EOC_BEACON_1S_NB 10
+#define CP_EOC_BEACON_FIRST_OFFSET_NB 50
+#define CP_EOC_ASSOC_REQ_RETRY_LIMIT 10
+
+#define CP_EOC_STA_ASSOC_REQ_OFFSET CP_EOC_BEACON_FIRST_OFFSET_NB \
+ + ((ctx->mac_config->sta_mac_address >> 40) & 0x1F)
+
+
+#include "config/cp/eoc/sta/con.h"
+
+
+#if CONFIG_CP_EOC_STA_CON_ALLOWED
+#define SUB_STAT_ATTR(a, b, c) ((a).c - (b).c)
+#define SUB_STAT(c) SUB_STAT_ATTR (ctx->sar->stats, sar_offset, c)
+#endif
+
+BEGIN_DECLS
+
+
+END_DECLS
+
+#endif /* cp_eoc_sta_action_inc_assoc_h */
diff --git a/cesar/cp/eoc/sta/action/inc/vs.h b/cesar/cp/eoc/sta/action/inc/vs.h
new file mode 100644
index 0000000000..a1fa741ab4
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/inc/vs.h
@@ -0,0 +1,35 @@
+#ifndef cp_eoc_sta_action_inc_vs_h
+#define cp_eoc_sta_action_inc_vs_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2012 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eoc/sta/action/inc/vs.h
+ * \brief « brief description »
+ * \ingroup cp_eoc_sta_action
+ *
+ * « long description »
+ */
+
+struct real_time_stats_t {
+ uint nb_unicast_packets_rx;
+ uint nb_unicast_packets_tx;
+ uint total_nb_bytes_rx;
+ uint total_nb_bytes_tx;
+ uint nb_broadcast_packets_rx;
+ uint nb_broadcast_packets_tx;
+ uint nb_multicast_packets_rx;
+ uint nb_multicast_packets_tx;
+ uint nb_packets_rx_crc;
+ uint nb_packets_rx_short;
+ uint nb_packets_tx_short;
+ uint nb_packets_tx_dropped;
+ uint nb_packets_rx_discarded;
+ uint avg_pre_fec_bit_error_rate;
+};
+
+#endif /* cp_eoc_sta_action_inc_vs_h */
diff --git a/cesar/cp/eoc/sta/action/misc.h b/cesar/cp/eoc/sta/action/misc.h
deleted file mode 100644
index 1b47cca0a0..0000000000
--- a/cesar/cp/eoc/sta/action/misc.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef cp_sta_action_misc_h
-#define cp_sta_action_misc_h
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp/sta/eoc/action/misc.h
- * \brief STA action, miscellaneous definitions.
- * \ingroup cp_sta_action
- *
- * Miscellaneous
- * =============
- *
- * This part handle other miscellaneous STA function, most of theses are
- * simple enough to be handled without any remembered state.
- */
-
-BEGIN_DECLS
-
-void
-cp_sta_action_process_cm_nw_stats_req (cp_t *ctx, cp_mme_rx_t *rx_mme);
-
-void cp_sta_action_process_cm_sta_cap_req (cp_t *ctx, cp_mme_rx_t *rx_mme);
-
-END_DECLS
-
-#endif /* cp_sta_action_misc_h */ \ No newline at end of file
diff --git a/cesar/cp/eoc/sta/action/poweron.h b/cesar/cp/eoc/sta/action/poweron.h
index e13548757b..a86ed9b24d 100644
--- a/cesar/cp/eoc/sta/action/poweron.h
+++ b/cesar/cp/eoc/sta/action/poweron.h
@@ -14,19 +14,15 @@
*
*/
-void
-cp_sta_action_poweron_start (cp_t *ctx);
+#include "cp/sta/action/poweron.h"
-void
-cp_sta_action_poweron_stop (cp_t *ctx);
+BEGIN_DECLS
-void
-cp_sta_action_poweron__idle__to_poweron (cp_t *ctx);
-
-void
-cp_sta_action_poweron__many__to_idle (cp_t *ctx);
+/* Declared in VARIANT :
+ * - cp_sta_action_poweron__many__to_idle
+ * - cp_sta_action_poweron__idle__to_poweron
+ */
-void
-cp_eoc_sta_action__power_on_no_beacons (cp_t *ctx);
+END_DECLS
-#endif
+#endif /* cp_eoc_sta_action_poweron_h */
diff --git a/cesar/cp/eoc/sta/action/sleep.h b/cesar/cp/eoc/sta/action/sleep.h
deleted file mode 100644
index 7682e16722..0000000000
--- a/cesar/cp/eoc/sta/action/sleep.h
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef cp_eoc_sta_action_sleep_h
-#define cp_eoc_sta_action_sleep_h
-/* Cesar project {{{
- *
- * Copyright (C) 2009 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp/sta/eoc/action/sleep.h
- * \brief Entering/exiting STA sleep states
- * \ingroup cp_eoc_sta_action
- *
- * Entering and exiting sleep states
- * ==========================
- *
- * This part relates to entering and exiting STA sleep states
- *
- * \image html
- *
- */
-
-BEGIN_DECLS
-
-/**
- * Handle UNASSOCIATED => SLEEP_UNASSOCIATED state
- * \param ctx control plane context
- *
- */
-void
-cp_eoc_sta_action_sleep__unassociated_enter_sleep (cp_t *ctx);
-
-/**
- * Handle SLEEP_UNASSOCIATED => UNASSOCIATED state
- * \param ctx control plane context
- *
- */
-void
-cp_eoc_sta_action_sleep__sleep_unassociated_exit_sleep (cp_t *ctx);
-
-/**
- * Handle AUTHENTICATED => SLEEP_AUTHENTICATED state
- * \param ctx control plane context
- *
- */
-void
-cp_eoc_sta_action_sleep__authenticated_sleep_enter (cp_t *ctx);
-
-/**
- * Handle SLEEP_AUTHENTICATED => AUTHENTICATED state
- * \param ctx control plane context
- *
- */
-void
-cp_eoc_sta_action_sleep__sleep_authenticated_exit (cp_t *ctx);
-
-END_DECLS
-
-#endif /* cp_eoc_sta_action_sleep_h */
diff --git a/cesar/cp/eoc/sta/action/src/action.c b/cesar/cp/eoc/sta/action/src/action.c
index 54cd85aa64..c1b3db643a 100644
--- a/cesar/cp/eoc/sta/action/src/action.c
+++ b/cesar/cp/eoc/sta/action/src/action.c
@@ -6,32 +6,20 @@
*
* }}} */
/**
- * \file cp/sta/action/src/action.c
- * \brief STA action.
- * \ingroup cp_sta_action
+ * \file cp/eoc/sta/action/src/action.c
+ * \brief EoC STA action.
+ * \ingroup cp_eoc_sta_action
*/
#include "common/std.h"
+/* Public headers. */
+#include "cp/eoc/sta/action/action.h"
#include "cp/sta/action/action.h"
-#include "cp/inc/context.h" // cp_t
-#include "cp/sta/action/bridge.h"
-#include "cp/av/cco/bw/bw.h"
-#include "ce/tx/tx.h"
void
-cp_sta_action_init (cp_t *ctx)
+cp_eoc_sta_action_init (cp_t *ctx)
{
cp_sta_action_assoc_init (ctx);
/* Initialize the STA action bridge module. */
cp_sta_action_bridge_init (ctx);
}
-
-void
-cp_sta_action_garbage (cp_t *ctx)
-{
- /* Update tone map list for CE in TX. */
- ce_tx_update_tone_map (ctx);
- /* Update local bridge table. */
- cp_sta_action_update_bridge_table (ctx);
-}
-
diff --git a/cesar/cp/eoc/sta/action/src/assoc.c b/cesar/cp/eoc/sta/action/src/assoc.c
index b23fef264f..9b3f588a11 100644
--- a/cesar/cp/eoc/sta/action/src/assoc.c
+++ b/cesar/cp/eoc/sta/action/src/assoc.c
@@ -7,691 +7,35 @@
* }}} */
/**
* \file cp/eoc/sta/action/src/assoc.c
- * \brief STA action, association related definitions.
+ * \brief EoC STA action, association related definitions.
* \ingroup cp_eoc_sta_action
*/
#include "common/std.h"
-#include <stdio.h>
-#include "cp/sta/action/action.h"
+/* Private headers. */
#include "cp/inc/context.h"
-#include "cp/fsm/fsm.h"
-#include "cp/msg/msg.h"
-#include "cp/beacon/beacon.h"
-#include "mac/sar/sar.h"
-#include "mac/sar/inc/context.h"
-#include "mac/pbproc/inc/context.h"
-#include "mac/common/ntb.h"
-#include "hal/gpio/gpio.h"
-#include "cp/eoc/inc/dbg_print.h"
-#include "cp/eoc/cco/bw/bw.h"
-#include "cp/eoc/sta/action/drv.h"
-#include "cp/msg/inc/msg_vs_eoc.h"
-#include "config/cp/eoc/sta/con/allowed.h"
-
-#define UNASSOC_RETRY_TIMEOUT_MS 15*1000
-#define RETRY_TIMEOUT_MS 1200
-#define LEAVING_TIMEOUT_MS (40 * 3)
-#define LEAVE_WAIT_TIMEOUT_MS 1000
-#define CP_EOC_NUM_RETRY 3
-#define CP_EOC_NOT_POLLED_NB 20
-#define CP_EOC_BEACON_1S_NB 10
-#define CP_EOC_BEACON_FIRST_OFFSET_NB 50
-#define CP_EOC_ASSOC_REQ_RETRY_LIMIT 10
-
-#define CP_EOC_STA_ASSOC_REQ_OFFSET CP_EOC_BEACON_FIRST_OFFSET_NB \
- + ((ctx->mac_config->sta_mac_address >> 40) & 0x1F)
-
-#if CONFIG_CP_EOC_STA_CON_ALLOWED
-#define SUB_STAT_ATTR(a, b, c) ((a).c - (b).c)
-#define SUB_STAT(c) SUB_STAT_ATTR (ctx->sar->stats, sar_offset, c)
-#endif
-
-/* Clear status of one station */
-void
-cp_eoc_sta_action_sta_clear_status (cp_t *ctx)
-{
- dbg_assert (ctx);
- cp_sta_own_data_set_authenticated_status (ctx, false);
- cp_sta_own_data_set_tei (ctx, MAC_TEI_UNASSOCIATED);
- ctx->sta_action.assoc.retry = 0;
- ctx->sta_action.assoc.beacon_loss = 0;
- ctx->sta_action.assoc.init_count = CP_EOC_STA_ASSOC_REQ_OFFSET;
- cp_sta_own_data_t *own_data = cp_sta_mgr_get_sta_own_data (ctx);
- cp_net_t * net = cp_sta_mgr_get_our_avln (ctx);
-
- cp_sta_t * sta = NULL;
- if (own_data->tei_track != MAC_TEI_UNASSOCIATED)
- sta = cp_sta_mgr_sta_get_assoc (ctx, net, own_data->tei_track);
- if (sta)
- {
- ctx->sta_mgr.sta_own_data.state = CP_EOC_STA_STATE_UNASSOCIATED;
- cp_sta_action_drv__drv_sta_get_status_ind(ctx);
-
- cp_sta_set_authenticated (ctx, sta, false);
- cp_sta_mgr_sta_remove (ctx, sta);
- slab_release (sta);
- }
- own_data->tei_track = MAC_TEI_UNASSOCIATED;
- own_data->cco_mac_addr_track = MAC_ZERO;
- cp_beacon_process_untracked_avln (ctx);
- cp_eoc_cco_bw_sta_allocations (ctx);
- dbg_assert (ctx->sta_action.assoc.assoc_req_retry_nb
- < CP_EOC_ASSOC_REQ_RETRY_LIMIT);
-}
-
-void
-cp_eoc_sta_action_assoc__detecting_detected (cp_t *ctx)
-{
- dbg_assert (ctx);
- /* Send association request. */
- cp_msg_cc_assoc_req_t data = {
- CP_MSG_CC_ASSOC_REQ_TYPE_NEW,
- cp_sta_own_data_get_nid (ctx),
- CP_CCO_LEVEL,
- CP_PCO_CAP
- };
- cp_msg_cc_assoc_req_send (ctx, &ctx->sta_action.assoc.peer, &data);
- /* Increase global number of assoc request */
- ctx->sta_action.assoc.assoc_req_retry_nb ++;
-}
-
-void
-cp_eoc_sta_action_assoc__detecting_timeout (cp_t *ctx)
-{
- dbg_assert (ctx);
- cp_fsm_trigger_new_event (ctx, bare, nd_beacon_timeout);
-}
-
-void
-cp_eoc_sta_action_assoc__detecting_no_beacons (cp_t *ctx)
-{
- cp_eoc_sta_action_sta_clear_status (ctx);
-}
-
-void
-cp_eoc_sta_action_detect__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
- cp_net_t *net, cp_sta_t *sta)
-{
- dbg_assert (ctx);
- dbg_assert (beacon);
- dbg_assert (net);
- dbg_assert (sta);
-
- cp_nid_t our_nid = cp_sta_own_data_get_nid (ctx);
- cp_nid_t its_nid = cp_net_get_nid (ctx, net);
- ctx->sta_action.assoc.beacon_loss = 0;
-
- if (cp_beacon_synchronised (ctx))
- {
- if (ctx->sta_action.assoc.init_count > 0)
- ctx->sta_action.assoc.init_count--;
-
- if (ctx->sta_action.assoc.init_count <= 0)
- {
- if (its_nid == our_nid)
- {
- cp_sta_own_data_t *own_data = cp_sta_mgr_get_sta_own_data (ctx);
- /* set proper data for tracked AVLN. on second call send assoc */
- if (own_data->tei_track != MAC_TEI_UNASSOCIATED)
- cp_fsm_post_new_event (ctx, bare, nd_beacon);
- }
- }
- }
- if (its_nid == our_nid)
- {
- cp_sta_get_peer (sta, &ctx->sta_action.assoc.peer);
- /* track beacon as soon as possible, sync is important */
- cp_sta_own_data_t *own_data = cp_sta_mgr_get_sta_own_data (ctx);
- /* set proper data for tracked AVLN. on secon call send assoc */
- if (own_data->tei_track == MAC_TEI_UNASSOCIATED)
- {
- own_data->tei_track = ctx->sta_action.assoc.peer.tei;
- own_data->cco_mac_addr_track = ctx->sta_action.assoc.peer.mac;
- cp_beacon_process_tracked_avln (ctx, beacon, net);
- }
- }
-}
-
-void
-cp_eoc_sta_action_assoc__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
- cp_net_t *net, cp_sta_t *sta)
-{
- dbg_assert (ctx);
- dbg_assert (beacon);
- dbg_assert (net);
- dbg_assert (sta);
-
- ctx->sta_action.assoc.beacon_loss = 0;
-}
-
-#if CONFIG_CP_EOC_STA_CON_ALLOWED
-static u32 mem=0, auth_time=0;
-u32 cp_eoc_time_get (void)
-{
- return auth_time;
-}
-#endif
-void
-cp_eoc_sta_action_auth__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
- cp_net_t *net, cp_sta_t *sta)
-{
- dbg_assert (ctx);
- dbg_assert (beacon);
- dbg_assert (net);
- dbg_assert (sta);
-
- ctx->sta_action.assoc.beacon_loss = 0;
- /* check consecc polling count */
- if (ctx->pbproc->polled)
- {
- ctx->sta_action.assoc.retry=0;
- ctx->pbproc->polled = false;
- }
- else
- {
- if (cp_sta_own_data_get_authenticated_status (ctx)
- && ++ctx->sta_action.assoc.retry >= CP_EOC_NOT_POLLED_NB)
- {
- ctx->sta_action.assoc.retry = 0;
- cp_fsm_post_new_event (ctx, bare, to_leave);
- return;
- }
- }
-#if CONFIG_CP_EOC_STA_CON_ALLOWED
- static sar_stats_t sar_offset;
- if (++mem >= CP_EOC_BEACON_1S_NB)
- {
- auth_time++;
- mem = 0;
- char temp[128];
- sprintf (temp, "sta=%d blk=%d sar[%d,%d,%d,%d,%d,%d,%d] pb[%d]\n",
- auth_time, blk_free_nb (),
- SUB_STAT (rx_jobs_count),
- ctx->sar->stats.rx_jobs_waiting_count,
- SUB_STAT (rx_pb_count),
- SUB_STAT (rx_pb_rejected),
- SUB_STAT (rx_pb_crc_error_count),
- SUB_STAT (tx_pb_expired),
- SUB_STAT (rx_pb_expired),
- ctx->pbproc->stats.tx_data_cancel
- + ctx->pbproc->stats.tx_data_wack_noack);
- sar_offset = ctx->sar->stats;
- int pos = 0, len = strlen (temp), len1;
- while (pos < len)
- {
- char * temp1 = temp + pos, tmpa[32];
- len1 = MIN (len, pos + 20);
- strncpy (tmpa, temp1, len1 - pos);
- tmpa[len1 - pos] = '\0';
- printf (tmpa);
- pos = len1;
- }
- }
-#endif
-}
+#include "cp/eoc/sta/action/inc/assoc.h"
-/* return station to detect beacon state */
-void
-cp_eoc_sta_action_assoc__associating_timeout (cp_t *ctx)
-{
- ctx->sta_mgr.sta_own_data.num_bad_could_not_assoc ++;
- if (ctx->sta_action.assoc.retry++ < CP_EOC_NUM_RETRY)
- {
- cp_fsm_branch (ctx, ASSOCIATING, timeout_associating, retry);
- }
- else
- {
- cp_fsm_branch (ctx, ASSOCIATING, timeout_associating, no_retry);
- cp_eoc_sta_action_sta_clear_status (ctx);
- }
-}
+/* Public headers. */
+#include "cp/eoc/sta/action/action.h"
+#include "cp/sta/action/action.h"
void
-cp_eoc_sta_action_assoc__associating_cnf (cp_t *ctx, cp_mme_rx_t *mme)
+cp_eoc_sta_action_assoc_init (cp_t *ctx)
{
- cp_msg_cc_assoc_cnf_t cnf;
- bool added;
- mfs_tx_t *mfs;
dbg_assert (ctx);
- dbg_assert (mme);
- /* confirmation is received, reset counter
- * result is not relevant, only that ASSOC.CNF is received. */
ctx->sta_action.assoc.assoc_req_retry_nb = 0;
- bool status = cp_msg_cc_assoc_cnf_receive (ctx, mme, &cnf);
- /* change dak and result */
- if (status && cnf.result
- == CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS_WL_ACCEPT_ALL)
- {
- cp_key_t key = cp_secu_generate_keys (ctx, (u8 *) MASTER_GOLDEN_DPW,
- strlen (MASTER_GOLDEN_DPW), CP_SECU_SALT_KEY_DAK);
- cp_sta_own_data_set_dak (ctx, key);
- cnf.result = CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS;
- }
- else if (status && cnf.result == CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS)
- cp_sta_own_data_set_dak (ctx, cp_sta_own_data_get_original_dak (ctx));
- /* Check response. */
- if (mme->peer.mac != ctx->sta_action.assoc.peer.mac
- || mme->peer.tei == 0
- || !status
- || cnf.nid != cp_sta_own_data_get_nid (ctx))
- {
- /* Unrelated message, drop. */
- cp_fsm_branch (ctx, ASSOCIATING, CC_ASSOC_CNF, unrelated);
- }
- else if (cnf.result != CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS)
- {
- /* Negative result, station not associated */
- ctx->sta_mgr.sta_own_data.num_bad_assoc_failure ++;
- cp_fsm_branch (ctx, ASSOCIATING, CC_ASSOC_CNF, unsuccess);
- }
- else
- {
- /* Update state. */
- cp_sta_own_data_set_tei (ctx, cnf.sta_tei);
- cp_sta_own_data_t *own_data = cp_sta_mgr_get_sta_own_data (ctx);
- own_data->tei_track = ctx->sta_action.assoc.peer.tei;
-
- /* Create request for KEYs */
- cp_msg_cm_get_key_req_t get_key = {
- .relayed = false, .key_type = CP_MSG_KEY_NEK,
- .nid = cp_sta_own_data_get_nid (ctx) };
- cp_secu_protocol_run_new (&ctx->sta_action.assoc.prun, 0, &ctx->rnd);
-
- mfs = mac_store_mfs_add_tx (ctx->mac_store, false, true, MAC_LID_NONE,
- mme->peer.tei, &added);
- if(added)
- sar_mfs_add (ctx->sar, (mfs_t *)mfs);
-
- if (mfs)
- blk_release (mfs);
-
- /*STA is authenticated data can be transferred */
- mfs = mac_store_mfs_add_tx (ctx->mac_store, false, false, MAC_LLID_MIN,
- mme->peer.tei, &added);
- if(added)
- sar_mfs_add (ctx->sar, (mfs_t *)mfs);
-
- if (mfs)
- blk_release (mfs);
-
- cp_msg_cm_get_key_req_send (ctx, &mme->peer, CP_MME_PEKS_DAK,
- &ctx->sta_action.assoc.prun, &get_key);
- /* Change state. */
- cp_fsm_branch (ctx, ASSOCIATING, CC_ASSOC_CNF, success);
- DBG_PRINT("sta: assoc");
-
- ctx->sta_mgr.sta_own_data.state = CP_EOC_STA_STATE_ASSOCIATED;
- cp_sta_action_drv__drv_sta_get_status_ind(ctx);
- }
-}
-
-void
-cp_eoc_sta_action_assoc__associating_no_beacons (cp_t *ctx)
-{
- cp_eoc_sta_action_sta_clear_status (ctx);
-}
-
-/* Simply goto detecting beacon and wait for beacon to start assoc */
-void
-cp_eoc_sta_action_assoc__unassociated_retry (cp_t *ctx)
-{
- dbg_assert (ctx);
-}
-
-void
-cp_eoc_sta_action_assoc__associated_key_cnf (cp_t *ctx, cp_mme_rx_t *mme)
-{
- dbg_assert (ctx);
- dbg_assert (mme);
- cp_msg_cm_get_key_cnf_t cnf;
- bool added, accepted = true;
- mfs_tx_t *mfs;
- /* Check response. */
- if (!cp_mme_peer_cmp (&mme->peer, &ctx->sta_action.assoc.peer)
- || !cp_msg_cm_get_key_cnf_receive (ctx, mme, &cnf)
- || !cp_secu_protocol_check (&ctx->sta_action.assoc.prun, &mme->prun,
- CP_SECU_PROTOCOL_RUN_CHECK_RESULT_NEXT)
- || cnf.nid != cp_sta_own_data_get_nid (ctx)
- || (mme->peks != CP_MME_PEKS_DAK))
- accepted = false;
-
- if (!accepted)
- {
- /* Unrelated message, drop. */
- cp_fsm_branch (ctx, ASSOCIATED, CM_GET_KEY_CNF, unrelated);
- }
- else if (cnf.result != CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED)
- {
- /* Failure indication. */
- cp_fsm_branch (ctx, ASSOCIATED, CM_GET_KEY_CNF, not_granted);
- }
- else if (cnf.key_type == CP_MSG_KEY_NEK)
- {
- /* Use the first nex_index from msg, BEACON */
- /* Use the new key. */
- cp_beacon_nek_index_adjust (ctx, cnf.eks);
- cp_beacon_change_nek (ctx, cnf.eks, cnf.key, true);
- /*STA is authenticated data can be transferred */
- mfs = mac_store_mfs_add_tx (ctx->mac_store, false, false, MAC_LLID_MIN,
- mme->peer.tei, &added);
- if(added)
- sar_mfs_add (ctx->sar, (mfs_t *)mfs);
- if (mfs)
- blk_release (mfs);
- /* Signal joined state.
- * TODO: cp_fsm_trigger_new_event (ctx, bare, joined); */
- /* Reset beacon loss counter. */
- ctx->sta_action.assoc.beacon_loss = 0;
- cp_fsm_branch (ctx, ASSOCIATED, CM_GET_KEY_CNF, all_keys_granted);
- ctx->sta_mgr.sta_own_data.num_good_assoc_auth ++;
-
- /* Create request for KEYs */
- cp_msg_cm_get_key_req_t get_key = {
- .relayed = false, .key_type = CP_MSG_KEY_TEK,
- .nid = cp_sta_own_data_get_nid (ctx) };
- cp_secu_protocol_run_new (&ctx->sta_action.assoc.prun, 0, &ctx->rnd);
-
- cp_msg_cm_get_key_req_send (ctx, &mme->peer, CP_MME_PEKS_DAK,
- &ctx->sta_action.assoc.prun, &get_key);
- ctx->sta_mgr.sta_own_data.state = CP_EOC_STA_STATE_AUTHENTICATED;
- cp_sta_action_drv__drv_sta_get_status_ind(ctx);
- }
}
void
-cp_eoc_sta_action_auth__authenticated_key_cnf (cp_t *ctx, cp_mme_rx_t *mme)
-{
- dbg_assert (ctx);
- dbg_assert (mme);
- cp_msg_cm_get_key_cnf_t cnf;
- bool accepted = true;
-
- /* Check response. */
- if (!cp_mme_peer_cmp (&mme->peer, &ctx->sta_action.assoc.peer)
- || !cp_msg_cm_get_key_cnf_receive (ctx, mme, &cnf)
- || !cp_secu_protocol_check (&ctx->sta_action.assoc.prun, &mme->prun,
- CP_SECU_PROTOCOL_RUN_CHECK_RESULT_LAST)
- || cnf.nid != cp_sta_own_data_get_nid (ctx)
- || (mme->peks != CP_MME_PEKS_DAK))
- accepted = false;
-
- if (accepted
- && cnf.key_type == CP_MSG_KEY_TEK
- && cnf.result == CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED)
- {
- /* Use the new key. TODO Stop time timer */
- cp_sta_own_data_set_authenticated_status (ctx, true);
- // Get the network.
- cp_net_t * net = cp_sta_mgr_get_our_avln (ctx);
- cp_sta_t * sta =
- cp_sta_mgr_sta_get_assoc (ctx, net, mme->peer.tei);
-
- if (sta)
- {
- cp_sta_set_authenticated (ctx, sta, true);
- slab_release (sta);
- }
- DBG_PRINT("sta: auth eks=%d", cnf.eks);
- }
-}
-
-void
-cp_eoc_sta_action_auth__authenticated_set_key_req (cp_t *ctx, cp_mme_rx_t *mme)
-{
- dbg_assert (ctx);
- dbg_assert (mme);
- /* Get our CCo. */
- cp_net_t *net = cp_sta_mgr_get_our_avln (ctx);
- cp_mme_peer_t peer;
- cp_net_get_cco_peer (ctx, net, &peer);
- /* Check received message. */
- cp_msg_cm_set_key_req_t req;
-
- if (cp_mme_peer_cmp (&mme->peer, &peer)
- && cp_msg_cm_set_key_req_receive (ctx, mme, &req)
- && req.nid == cp_sta_own_data_get_nid (ctx))
- {
- if ((req.key_type == CP_MSG_KEY_NEK)
- && (mme->peks == CP_MME_PEKS_DAK)
- && (cp_secu_protocol_check
- (&ctx->sta_action.nek_prun, &mme->prun,
- CP_SECU_PROTOCOL_RUN_CHECK_RESULT_NEXT)))
- {
-
- ctx->sta_action.nek_prun = mme->prun;
- /* Send response. */
- cp_msg_cm_set_key_cnf_t cnf = {
- CP_MSG_CM_SET_KEY_CNF_RESULT_SUCCESS,
- CP_CCO_LEVEL };
- cp_secu_protocol_next (&ctx->sta_action.nek_prun, &ctx->rnd,
- true);
- cp_msg_cm_set_key_cnf_send (ctx, &peer, CP_MME_PEKS_DAK,
- &ctx->sta_action.nek_prun,
- &cnf);
- /* Update NEK. */
- cp_beacon_change_nek (ctx, req.new_eks, req.new_key, false);
- DBG_PRINT("key_exc: eks=%d", req.new_eks);
- }
- else if ((req.key_type == CP_MSG_KEY_NONCE_ONLY)
- && (mme->peks == CP_MME_PEKS_DAK)
- && (cp_secu_protocol_check
- (NULL, &mme->prun, CP_SECU_PROTOCOL_RUN_CHECK_RESULT_NEW)))
- {
-
- /* Send response. */
- cp_msg_cm_set_key_cnf_t cnf = {
- CP_MSG_CM_SET_KEY_CNF_RESULT_SUCCESS,
- CP_CCO_LEVEL };
-
- ctx->sta_action.nek_prun = mme->prun;
- cp_secu_protocol_next (&ctx->sta_action.nek_prun, &ctx->rnd,
- false);
- ctx->sta_action.nek_prun.my_nonce = lib_rnd32 (&ctx->rnd);
- cp_msg_cm_set_key_cnf_send (ctx, &peer, CP_MME_PEKS_DAK,
- &ctx->sta_action.nek_prun,
- &cnf);
- }
- }
- else
- {
- /* Send response. */
- cp_msg_cm_set_key_cnf_t cnf = {
- CP_MSG_CM_SET_KEY_CNF_RESULT_FAILURE,
- CP_CCO_LEVEL };
- cp_secu_protocol_run_t prun = mme->prun;
- prun.my_nonce = lib_rnd32 (&ctx->rnd);
- cp_secu_protocol_next (&prun, &ctx->rnd, true);
- cp_msg_cm_set_key_cnf_send (ctx, &peer, CP_MME_PEKS_DAK, &prun,
- &cnf);
- }
-}
-
-/* Leave state and start detection again */
-void
-cp_eoc_sta_action_assoc__associated_no_beacons (cp_t *ctx)
-{
- cp_eoc_sta_action_sta_clear_status (ctx);
-}
-
-/* Left assosiation and goto unassoc state and go again: */
-void
-cp_eoc_sta_action_assoc__associated_timeout (cp_t *ctx)
-{
- ctx->sta_mgr.sta_own_data.num_bad_could_not_auth ++;
- cp_eoc_sta_action_sta_clear_status (ctx);
-}
-
-void
-cp_eoc_sta_action_assoc__associated_leave (cp_t *ctx, cp_mme_rx_t *mme)
-{
- dbg_assert (ctx);
- dbg_assert (mme);
-
-
- /* Check received message. */
- enum cp_msg_cc_leave_ind_reason_t reason;
- cp_nid_t nid;
-
- ctx->sta_mgr.sta_own_data.num_leave ++;
- if (cp_msg_cc_leave_ind_receive (ctx, mme, &reason, &nid)
- && nid == cp_sta_own_data_get_nid (ctx))
- {
- cp_msg_cc_leave_rsp_send (ctx, &mme->peer);
- cp_fsm_branch (ctx, ASSOCIATED, CC_LEAVE_IND, ok);
- cp_eoc_sta_action_sta_clear_status (ctx);
- }
- else
- {
- cp_fsm_branch (ctx, ASSOCIATED, CC_LEAVE_IND, nok);
- }
-}
-
-/* start LEAVE process: TODO */
-void
-cp_eoc_sta_action_assoc__authenticated_leave (cp_t *ctx, cp_mme_rx_t *mme)
-{
- dbg_assert (ctx);
- dbg_assert (mme);
-
-
- /* Check received message. */
- enum cp_msg_cc_leave_ind_reason_t reason;
- cp_nid_t nid;
-
- ctx->sta_mgr.sta_own_data.num_leave ++;
- if (cp_msg_cc_leave_ind_receive (ctx, mme, &reason, &nid)
- && nid == cp_sta_own_data_get_nid (ctx))
- {
- cp_msg_cc_leave_rsp_send (ctx, &mme->peer);
- cp_fsm_branch (ctx, AUTHENTICATED, CC_LEAVE_IND, ok);
- cp_eoc_sta_action_sta_clear_status (ctx);
- }
- else
- {
- cp_fsm_branch (ctx, AUTHENTICATED, CC_LEAVE_IND, nok);
- }
-}
-
-/* Actions to left auth state: start LEAVE process TODO */
-void
-cp_eoc_sta_action_assoc__authenticated_no_beacons (cp_t *ctx)
-{
- cp_eoc_sta_action_sta_clear_status (ctx);
-}
-
-void
-cp_eoc_sta_action_assoc__beacon_not_received (cp_t *ctx)
-{
- static int ltra = 0;
- if (ltra > 5) ltra = 0; else ltra++;
- GPIO_SET (LED_TRAFFIC, !ltra);
-
- dbg_assert (ctx);
- ctx->sta_action.assoc.beacon_loss++;
- if (ctx->sta_action.assoc.beacon_loss > CP_MAX_NO_BEACON)
- {
- ctx->sta_action.assoc.beacon_loss = 0;
- cp_fsm_trigger_new_event (ctx, bare, no_beacons);
- }
-#if CONFIG_CP_EOC_STA_CON_ALLOWED
- DBG_PRINT ("d=%u bcn_not_rcv", phy_date () / MAC_MS_TO_TCK(1));
-#endif
-}
-
-void
-cp_sta_action_assoc__start_retry_timer (cp_t *ctx)
+cp_eoc_sta_action_assoc__start_retry_timer (cp_t *ctx)
{
+ /* only Slave compilation */
+#if !CONFIG_CP_EOC_IS_MASTER
dbg_assert (ctx);
cp_fsm_event_t *event = cp_fsm_event_bare_new (
ctx, CP_FSM_EVENT_TYPE_timeout_associating);
cp_sta_core_gen_timed_event (ctx, &ctx->sta_action.assoc.timer, event,
- RETRY_TIMEOUT_MS);
-}
-
-void
-cp_sta_action_assoc__stop_retry_timer (cp_t *ctx)
-{
- dbg_assert (ctx);
- cp_sta_core_stop_timed_or_cyclic_event (
- ctx, &ctx->sta_action.assoc.timer);
-}
-
-void
-cp_sta_action_unassoc__start_retry_timer (cp_t *ctx)
-{
- dbg_assert (ctx);
- /* randomize start of assoc process */
- ctx->sta_action.assoc.init_count = CP_EOC_STA_ASSOC_REQ_OFFSET;
- cp_fsm_event_t *event = cp_fsm_event_bare_new (
- ctx, CP_FSM_EVENT_TYPE_timeout_unassociating);
- cp_sta_core_gen_timed_event (ctx, &ctx->sta_action.assoc.timer, event,
- UNASSOC_RETRY_TIMEOUT_MS);
-}
-
-void
-cp_sta_action_unassoc__stop_retry_timer (cp_t *ctx)
-{
- dbg_assert (ctx);
- cp_sta_core_stop_timed_or_cyclic_event (
- ctx, &ctx->sta_action.assoc.timer);
-}
-
-void
-cp_eoc_sta_action_assoc__unassoc_no_beacons (cp_t *ctx)
-{
- cp_eoc_sta_action_sta_clear_status (ctx);
-}
-
-void
-cp_eoc_sta_action_unassoc__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
- cp_net_t *net, cp_sta_t *sta)
-{
- dbg_assert (ctx);
- dbg_assert (beacon);
- dbg_assert (net);
- dbg_assert (sta);
-
- ctx->sta_action.assoc.beacon_loss = 0;
-}
-
-/* release fsm, goto UNASSOC state: SLEEP, no action, normal situation */
-void
-cp_eoc_sta_action_assoc__sleep_authenticated_no_beacons (cp_t *ctx)
-{
- dbg_assert (ctx);
-}
-
-/* Find the place for this function and meaning TODO */
-void
-cp_eoc_sta_action_assoc__associated_encrypt_payload_rsp (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
-}
-
-
-void
-cp_eoc_sta_action_auth__authenticated_set_out_lev(cp_t *ctx, cp_mme_rx_t *mme)
-{
- dbg_assert(ctx);
-
- uint output_level;
- bool ok;
-
- ok = cp_msg_eoc_sta_vs_set_out_lev_ind_receive(ctx, mme, &output_level);
- if (ok)
- {
- /* Check if output_level has reserved value i.e. 0 */
- if (output_level)
- ctx->sta_mgr.sta_own_data.output_level = output_level;
-
- cp_mme_peer_t peer;
- peer.tei = MAC_TEI_FOREIGN;
- peer.mac = ctx->sta_mgr.sta_own_data.mac_addr;
- peer.eth_type = HPAV_MTYPE_MME;
- peer.vlan_tci = 0;
- cp_msg_vs_eoc_cco_set_out_lev_ind_send (ctx, &peer,
- ctx->sta_mgr.sta_own_data.output_level);
- DBG_PRINT_2 ("out_lev = %d", ctx->sta_mgr.sta_own_data.output_level);
- }
+ RETRY_TIMEOUT_MS);
+#endif
}
diff --git a/cesar/cp/eoc/sta/action/src/assoc_slave.c b/cesar/cp/eoc/sta/action/src/assoc_slave.c
new file mode 100644
index 0000000000..955e132231
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/src/assoc_slave.c
@@ -0,0 +1,657 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eoc/sta/action/src/assoc.c
+ * \brief STA action, association related definitions.
+ * \ingroup cp_eoc_sta_action
+ */
+#include "common/std.h"
+
+/* Private headers. */
+#include "cp/eoc/sta/action/inc/assoc.h"
+#include "cp/inc/context.h"
+#include "mac/sar/inc/context.h"
+#include "mac/pbproc/inc/context.h"
+#include "cp/eoc/inc/dbg_print.h"
+#include "cp/eoc/msg/inc/msg_vs.h"
+
+/* Public headers. */
+#include "cp/eoc/sta/action/action.h"
+#include "cp/eoc/sta/action/assoc_slave.h"
+#include "cp/eoc/sta/mgr/sta_own_data.h"
+#include "cp/sta/action/action.h"
+#include "cp/msg/msg.h"
+#include "cp/eoc/beacon/beacon.h"
+#include "mac/sar/sar.h"
+#include "mac/common/ntb.h"
+#include "hal/gpio/gpio.h"
+#include "cp/eoc/cco/bw/bw.h"
+
+/* Config headers. */
+#include "config/cp/eoc/sta.h"
+
+
+#if CONFIG_CP_EOC_STA_CON_ALLOWED
+static u32 mem=0, auth_time=0;
+static sar_stats_t sar_offset;
+#endif
+
+void
+cp_eoc_sta_action_sta_clear_status (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ cp_sta_own_data_set_authenticated_status (ctx, false);
+ cp_sta_own_data_set_tei (ctx, MAC_TEI_UNASSOCIATED);
+ ctx->sta_action.assoc.retry = 0;
+ ctx->sta_action.assoc.beacon_loss = 0;
+ ctx->sta_action.assoc.init_count = CP_EOC_STA_ASSOC_REQ_OFFSET;
+ cp_sta_own_data_t *own_data = cp_sta_mgr_get_sta_own_data (ctx);
+ cp_net_t * net = cp_sta_mgr_get_our_avln (ctx);
+
+ cp_sta_t * sta = NULL;
+ if (own_data->tei_track != MAC_TEI_UNASSOCIATED)
+ sta = cp_sta_mgr_sta_get_assoc (ctx, net, own_data->tei_track);
+ if (sta)
+ {
+ ctx->sta_mgr.sta_own_data.state = CP_EOC_STA_STATE_UNASSOCIATED;
+ cp_eoc_sta_action_drv__drv_sta_get_status_ind(ctx);
+
+ cp_sta_set_authenticated (ctx, sta, false);
+ cp_sta_mgr_sta_remove (ctx, sta);
+ slab_release (sta);
+ }
+ own_data->tei_track = MAC_TEI_UNASSOCIATED;
+ own_data->cco_mac_addr_track = MAC_ZERO;
+ cp_beacon_process_untracked_avln (ctx);
+ cp_eoc_cco_bw_sta_allocations (ctx);
+ dbg_assert (ctx->sta_action.assoc.assoc_req_retry_nb
+ < CP_EOC_ASSOC_REQ_RETRY_LIMIT);
+}
+
+void
+cp_eoc_sta_action_assoc__detecting_detected (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ /* Send association request. */
+ cp_msg_cc_assoc_req_t data = {
+ CP_MSG_CC_ASSOC_REQ_TYPE_NEW,
+ cp_sta_own_data_get_nid (ctx),
+ CP_CCO_LEVEL,
+ CP_PCO_CAP
+ };
+ cp_msg_cc_assoc_req_send (ctx, &ctx->sta_action.assoc.peer, &data);
+ /* Increase global number of assoc request */
+ ctx->sta_action.assoc.assoc_req_retry_nb ++;
+}
+
+void
+cp_eoc_sta_action_assoc__detecting_timeout (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ cp_fsm_trigger_new_event (ctx, bare, nd_beacon_timeout);
+}
+
+void
+cp_eoc_sta_action_detect__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
+ cp_net_t *net, cp_sta_t *sta)
+{
+ dbg_assert (ctx);
+ dbg_assert (beacon);
+ dbg_assert (net);
+ dbg_assert (sta);
+
+ cp_nid_t our_nid = cp_sta_own_data_get_nid (ctx);
+ cp_nid_t its_nid = cp_net_get_nid (ctx, net);
+ ctx->sta_action.assoc.beacon_loss = 0;
+
+ if (cp_beacon_synchronised (ctx))
+ {
+ if (ctx->sta_action.assoc.init_count > 0)
+ ctx->sta_action.assoc.init_count--;
+
+ if (ctx->sta_action.assoc.init_count <= 0)
+ {
+ if (its_nid == our_nid)
+ {
+ cp_sta_own_data_t *own_data = cp_sta_mgr_get_sta_own_data (ctx);
+ /* set proper data for tracked AVLN. on second call send assoc. */
+ if (own_data->tei_track != MAC_TEI_UNASSOCIATED)
+ cp_fsm_post_new_event (ctx, bare, nd_beacon);
+ }
+ }
+ }
+ if (its_nid == our_nid)
+ {
+ cp_sta_get_peer (sta, &ctx->sta_action.assoc.peer);
+ /* track beacon as soon as possible, sync is important */
+ cp_sta_own_data_t *own_data = cp_sta_mgr_get_sta_own_data (ctx);
+ /* set proper data for tracked AVLN. on secon call send assoc */
+ if (own_data->tei_track == MAC_TEI_UNASSOCIATED)
+ {
+ own_data->tei_track = ctx->sta_action.assoc.peer.tei;
+ own_data->cco_mac_addr_track = ctx->sta_action.assoc.peer.mac;
+ cp_beacon_process_tracked_avln (ctx, beacon, net);
+ }
+ }
+}
+
+void
+cp_eoc_sta_action_assoc__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
+ cp_net_t *net, cp_sta_t *sta)
+{
+ dbg_assert (ctx);
+ dbg_assert (beacon);
+ dbg_assert (net);
+ dbg_assert (sta);
+
+ ctx->sta_action.assoc.beacon_loss = 0;
+}
+
+void
+cp_eoc_sta_action_auth__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
+ cp_net_t *net, cp_sta_t *sta)
+{
+ dbg_assert (ctx);
+ dbg_assert (beacon);
+ dbg_assert (net);
+ dbg_assert (sta);
+
+ ctx->sta_action.assoc.beacon_loss = 0;
+ /* check consecc polling count */
+ if (ctx->pbproc->polled)
+ {
+ ctx->sta_action.assoc.retry=0;
+ ctx->pbproc->polled = false;
+ }
+ else
+ {
+ if (cp_sta_own_data_get_authenticated_status (ctx)
+ && ++ctx->sta_action.assoc.retry >= CP_EOC_NOT_POLLED_NB)
+ {
+ ctx->sta_action.assoc.retry = 0;
+ cp_fsm_post_new_event (ctx, bare, to_leave);
+ return;
+ }
+ }
+#if CONFIG_CP_EOC_STA_CON_ALLOWED
+ if (++mem >= CP_EOC_BEACON_1S_NB)
+ {
+ auth_time++;
+ mem = 0;
+ char temp[128];
+ sprintf (temp, "sta=%d blk=%d sar[%d,%d,%d,%d,%d,%d,%d] pb[%d]\n",
+ auth_time, blk_free_nb (),
+ SUB_STAT (rx_jobs_count),
+ ctx->sar->stats.rx_jobs_waiting_count,
+ SUB_STAT (rx_pb_count),
+ SUB_STAT (rx_pb_rejected),
+ SUB_STAT (rx_pb_crc_error_count),
+ SUB_STAT (tx_pb_expired),
+ SUB_STAT (rx_pb_expired),
+ ctx->pbproc->stats.tx_data_cancel
+ + ctx->pbproc->stats.tx_data_wack_noack);
+ sar_offset = ctx->sar->stats;
+ int pos = 0, len = strlen (temp), len1;
+ while (pos < len)
+ {
+ char * temp1 = temp + pos, tmpa[32];
+ len1 = MIN (len, pos + 20);
+ strncpy (tmpa, temp1, len1 - pos);
+ tmpa[len1 - pos] = '\0';
+ printf (tmpa);
+ pos = len1;
+ }
+ }
+#endif
+}
+
+void
+cp_eoc_sta_action_assoc__associating_timeout (cp_t *ctx)
+{
+ ctx->sta_mgr.sta_own_data.num_bad_could_not_assoc ++;
+ if (ctx->sta_action.assoc.retry++ < CP_EOC_NUM_RETRY)
+ {
+ cp_fsm_branch (ctx, ASSOCIATING, timeout_associating, retry);
+ }
+ else
+ {
+ cp_fsm_branch (ctx, ASSOCIATING, timeout_associating, no_retry);
+ cp_eoc_sta_action_sta_clear_status (ctx);
+ }
+}
+
+void
+cp_eoc_sta_action_assoc__associating_cnf (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ cp_msg_cc_assoc_cnf_t cnf;
+ bool added;
+ mfs_tx_t *mfs;
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ /* confirmation is received, reset counter
+ * result is not relevant, only that ASSOC.CNF is received. */
+ ctx->sta_action.assoc.assoc_req_retry_nb = 0;
+ bool status = cp_msg_cc_assoc_cnf_receive (ctx, mme, &cnf);
+ /* change dak and result */
+ if (status && cnf.result
+ == CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS_WL_ACCEPT_ALL)
+ {
+ cp_key_t key = cp_secu_generate_keys (ctx, (u8 *) MASTER_GOLDEN_DPW,
+ strlen (MASTER_GOLDEN_DPW), CP_SECU_SALT_KEY_DAK);
+ cp_sta_own_data_set_dak (ctx, key);
+ cnf.result = CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS;
+ }
+ else if (status && cnf.result == CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS)
+ cp_sta_own_data_set_dak (
+ ctx, cp_eoc_sta_own_data_get_original_dak (ctx));
+ /* Check response. */
+ if (mme->peer.mac != ctx->sta_action.assoc.peer.mac
+ || mme->peer.tei == 0
+ || !status
+ || cnf.nid != cp_sta_own_data_get_nid (ctx))
+ {
+ /* Unrelated message, drop. */
+ cp_fsm_branch (ctx, ASSOCIATING, CC_ASSOC_CNF, unrelated);
+ }
+ else if (cnf.result != CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS)
+ {
+ /* Negative result, station not associated */
+ ctx->sta_mgr.sta_own_data.num_bad_assoc_failure ++;
+ cp_fsm_branch (ctx, ASSOCIATING, CC_ASSOC_CNF, unsuccess);
+ }
+ else
+ {
+ /* Update state. */
+ cp_sta_own_data_set_tei (ctx, cnf.sta_tei);
+ cp_sta_own_data_t *own_data = cp_sta_mgr_get_sta_own_data (ctx);
+ own_data->tei_track = ctx->sta_action.assoc.peer.tei;
+
+ /* Create request for KEYs */
+ cp_msg_cm_get_key_req_t get_key = {
+ .relayed = false, .key_type = CP_MSG_KEY_NEK,
+ .nid = cp_sta_own_data_get_nid (ctx) };
+ cp_secu_protocol_run_new (&ctx->sta_action.assoc.prun, 0, &ctx->rnd);
+
+ mfs = mac_store_mfs_add_tx (ctx->mac_store, false, true,
+ MAC_LID_NONE,
+ mme->peer.tei, &added);
+ if (added)
+ sar_mfs_add (ctx->sar, (mfs_t *)mfs);
+
+ if (mfs)
+ blk_release (mfs);
+
+ /*STA is authenticated data can be transferred */
+ mfs = mac_store_mfs_add_tx (ctx->mac_store, false, false,
+ MAC_LLID_MIN,
+ mme->peer.tei, &added);
+ if(added)
+ sar_mfs_add (ctx->sar, (mfs_t *)mfs);
+
+ if (mfs)
+ blk_release (mfs);
+
+ cp_msg_cm_get_key_req_send (ctx, &mme->peer, CP_MME_PEKS_DAK,
+ &ctx->sta_action.assoc.prun, &get_key);
+ /* Change state. */
+ cp_fsm_branch (ctx, ASSOCIATING, CC_ASSOC_CNF, success);
+ DBG_PRINT("sta: assoc");
+
+ ctx->sta_mgr.sta_own_data.state = CP_EOC_STA_STATE_ASSOCIATED;
+ cp_eoc_sta_action_drv__drv_sta_get_status_ind (ctx);
+ }
+}
+
+void
+cp_eoc_sta_action_assoc__associating_no_beacons (cp_t *ctx)
+{
+ cp_eoc_sta_action_sta_clear_status (ctx);
+}
+
+/* Simply goto detecting beacon and wait for beacon to start assoc */
+void
+cp_eoc_sta_action_assoc__unassociated_retry (cp_t *ctx)
+{
+ dbg_assert (ctx);
+}
+
+void
+cp_eoc_sta_action_assoc__associated_key_cnf (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ cp_msg_cm_get_key_cnf_t cnf;
+ bool added, accepted = true;
+ mfs_tx_t *mfs;
+ /* Check response. */
+ if (!cp_mme_peer_cmp (&mme->peer, &ctx->sta_action.assoc.peer)
+ || !cp_msg_cm_get_key_cnf_receive (ctx, mme, &cnf)
+ || !cp_secu_protocol_check (&ctx->sta_action.assoc.prun, &mme->prun,
+ CP_SECU_PROTOCOL_RUN_CHECK_RESULT_NEXT)
+ || cnf.nid != cp_sta_own_data_get_nid (ctx)
+ || (mme->peks != CP_MME_PEKS_DAK))
+ accepted = false;
+
+ if (!accepted)
+ {
+ /* Unrelated message, drop. */
+ cp_fsm_branch (ctx, ASSOCIATED, CM_GET_KEY_CNF, unrelated);
+ }
+ else if (cnf.result != CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED)
+ {
+ /* Failure indication. */
+ cp_fsm_branch (ctx, ASSOCIATED, CM_GET_KEY_CNF, not_granted);
+ }
+ else if (cnf.key_type == CP_MSG_KEY_NEK)
+ {
+ /* Use the first nex_index from msg, BEACON */
+ /* Use the new key. */
+ cp_eoc_beacon_nek_index_adjust (ctx, cnf.eks);
+ cp_beacon_change_nek (ctx, cnf.eks, cnf.key, true);
+ /*STA is authenticated data can be transferred */
+ mfs = mac_store_mfs_add_tx (ctx->mac_store, false, false,
+ MAC_LLID_MIN,
+ mme->peer.tei, &added);
+ if(added)
+ sar_mfs_add (ctx->sar, (mfs_t *)mfs);
+ if (mfs)
+ blk_release (mfs);
+ /* Signal joined state.
+ * TODO: cp_fsm_trigger_new_event (ctx, bare, joined); */
+ /* Reset beacon loss counter. */
+ ctx->sta_action.assoc.beacon_loss = 0;
+ cp_fsm_branch (ctx, ASSOCIATED, CM_GET_KEY_CNF, all_keys_granted);
+ ctx->sta_mgr.sta_own_data.num_good_assoc_auth ++;
+
+ /* Create request for KEYs */
+ cp_msg_cm_get_key_req_t get_key = {
+ .relayed = false, .key_type = CP_MSG_KEY_TEK,
+ .nid = cp_sta_own_data_get_nid (ctx) };
+ cp_secu_protocol_run_new (&ctx->sta_action.assoc.prun, 0, &ctx->rnd);
+
+ cp_msg_cm_get_key_req_send (ctx, &mme->peer, CP_MME_PEKS_DAK,
+ &ctx->sta_action.assoc.prun, &get_key);
+ ctx->sta_mgr.sta_own_data.state = CP_EOC_STA_STATE_AUTHENTICATED;
+ cp_eoc_sta_action_drv__drv_sta_get_status_ind (ctx);
+ }
+}
+
+void
+cp_eoc_sta_action_auth__authenticated_key_cnf (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ cp_msg_cm_get_key_cnf_t cnf;
+ bool accepted = true;
+
+ /* Check response. */
+ if (!cp_mme_peer_cmp (&mme->peer, &ctx->sta_action.assoc.peer)
+ || !cp_msg_cm_get_key_cnf_receive (ctx, mme, &cnf)
+ || !cp_secu_protocol_check (&ctx->sta_action.assoc.prun, &mme->prun,
+ CP_SECU_PROTOCOL_RUN_CHECK_RESULT_LAST)
+ || cnf.nid != cp_sta_own_data_get_nid (ctx)
+ || (mme->peks != CP_MME_PEKS_DAK))
+ accepted = false;
+
+ if (accepted
+ && cnf.key_type == CP_MSG_KEY_TEK
+ && cnf.result == CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED)
+ {
+ /* Use the new key. TODO Stop time timer */
+ cp_sta_own_data_set_authenticated_status (ctx, true);
+ // Get the network.
+ cp_net_t *net = cp_sta_mgr_get_our_avln (ctx);
+ cp_sta_t *sta =
+ cp_sta_mgr_sta_get_assoc (ctx, net, mme->peer.tei);
+
+ if (sta)
+ {
+ cp_sta_set_authenticated (ctx, sta, true);
+ slab_release (sta);
+ }
+ DBG_PRINT("sta: auth eks=%d", cnf.eks);
+ }
+}
+
+void
+cp_eoc_sta_action_auth__authenticated_set_key_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ /* Get our CCo. */
+ cp_net_t *net = cp_sta_mgr_get_our_avln (ctx);
+ cp_mme_peer_t peer;
+ cp_net_get_cco_peer (ctx, net, &peer);
+ /* Check received message. */
+ cp_msg_cm_set_key_req_t req;
+
+ if (cp_mme_peer_cmp (&mme->peer, &peer)
+ && cp_msg_cm_set_key_req_receive (ctx, mme, &req)
+ && req.nid == cp_sta_own_data_get_nid (ctx))
+ {
+ if ((req.key_type == CP_MSG_KEY_NEK)
+ && (mme->peks == CP_MME_PEKS_DAK)
+ && (cp_secu_protocol_check
+ (&ctx->sta_action.nek_prun, &mme->prun,
+ CP_SECU_PROTOCOL_RUN_CHECK_RESULT_NEXT)))
+ {
+
+ ctx->sta_action.nek_prun = mme->prun;
+ /* Send response. */
+ cp_msg_cm_set_key_cnf_t cnf = {
+ CP_MSG_CM_SET_KEY_CNF_RESULT_SUCCESS,
+ CP_CCO_LEVEL };
+ cp_secu_protocol_next (&ctx->sta_action.nek_prun, &ctx->rnd,
+ true);
+ cp_msg_cm_set_key_cnf_send (ctx, &peer, CP_MME_PEKS_DAK,
+ &ctx->sta_action.nek_prun,
+ &cnf);
+ /* Update NEK. */
+ cp_beacon_change_nek (ctx, req.new_eks, req.new_key, false);
+ DBG_PRINT("key_exc: eks=%d", req.new_eks);
+ }
+ else if ((req.key_type == CP_MSG_KEY_NONCE_ONLY)
+ && (mme->peks == CP_MME_PEKS_DAK)
+ && (cp_secu_protocol_check
+ (NULL, &mme->prun, CP_SECU_PROTOCOL_RUN_CHECK_RESULT_NEW)))
+ {
+ /* Send response. */
+ cp_msg_cm_set_key_cnf_t cnf = {
+ CP_MSG_CM_SET_KEY_CNF_RESULT_SUCCESS,
+ CP_CCO_LEVEL };
+
+ ctx->sta_action.nek_prun = mme->prun;
+ cp_secu_protocol_next (&ctx->sta_action.nek_prun, &ctx->rnd,
+ false);
+ ctx->sta_action.nek_prun.my_nonce = lib_rnd32 (&ctx->rnd);
+ cp_msg_cm_set_key_cnf_send (ctx, &peer, CP_MME_PEKS_DAK,
+ &ctx->sta_action.nek_prun,
+ &cnf);
+ }
+ }
+ else
+ {
+ /* Send response. */
+ cp_msg_cm_set_key_cnf_t cnf = {
+ CP_MSG_CM_SET_KEY_CNF_RESULT_FAILURE,
+ CP_CCO_LEVEL };
+ cp_secu_protocol_run_t prun = mme->prun;
+ prun.my_nonce = lib_rnd32 (&ctx->rnd);
+ cp_secu_protocol_next (&prun, &ctx->rnd, true);
+ cp_msg_cm_set_key_cnf_send (ctx, &peer, CP_MME_PEKS_DAK, &prun,
+ &cnf);
+ }
+}
+
+/* Leave state and start detection again */
+void
+cp_eoc_sta_action_assoc__associated_no_beacons (cp_t *ctx)
+{
+ cp_eoc_sta_action_sta_clear_status (ctx);
+}
+
+/* Left assosiation and goto unassoc state and go again: */
+void
+cp_eoc_sta_action_assoc__associated_timeout (cp_t *ctx)
+{
+ ctx->sta_mgr.sta_own_data.num_bad_could_not_auth ++;
+ cp_eoc_sta_action_sta_clear_status (ctx);
+}
+
+void
+cp_eoc_sta_action_assoc__associated_leave (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+
+ /* Check received message. */
+ enum cp_msg_cc_leave_ind_reason_t reason;
+ cp_nid_t nid;
+
+ ctx->sta_mgr.sta_own_data.num_leave ++;
+ if (cp_msg_cc_leave_ind_receive (ctx, mme, &reason, &nid)
+ && nid == cp_sta_own_data_get_nid (ctx))
+ {
+ cp_msg_cc_leave_rsp_send (ctx, &mme->peer);
+ cp_fsm_branch (ctx, ASSOCIATED, CC_LEAVE_IND, ok);
+ cp_eoc_sta_action_sta_clear_status (ctx);
+ }
+ else
+ {
+ cp_fsm_branch (ctx, ASSOCIATED, CC_LEAVE_IND, nok);
+ }
+}
+
+/* start LEAVE process: TODO */
+void
+cp_eoc_sta_action_assoc__authenticated_leave (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+
+ /* Check received message. */
+ enum cp_msg_cc_leave_ind_reason_t reason;
+ cp_nid_t nid;
+
+ ctx->sta_mgr.sta_own_data.num_leave ++;
+ if (cp_msg_cc_leave_ind_receive (ctx, mme, &reason, &nid)
+ && nid == cp_sta_own_data_get_nid (ctx))
+ {
+ cp_msg_cc_leave_rsp_send (ctx, &mme->peer);
+ cp_fsm_branch (ctx, AUTHENTICATED, CC_LEAVE_IND, ok);
+ cp_eoc_sta_action_sta_clear_status (ctx);
+ }
+ else
+ {
+ cp_fsm_branch (ctx, AUTHENTICATED, CC_LEAVE_IND, nok);
+ }
+}
+
+/* Actions to left auth state: start LEAVE process TODO */
+void
+cp_eoc_sta_action_assoc__authenticated_no_beacons (cp_t *ctx)
+{
+ cp_eoc_sta_action_sta_clear_status (ctx);
+}
+
+void
+cp_eoc_sta_action_assoc__beacon_not_received (cp_t *ctx)
+{
+ static int ltra = 0;
+ if (ltra > 5) ltra = 0; else ltra++;
+ GPIO_SET (LED_TRAFFIC, !ltra);
+
+ dbg_assert (ctx);
+ ctx->sta_action.assoc.beacon_loss++;
+ if (ctx->sta_action.assoc.beacon_loss > CP_MAX_NO_BEACON)
+ {
+ ctx->sta_action.assoc.beacon_loss = 0;
+ cp_fsm_trigger_new_event (ctx, bare, no_beacons);
+ }
+#if CONFIG_CP_EOC_STA_CON_ALLOWED
+ DBG_PRINT ("d=%u bcn_not_rcv", phy_date () / MAC_MS_TO_TCK (1));
+#endif
+}
+
+void
+cp_eoc_sta_action_unassoc__start_retry_timer (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ /* randomize start of assoc process */
+ ctx->sta_action.assoc.init_count = CP_EOC_STA_ASSOC_REQ_OFFSET;
+ cp_fsm_event_t *event = cp_fsm_event_bare_new (
+ ctx, CP_FSM_EVENT_TYPE_timeout_unassociating);
+ cp_sta_core_gen_timed_event (ctx, &ctx->sta_action.assoc.timer, event,
+ UNASSOC_RETRY_TIMEOUT_MS);
+}
+
+void
+cp_eoc_sta_action_unassoc__stop_retry_timer (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ cp_sta_core_stop_timed_or_cyclic_event (
+ ctx, &ctx->sta_action.assoc.timer);
+}
+
+/* Find the place for this function and meaning TODO */
+void
+cp_eoc_sta_action_assoc__associated_encrypt_payload_rsp (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+}
+
+void
+cp_eoc_sta_action_auth__authenticated_set_out_lev(cp_t *ctx, cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+
+ uint output_level;
+ bool ok;
+
+ ok = cp_msg_eoc_sta_vs_set_out_lev_ind_receive (ctx, mme, &output_level);
+ if (ok)
+ {
+ /* Check if output_level has reserved value i.e. 0 */
+ if (output_level)
+ ctx->sta_mgr.sta_own_data.output_level = output_level;
+
+ cp_mme_peer_t peer;
+ peer.tei = MAC_TEI_FOREIGN;
+ peer.mac = ctx->sta_mgr.sta_own_data.mac_addr;
+ peer.eth_type = HPAV_MTYPE_MME;
+ peer.vlan_tci = 0;
+ cp_msg_vs_eoc_cco_set_out_lev_ind_send (
+ ctx, &peer, ctx->sta_mgr.sta_own_data.output_level);
+ DBG_PRINT_2 ("out_lev = %d", ctx->sta_mgr.sta_own_data.output_level);
+ }
+}
+
+void
+cp_eoc_sta_action_assoc__detecting_no_beacons (cp_t *ctx)
+{
+ cp_eoc_sta_action_sta_clear_status (ctx);
+}
+
+void
+cp_eoc_sta_action_assoc__unassoc_no_beacons (cp_t *ctx)
+{
+ cp_eoc_sta_action_sta_clear_status (ctx);
+}
+
+void
+cp_eoc_sta_action_unassoc__beacon_received (
+ cp_t *ctx, bsu_beacon_t *beacon, cp_net_t *net, cp_sta_t *sta)
+{
+ dbg_assert (ctx);
+ dbg_assert (beacon);
+ dbg_assert (net);
+ dbg_assert (sta);
+
+ ctx->sta_action.assoc.beacon_loss = 0;
+}
diff --git a/cesar/cp/eoc/sta/action/src/cco_stub.c b/cesar/cp/eoc/sta/action/src/cco_stub.c
deleted file mode 100644
index c087cf04f5..0000000000
--- a/cesar/cp/eoc/sta/action/src/cco_stub.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp/eoc/sta/action/src/assoc.c
- * \brief STA action, association related definitions.
- * \ingroup cp_eoc_sta_action
- */
-#include "common/std.h"
-
-#include "cp/sta/action/action.h"
-
-#include "cp/inc/context.h"
-#include "cp/fsm/fsm.h"
-#include "cp/msg/msg.h"
-#include "cp/beacon/beacon.h"
-#include "cp/eoc/multi_sta/action/multi_sta_action.h"
-#include "cp/eoc/inc/dbg_print.h"
-
-#define CP_EOC_STA_ASSOCIATED_TIMEOUT_MS 5*1000
-
-/** Maximum number of released TEIs printed on console for each GC call. */
-#define CCO_STA_CON 4
-
-void
-cp_sta_action_assoc_init (cp_t *ctx)
-{
- dbg_assert (ctx);
- ctx->sta_action.assoc.assoc_req_retry_nb = 0;
-}
-
-void
-cp_sta_action_assoc_leave (cp_t *ctx)
-{
- dbg_assert (ctx);
- /* Trigger to_leave event. */
- cp_fsm_trigger_new_event (ctx, bare, no_beacons);
-}
-
-/**
- * initialisation of CCo action module.
- * \param ctx the module context.
- * FAKE: TODO
- */
-void
-cp_cco_action_init (cp_t *ctx)
-{
- dbg_assert (ctx);
-
- memset (&ctx->cco_action, 0, sizeof (cp_cco_action_t));
-}
-
-/**
- * Uninitialisation of CCo action module.
- * \param ctx the module context.
- * FAKE: TODO
- */
-void
-cp_cco_action_uninit (cp_t *ctx)
-{
- dbg_assert (ctx);
-}
-
-void
-cp_net_garbage_station_list (cp_t *ctx, cp_net_t *net, u32 date_ms,
- cp_net_sta_status_t assoc);
-/**
- * perform garbage actions of CCo's responsibility.
- * \param ctx the module context.
- */
-void
-cp_cco_action_garbage (cp_t *ctx)
-{
- int i, released_sta_nb = 0, released_sta_tei [CCO_STA_CON];
- dbg_assert (ctx);
- cp_net_t * net = cp_sta_mgr_get_our_avln (ctx);
-
- /* Check if associated sta got disconnected */
- for (i = MAC_TEI_STA_MIN_EOC; i < MAC_TEI_STA_MAX; i++)
- {
- cp_sta_t * station = cp_sta_mgr_sta_get_assoc (ctx, net, i);
- if (!station) continue;
- sta_t * sta = mac_store_sta_get (ctx->mac_store, i);
- /* cp sta is assoc but no mac store sta? realy wrong. */
- dbg_assert (sta);
- /* station is declared dead by lower layers? */
- if(!sta->tdma_poll && sta->authenticated)
- station->authenticated_to_unassociated = true;
- /* release station, no answers + to long in assoc. state */
- if ((!sta->tdma_poll && sta->authenticated)
- || (!sta->authenticated && (station->associated_date_ms
- + CP_EOC_STA_ASSOCIATED_TIMEOUT_MS
- < cp_sta_core_get_date_ms (ctx))))
- {
- cp_eoc_multi_sta_action_put_sta_unassociated (ctx, station);
- /* Start release procedure */
- cp_sta_mgr_release_station (ctx, i);
-
- if (sta->authenticated)
- {
- if (released_sta_nb < CCO_STA_CON)
- released_sta_tei [released_sta_nb] = i;
- released_sta_nb++;
- DBG_PRINT_2 ("sta: rel, tei=%d", i);
- }
- else
- DBG_PRINT ("sta: auth fail, tei=%d", i);
- }
- slab_release (station);
- blk_release (sta);
- }
- /* Check if unassociated sta is still in the network */
- cp_net_garbage_station_list (ctx, cp_sta_mgr_get_our_avln (ctx),
- cp_sta_core_get_date_ms (ctx),
- CP_NET_STA_UNASSOC);
-
- if (released_sta_nb)
- {
- DBG_PRINTC ("rel: %d; TEI:", released_sta_nb);
- for (i = 0; ((i < released_sta_nb) && (i < CCO_STA_CON)); i++)
- DBG_PRINTC (" %d", released_sta_tei [i]);
- DBG_PRINTC (released_sta_nb > CCO_STA_CON ? " ...\n" : "\n");
- }
-}
-
-/**
- * Release a TEI.
- * \param ctx the module context.
- * \param tei The TEI value to release.
- */
-void
-cp_cco_action_tei_release (cp_t *ctx, u8 tei)
-{
- uint row;
-
- dbg_assert (ctx);
- dbg_assert (tei);
-
- row = tei / CP_CCO_ACTION_TEI_FLAGS_ROW_SIZE_BITS;
-
- ctx->cco_action.tei_flags[row] &= ~(1 << ((tei
- % CP_CCO_ACTION_TEI_FLAGS_ROW_SIZE_BITS)-1));
-}
diff --git a/cesar/cp/eoc/sta/action/src/drv.c b/cesar/cp/eoc/sta/action/src/drv.c
index c93636abb5..5bd4a5f2ec 100644
--- a/cesar/cp/eoc/sta/action/src/drv.c
+++ b/cesar/cp/eoc/sta/action/src/drv.c
@@ -6,170 +6,45 @@
*
* }}} */
/**
- * \file cp/sta/action/src/drv.c
- * \brief STA action, driver related definitions.
- * \ingroup cp_sta_action
+ * \file cp/eoc/sta/action/src/drv.c
+ * \brief EoC STA action, driver related definitions.
+ * \ingroup cp_eoc_sta_action
*/
#include "common/std.h"
-#include "cp/sta/action/action.h"
+/* Private headers. */
+#include "cp/inc/context.h"
+/* Public headers. */
+#include "cp/sta/action/action.h"
#include "cp/msg/msg.h"
-#include "cp/inc/context.h"
-#include "cp/fsm/fsm.h"
#include "cp/eoc/cco/bw/bw.h"
-#include "lib/stats.h"
-#include "cp/msg/inc/msg_vs_eoc.h"
-#include "config/cp/msg/eoc.h"
-
-#include "stdio.h"
-
-void
-cp_sta_action_drv__stopped__drv_sta_set_mac_addr_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
- mac_t mac;
- bool ok = cp_msg_drv_sta_set_mac_addr_req_receive (ctx, mme, &mac);
- if (ok)
- cp_sta_own_data_set_mac_address (ctx, mac);
- cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_MAC_ADDR_CNF,
- ok ? CP_MSG_DRV_RESULT_SUCCESS
- : CP_MSG_DRV_RESULT_FAILURE);
-}
-
-void
-cp_sta_action_drv__stopped__drv_sta_set_cco_pref_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
- bool cco_pref;
- bool ok = cp_msg_drv_sta_set_cco_pref_req_receive (ctx, mme, &cco_pref);
- if (ok)
- {
- cp_sta_own_data_t *own = cp_sta_mgr_get_sta_own_data (ctx);
- own->cco_prefered = cco_pref;
- }
- cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_CCO_PREF_CNF,
- ok ? CP_MSG_DRV_RESULT_SUCCESS
- : CP_MSG_DRV_RESULT_FAILURE);
-}
-
-void
-cp_sta_action_drv__stopped__drv_sta_set_was_cco_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
- bool was_cco;
- bool ok = cp_msg_drv_sta_set_was_cco_req_receive (ctx, mme, &was_cco);
- if (ok)
- cp_sta_own_data_set_was_cco (ctx, was_cco);
- cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_WAS_CCO_CNF,
- ok ? CP_MSG_DRV_RESULT_SUCCESS
- : CP_MSG_DRV_RESULT_FAILURE);
-}
-
-void
-cp_sta_action_drv__stopped__drv_sta_set_npw_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
- char npw[CP_NPW_MAX_SIZE + 1];
- bool ok = cp_msg_drv_sta_set_npw_req_receive (ctx, mme, npw);
- if (ok)
- {
- /* Compute NID from received information. */
- cp_security_level_t sl;
- sl = cp_sta_own_data_get_security_level (ctx);
- cp_sta_own_data_set_npw (ctx, npw);
- cp_compute_nmk_and_nid_from_npw (ctx, npw, sl);
- }
- cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_NPW_CNF,
- ok ? CP_MSG_DRV_RESULT_SUCCESS
- : CP_MSG_DRV_RESULT_FAILURE);
-}
-
-void
-cp_sta_action_drv__stopped__drv_sta_set_dpw_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
- char dpw[CP_DPW_MAX_SIZE + 1];
- bool ok = cp_msg_drv_sta_set_dpw_req_receive (ctx, mme, dpw);
- if (ok)
- cp_sta_own_data_set_dpw (ctx, dpw);
- cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_DPW_CNF,
- ok ? CP_MSG_DRV_RESULT_SUCCESS
- : CP_MSG_DRV_RESULT_FAILURE);
-}
-void
-cp_sta_action_drv__stopped__drv_sta_set_sl_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
- cp_security_level_t sl;
- bool ok = cp_msg_drv_sta_set_sl_req_receive (ctx, mme, &sl);
- if (ok)
- {
- /* Compute NID from received information. */
- const char *npw;
- npw = cp_sta_own_data_get_npw (ctx);
-
- cp_sta_own_data_set_security_level (ctx, sl);
- cp_compute_nmk_and_nid_from_npw (ctx, npw, sl);
- }
- cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_SL_CNF,
- ok ? CP_MSG_DRV_RESULT_SUCCESS
- : CP_MSG_DRV_RESULT_FAILURE);
-}
-
-void
-cp_sta_action_drv__stopped__drv_sta_set_nid_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
- cp_nid_t nid;
- bool ok = cp_msg_drv_sta_set_nid_req_receive (ctx, mme, &nid);
- if (ok)
- cp_sta_own_data_set_nid (ctx, nid);
- cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_NID_CNF,
- ok ? CP_MSG_DRV_RESULT_SUCCESS
- : CP_MSG_DRV_RESULT_FAILURE);
-}
+/* Config headers. */
+#include "config/cp/msg/eoc.h"
-#if CONFIG_CP_MSG_EOC_DRV_MME
void
-cp_sta_action_drv__stopped__drv_sta_set_tonemask_req (cp_t *ctx,
- cp_mme_rx_t *mme)
+cp_eoc_sta_action_drv__stopped__drv_sta_set_tonemask_req (
+ cp_t *ctx, cp_mme_rx_t *mme)
{
u32 tonemask[PHY_TONEMASK_WORDS];
bool ok = cp_msg_drv_sta_set_tonemask_req_receive (ctx, mme, tonemask);
if (ok)
{
+#if CONFIG_CP_MSG_EOC_DRV_MME
/* Commit to mac configuration and update tonemask informations. */
memcpy (ctx->mac_config->tonemask_info.tonemask, tonemask,
sizeof (tonemask));
- bool adjust =
- tonemask_carrier_nb (ctx->mac_config->tonemask_info.tonemask) < 375;
- pbproc_parameters_adjust (ctx->pbproc, adjust);
- cp_eoc_cco_bw_allocations_adjust (ctx, adjust);
- tonemask_update (&ctx->mac_config->tonemask_info);
- /* Tonemask will be programmed once the PBProc is activated. */
- }
- cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_TONEMASK_CNF,
- ok ? CP_MSG_DRV_RESULT_SUCCESS
- : CP_MSG_DRV_RESULT_FAILURE);
-}
-
#else
-void
-cp_sta_action_drv__stopped__drv_sta_set_tonemask_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
- u32 tonemask[PHY_TONEMASK_WORDS];
- bool ok = cp_msg_drv_sta_set_tonemask_req_receive (ctx, mme, tonemask);
- if (ok)
- {
/* TODO. */
+#endif
bool adjust =
- tonemask_carrier_nb (ctx->mac_config->tonemask_info.tonemask) < 375;
+ tonemask_carrier_nb (ctx->mac_config->tonemask_info.tonemask)
+ < 375;
pbproc_parameters_adjust (ctx->pbproc, adjust);
cp_eoc_cco_bw_allocations_adjust (ctx, adjust);
+ /* Tonemask will be programmed once the PBProc is activated. */
tonemask_update (&ctx->mac_config->tonemask_info);
}
cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_TONEMASK_CNF,
@@ -177,51 +52,9 @@ cp_sta_action_drv__stopped__drv_sta_set_tonemask_req (cp_t *ctx,
: CP_MSG_DRV_RESULT_FAILURE);
}
-#endif
-
void
-cp_sta_action_drv__stopped__drv_sta_mac_start_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
- bool ok = cp_msg_drv_sta_mac_start_req_receive (ctx, mme);
- if (ok)
- {
- /* Start power-on procedure. */
- cp_sta_action_poweron_start (ctx);
- }
- cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_MAC_START_CNF,
- ok ? CP_MSG_DRV_RESULT_SUCCESS
- : CP_MSG_DRV_RESULT_FAILURE);
-
-}
-
-void
-cp_sta_action_drv__started__drv_sta_mac_stop_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
- dbg_assert (ctx);
- dbg_assert (mme);
- bool ok = cp_msg_drv_sta_mac_stop_req_receive (ctx, mme);
- /* This come from the driver, it should be OK. */
- dbg_assert (ok);
- /* Save driver address. */
- ctx->sta_action.drv_peer = mme->peer;
- /* Stop station. */
- cp_sta_action_poweron_stop (ctx);
-}
-
-void
-cp_sta_action_drv__stopping__stopped (cp_t *ctx)
-{
- dbg_assert (ctx);
- /* Signal the station is stopped. */
- cp_msg_drv_any_cnf_send (ctx, &ctx->sta_action.drv_peer,
- DRV_STA_MAC_STOP_CNF, CP_MSG_DRV_RESULT_SUCCESS);
-}
-
-
-void
-cp_sta_action_drv__stopped__drv_sta_set_key_req (cp_t *ctx, cp_mme_rx_t *mme)
+cp_eoc_sta_action_drv__stopped__drv_sta_set_key_req (
+ cp_t *ctx, cp_mme_rx_t *mme)
{
cp_key_t nmk;
enum cp_msg_drv_sta_set_key_type_t type;
@@ -230,11 +63,13 @@ cp_sta_action_drv__stopped__drv_sta_set_key_req (cp_t *ctx, cp_mme_rx_t *mme)
dbg_assert (ctx);
dbg_assert (mme);
+
/* Try to decode the DRV MME. */
if (cp_msg_drv_sta_set_key_req_receive (ctx, mme, &nmk, &type, &nid, &sl))
{
/* Set the NMK. */
cp_sta_own_data_set_nmk (ctx, nmk, type);
+
/* We need to have a NID; let's build it if we do not have one. */
if (type == CP_MSG_DRV_STA_SET_KEY_TYPE_CHANGE_SECURITY_LEVEL)
{
@@ -261,115 +96,9 @@ cp_sta_action_drv__stopped__drv_sta_set_key_req (cp_t *ctx, cp_mme_rx_t *mme)
}
}
-
-
-void
-cp_sta_action_drv__stopped__drv_sta_set_dak_req (cp_t *ctx, cp_mme_rx_t *mme)
-{
- cp_key_t dak;
- dbg_assert (ctx);
- dbg_assert (mme);
-
- if (cp_msg_drv_sta_set_dak_req_receive (ctx, mme, &dak))
- {
- cp_sta_own_data_set_dak (ctx, dak);
- cp_sta_own_data_set_original_dak (ctx, dak);
- cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_DAK_CNF,
- CP_MSG_DRV_RESULT_SUCCESS);
- }
- else
- {
- cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_DAK_CNF,
- CP_MSG_DRV_RESULT_FAILURE);
- }
-}
-
-void
-cp_sta_action_drv__stopped__drv_sta_set_m_sta_hfid_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
- char m_sta_hfid[CP_HFID_SIZE + 1];
- bool ok = cp_msg_drv_sta_set_m_sta_hfid_req_receive (ctx, mme,
- m_sta_hfid);
- if (ok)
- cp_sta_own_data_set_hfid_manufacturer (ctx, m_sta_hfid);
- cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_M_STA_HFID_CNF,
- ok ? CP_MSG_DRV_RESULT_SUCCESS
- : CP_MSG_DRV_RESULT_FAILURE);
-}
-
void
-cp_sta_action_drv__stopped__drv_sta_set_u_sta_hfid_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
- char u_sta_hfid[CP_HFID_SIZE + 1];
- bool ok = cp_msg_drv_sta_set_u_sta_hfid_req_receive (ctx, mme,
- u_sta_hfid);
- if (ok)
- cp_sta_own_data_set_hfid_user (ctx, u_sta_hfid);
- cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_U_STA_HFID_CNF,
- ok ? CP_MSG_DRV_RESULT_SUCCESS
- : CP_MSG_DRV_RESULT_FAILURE);
-}
-
-void
-cp_sta_action_drv__stopped__drv_sta_set_avln_hfid_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
- char avln_hfid[CP_HFID_SIZE + 1];
- bool ok = cp_msg_drv_sta_set_avln_hfid_req_receive (ctx, mme, avln_hfid);
- if (ok)
- cp_sta_own_data_set_hfid_avln (ctx, avln_hfid);
- cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_AVLN_HFID_CNF,
- ok ? CP_MSG_DRV_RESULT_SUCCESS
- : CP_MSG_DRV_RESULT_FAILURE);
-}
-
-void
-cp_sta_action_drv__drv_sta_get_key_req (cp_t *ctx, cp_mme_rx_t *mme)
-{
- cp_msg_drv_sta_get_key_t data;
- dbg_assert (ctx);
- dbg_assert (mme);
-
- memset (&data, 0, sizeof (cp_msg_drv_sta_get_key_t));
- if (cp_msg_drv_sta_get_key_req_receive (ctx, mme))
- {
- data.result = CP_MSG_DRV_RESULT_SUCCESS;
- data.nmk = cp_sta_own_data_get_nmk (ctx);
- data.nid = cp_sta_own_data_get_nid (ctx);
- data.sl = cp_sta_own_data_get_security_level (ctx);
-
- cp_msg_drv_sta_get_key_cnf_send (ctx, &mme->peer, &data);
- }
- else
- {
- data.result = CP_MSG_DRV_RESULT_FAILURE;
- cp_msg_drv_sta_get_key_cnf_send (ctx, &mme->peer, &data);
- }
-}
-
-void
-cp_sta_action_drv__drv_sta_set_config_req (cp_t *ctx, cp_mme_rx_t *mme)
-{
- /* Check parameter. */
- dbg_assert (mme);
-
- char config[HPAV_MME_PAYLOAD_MAX_SIZE];
- cp_msg_drv_result_t result = CP_MSG_DRV_RESULT_FAILURE;
-
- if (cp_msg_drv_sta_set_config_req_receive (ctx, mme, config))
- {
- /* Correctly decoded, let's try to set it up. */
- if (lib_stats_write_stats (config))
- /* Success. */
- result = CP_MSG_DRV_RESULT_SUCCESS;
- }
- cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_CONFIG_CNF, result);
-}
-
-void
-cp_sta_action_drv__drv_sta_set_slave_config_req (cp_t *ctx, cp_mme_rx_t *mme)
+cp_eoc_sta_action_drv__drv_sta_set_slave_config_req (
+ cp_t *ctx, cp_mme_rx_t *mme)
{
/* Check parameter. */
dbg_assert (mme);
@@ -386,11 +115,14 @@ cp_sta_action_drv__drv_sta_set_slave_config_req (cp_t *ctx, cp_mme_rx_t *mme)
result = CP_MSG_DRV_RESULT_SUCCESS;
}
}
- cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_EOC_STA_SET_SLAVE_CONFIG_CNF, result);
+ cp_msg_drv_any_cnf_send (ctx, &mme->peer,
+ DRV_EOC_STA_SET_SLAVE_CONFIG_CNF,
+ result);
}
- void
-cp_sta_action_drv__drv_sta_set_eoc_config_req (cp_t *ctx, cp_mme_rx_t *mme)
+void
+cp_eoc_sta_action_drv__drv_sta_set_eoc_config_req (
+ cp_t *ctx, cp_mme_rx_t *mme)
{
uint exp, value;
cp_msg_drv_result_t result = CP_MSG_DRV_RESULT_FAILURE;
@@ -404,11 +136,13 @@ cp_sta_action_drv__drv_sta_set_eoc_config_req (cp_t *ctx, cp_mme_rx_t *mme)
phy_tx_scale_adapt_set (ctx->phy, value);
}
- cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_EOC_STA_SET_EOC_CONFIG_CNF, result);
+ cp_msg_drv_any_cnf_send (ctx, &mme->peer,
+ DRV_EOC_STA_SET_EOC_CONFIG_CNF,
+ result);
}
void
-cp_sta_action_drv__drv_sta_get_status_ind(cp_t *ctx)
+cp_eoc_sta_action_drv__drv_sta_get_status_ind (cp_t *ctx)
{
dbg_assert(ctx);
diff --git a/cesar/cp/eoc/sta/action/src/misc.c b/cesar/cp/eoc/sta/action/src/misc.c
deleted file mode 100644
index 52153887c8..0000000000
--- a/cesar/cp/eoc/sta/action/src/misc.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp/eoc/sta/action/src/misc.c
- * \brief STA action, miscellaneous definitions.
- * \ingroup cp_sta_action
- */
-#include "common/std.h"
-#include "cl/data_rate.h"
-#include "mac/common/store.h"
-
-#include "action.h"
-
-#include "cp/inc/context.h"
-#include "cp/inc/trace.h"
-#include "cp/msg/msg.h"
-
-#include "hal/arch/arch.h" // for dsr lock and unlock
-
-#include "common/defs/spidcom.h"
-#include "mac/common/timings.h"
-
-
-
-void
-cp_sta_action_process_cm_nw_stats_req (cp_t *ctx, cp_mme_rx_t *rx_mme)
-{
- dbg_assert (ctx);
- dbg_assert (rx_mme);
-
- cp_mme_tx_t *tx_mme;
- cp_net_t* our_avln;
- cp_sta_t* sta_list = NULL;
- sta_t* sta;
- uint NumSTAs = 0;
-
- //Req receive /TODO
- //if (cp_msg_cm_nw_stats_req_receive (ctx, rx_mme))
- bool ok = true;
- if(ok)
- {
- /* Make sure we have an avln */
- if (MAC_TEI_IS_STA (cp_sta_own_data_get_tei (ctx)))
- {
- our_avln = cp_sta_mgr_get_our_avln (ctx);
-
- /* Get authenticated stas */
- sta_list = cp_net_sta_get_first (ctx, our_avln, CP_NET_STA_ASSOC);
- while (sta_list)
- {
- if (cp_sta_get_authenticated (ctx, sta_list))
- {
- NumSTAs++;
- }
-
- sta_list = cp_net_sta_get_next (ctx, our_avln, sta_list);
- }
- }
- else
- {
- NumSTAs = 0;
- }
-
- tx_mme = cp_msg_cm_nw_stats_cnf_send_begin (ctx, &rx_mme->peer,
- NumSTAs);
-
- if (NumSTAs)
- {
- sta_list = cp_net_sta_get_first (ctx, our_avln, CP_NET_STA_ASSOC);
-
- while (sta_list)
- {
- if (cp_sta_get_authenticated (ctx, sta_list))
- {
- mac_t mac;
- uint phy_dr_tx;
- uint phy_dr_rx;
- cl_data_rate_t tx_data_rate;
- cl_data_rate_t rx_data_rate;
-
- mac = cp_sta_get_mac_address(sta_list);
-
- /* Get TX : local STA -> avln STA */
- /* Get RX : avln STA -> local STA */
- sta = mac_store_sta_get (ctx->mac_store,
- cp_sta_get_tei(sta_list));
-
- arch_dsr_lock();
- tx_data_rate = sta->tx_data_rate;
- rx_data_rate = sta->rx_data_rate;
- arch_dsr_unlock();
-
- /* Update DR with delay between last DR update and now */
- data_rate_update_info(&tx_data_rate, 0);
- data_rate_update_info(&rx_data_rate, 0);
-
- /* Convert DR from octets/s to Mbit/s */
- phy_dr_tx = (uint)((tx_data_rate.data_rate * 8 + 500000)
- /1000000);
- phy_dr_rx = (uint)((rx_data_rate.data_rate * 8 + 500000)
- /1000000);
-
- cp_msg_cm_nw_stats_cnf_send (ctx, tx_mme, mac,
- phy_dr_tx, phy_dr_rx);
-
- /* Clean. */
- blk_release (sta);
- }
-
- sta_list = cp_net_sta_get_next (ctx, our_avln, sta_list);
- }
- }
-
- cp_msg_cm_nw_stats_cnf_send_end (ctx, tx_mme);
- }
-}
diff --git a/cesar/cp/eoc/sta/action/src/poweron.c b/cesar/cp/eoc/sta/action/src/poweron.c
index 376d5ca343..18fabe095b 100644
--- a/cesar/cp/eoc/sta/action/src/poweron.c
+++ b/cesar/cp/eoc/sta/action/src/poweron.c
@@ -6,26 +6,25 @@
*
* }}} */
/**
- * \file cp/sta/action/src/poweron.c
- * \brief STA action, power on procedure related definitions.
- * \ingroup cp_sta_action
+ * \file cp/eoc/sta/action/src/poweron.c
+ * \brief EoC STA action, power on procedure related definitions.
+ * \ingroup cp_eoc_sta_action
*/
#include "common/std.h"
-#include "cp/sta/action/action.h"
+/* Private headers. */
+#include "cp/inc/context.h"
+/* Public headers. */
#include "cp/defs.h"
-#include "cp/msg/msg.h"
+#include "cp/eoc/sta/action/poweron.h"
+#include "cp/eoc/cco/bw/bw.h"
+#include "cp/sta/action/action.h"
#include "cp/sta/mgr/sta_mgr.h"
-#include "cp/fsm/fsm.h"
#include "cp/beacon/beacon.h"
-#include "cp/cco/action/cco_action.h"
-#include "cp/eoc/cco/bw/bw.h"
-
-#include "cp/inc/context.h"
/* Initial settings for station */
-void
+static void
cp_eoc_sta_action__power_on_no_beacons (cp_t *ctx)
{
cp_tei_t tei;
@@ -59,19 +58,7 @@ cp_eoc_sta_action__power_on_no_beacons (cp_t *ctx)
}
void
-cp_sta_action_poweron_start (cp_t *ctx)
-{
- cp_fsm_trigger_new_event (ctx, bare, to_poweron);
-}
-
-void
-cp_sta_action_poweron_stop (cp_t *ctx)
-{
- cp_fsm_trigger_new_event (ctx, bare, to_stop);
-}
-
-void
-cp_sta_action_poweron__many__to_idle (cp_t *ctx)
+cp_eoc_sta_action_poweron__many__to_idle (cp_t *ctx)
{
dbg_assert (ctx);
/* Cleanup. */
@@ -84,7 +71,7 @@ cp_sta_action_poweron__many__to_idle (cp_t *ctx)
}
void
-cp_sta_action_poweron__idle__to_poweron (cp_t *ctx)
+cp_eoc_sta_action_poweron__idle__to_poweron (cp_t *ctx)
{
dbg_assert (ctx);
cp_eoc_sta_action__power_on_no_beacons (ctx);
@@ -98,27 +85,5 @@ cp_sta_action_poweron__idle__to_poweron (cp_t *ctx)
sar_activate (ctx->sar, true);
pbproc_activate (ctx->pbproc, true);
ctx->sta_action.assoc.peer = CP_MME_PEER (MAC_BROADCAST,
- MAC_TEI_UNASSOCIATED);
+ MAC_TEI_UNASSOCIATED);
}
-
-// void
-// cp_sta_action_poweron__poweron__beacon (cp_t *ctx, cp_beacon_desc_t *beacon,
-// cp_net_t *net, cp_sta_t *sta)
-// {
-// dbg_assert (ctx);
-// dbg_assert (beacon);
-// dbg_assert (net);
-// dbg_assert (sta);
-// cp_sta_action_poweron_beacon_match_and_join (
-// ctx, beacon, net, sta,
-// CP_FSM_BRANCH (POWERON, BEACON, nid_match),
-// CP_FSM_BRANCH (POWERON, BEACON, no_nid_match));
-// }
-
-// void
-// cp_sta_action_poweron__sta__to_stop (cp_t *ctx)
-// {
-// dbg_assert (ctx);
-// cp_sta_action_assoc_leave (ctx);
-// }
-//
diff --git a/cesar/cp/eoc/sta/action/src/sleep.c b/cesar/cp/eoc/sta/action/src/sleep.c
deleted file mode 100644
index d925c312e0..0000000000
--- a/cesar/cp/eoc/sta/action/src/sleep.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp/eoc/sta/action/src/sleep.c
- * \brief STA sleep action.
- * \ingroup cp_sta_action
- */
-#include "common/std.h"
-#include "cp/sta/action/action.h"
-#include "cp/inc/context.h"
-
-void
-cp_eoc_sta_action_sleep__unassociated_enter_sleep (cp_t *ctx)
-{
-}
-
-void
-cp_eoc_sta_action_sleep__sleep_unassociated_exit_sleep (cp_t *ctx)
-{
-}
-
-void
-cp_eoc_sta_action_sleep__authenticated_sleep_enter (cp_t *ctx)
-{
-}
-
-void
-cp_eoc_sta_action_sleep__sleep_authenticated_exit (cp_t *ctx)
-{
-}
-
diff --git a/cesar/cp/eoc/sta/action/src/vs_eoc.c b/cesar/cp/eoc/sta/action/src/vs.c
index d84e9119e9..087b06923c 100644
--- a/cesar/cp/eoc/sta/action/src/vs_eoc.c
+++ b/cesar/cp/eoc/sta/action/src/vs.c
@@ -6,31 +6,33 @@
*
* }}} */
/**
- * \file cp/sta/action/src/vs_eoc.c
- * \brief STA action, VS_EOC related definitions.
- * \ingroup cp_sta_action
+ * \file cp/eoc/sta/action/src/vs.c
+ * \brief Vendor Specific EoC definitions.
+ * \ingroup cp_eoc_sta_action
*/
#include "common/std.h"
-#include "cp/sta/action/action.h"
-
-#include "cp/msg/msg.h"
+/* Private headers. */
+#include "cp/eoc/sta/action/inc/vs.h"
#include "cp/inc/context.h"
-#include "cp/fsm/fsm.h"
-#include "cp/eoc/cco/bw/bw.h"
-#include "lib/stats.h"
+#include "cl/inc/context.h"
#include "ce/rx/bitloading/inc/nsr.h"
+#include "cp/eoc/msg/inc/msg_vs.h"
#include "mac/pbproc/inc/context.h"
#include "mac/sar/inc/context.h"
-#include "math.h"
-#include "cp/msg/inc/msg_vs_eoc.h"
-#include "cp/eoc/sta/action/vs_eoc.h"
-#include "cl/inc/context.h"
+
+/* Public headers. */
+#include "cp/eoc/sta/action/vs.h"
+#include "cp/sta/action/action.h"
+#include "cp/msg/msg.h"
+#include "cp/eoc/cco/bw/bw.h"
+#include <math.h> /* for log(). */
#define RT_STATS_OFFSET(a, b) rt_stats.a = b - rt_stats_offset.a
void
-cp_eoc_sta_action_vs_eoc__sta__vs_eoc_get_info_req(cp_t *ctx, cp_mme_rx_t *mme)
+cp_eoc_sta_action_vs__vs_eoc_get_info_req (
+ cp_t *ctx, cp_mme_rx_t *mme)
{
dbg_assert(ctx);
dbg_assert(mme);
@@ -38,7 +40,8 @@ cp_eoc_sta_action_vs_eoc__sta__vs_eoc_get_info_req(cp_t *ctx, cp_mme_rx_t *mme)
sta_t *sta = NULL;
bool ok;
- cp_msg_vs_eoc_get_info_req_result_t status = CP_MSG_VS_EOC_GET_INFO_REQ_RESULT_SUCCESS;
+ cp_msg_vs_eoc_get_info_req_result_t status =
+ CP_MSG_VS_EOC_GET_INFO_REQ_RESULT_SUCCESS;
u8 internal_eoc_index;
u8 control;
u16 tei = 0;
@@ -56,35 +59,38 @@ cp_eoc_sta_action_vs_eoc__sta__vs_eoc_get_info_req(cp_t *ctx, cp_mme_rx_t *mme)
u32 rx_other_error_counter = 0;
u8 agc_offset = 12;
- ok = cp_msg_vs_eoc_cco_get_info_req_receive (ctx, mme, &internal_eoc_index, &control);
- if(ok)
+ ok = cp_msg_vs_eoc_cco_get_info_req_receive (
+ ctx, mme, &internal_eoc_index, &control);
+ if (ok)
{
tei = ctx->sta_mgr.sta_own_data.tei;
if (tei != MAC_TEI_UNASSOCIATED)
{
- sta = mac_store_sta_get(ctx->mac_store, ctx->sta_action.assoc.peer.tei);
+ sta = mac_store_sta_get (ctx->mac_store,
+ ctx->sta_action.assoc.peer.tei);
if (sta)
{
if (sta->authenticated)
{
- snr_sum = ce_rx_bl_nsr_compute_total_mean (&sta->ce_rx_bt);
- snr = 10*log(snr_sum);
+ snr_sum = ce_rx_bl_nsr_compute_total_mean (
+ &sta->ce_rx_bt);
+ snr = 10 * log (snr_sum);
attenuation = sta->upstream_att + agc_offset;
}
blk_release (sta);
}
- phy_uplink_speed = cp_sta_action_get_average_ble (ctx, ctx->sta_action.assoc.peer.tei,
- true, false) * MAX_THROUGHPUT_MBPS /
- DEFAULT_STREAM_QUALITY;
- phy_downlink_speed = cp_sta_action_get_average_ble (ctx, ctx->sta_action.assoc.peer.tei,
- false, false) * MAX_THROUGHPUT_MBPS
- / DEFAULT_STREAM_QUALITY;
+ phy_uplink_speed = cp_sta_action_get_average_ble (
+ ctx, ctx->sta_action.assoc.peer.tei, true, false)
+ * MAX_THROUGHPUT_MBPS / DEFAULT_STREAM_QUALITY;
+ phy_downlink_speed = cp_sta_action_get_average_ble (
+ ctx, ctx->sta_action.assoc.peer.tei, false, false)
+ * MAX_THROUGHPUT_MBPS / DEFAULT_STREAM_QUALITY;
}
output_power = ctx->sta_mgr.sta_own_data.output_level;
- if(control == 1)
+ if (control == 1)
{
ctx->pbproc->stats.tx_data = 0;
ctx->pbproc->stats.tx_data_cancel = 0;
@@ -93,13 +99,15 @@ cp_eoc_sta_action_vs_eoc__sta__vs_eoc_get_info_req(cp_t *ctx, cp_mme_rx_t *mme)
ctx->pbproc->stats.rx_data_error = 0;
ctx->pbproc->stats.rx_crc_error = 0;
}
- tx_success_counter = ctx->pbproc->stats.tx_data - ctx->pbproc->stats.tx_data_cancel
- - ctx->pbproc->stats.tx_data_wack_noack;
- tx_crc_error_counter = 0; /* N.A. */
- tx_other_error_counter = ctx->pbproc->stats.tx_data_cancel +
- ctx->pbproc->stats.tx_data_wack_noack;
- rx_success_counter = ctx->pbproc->stats.rx_data -
- ctx->pbproc->stats.rx_data_error;
+ tx_success_counter = ctx->pbproc->stats.tx_data
+ - ctx->pbproc->stats.tx_data_cancel
+ - ctx->pbproc->stats.tx_data_wack_noack;
+ /* N.A. */
+ tx_crc_error_counter = 0;
+ tx_other_error_counter = ctx->pbproc->stats.tx_data_cancel
+ + ctx->pbproc->stats.tx_data_wack_noack;
+ rx_success_counter = ctx->pbproc->stats.rx_data
+ - ctx->pbproc->stats.rx_data_error;
rx_crc_error_counter = ctx->pbproc->stats.rx_crc_error;
rx_other_error_counter = ctx->pbproc->stats.rx_data_error;
}
@@ -108,19 +116,23 @@ cp_eoc_sta_action_vs_eoc__sta__vs_eoc_get_info_req(cp_t *ctx, cp_mme_rx_t *mme)
status = CP_MSG_VS_EOC_GET_INFO_REQ_RESULT_FAILURE;
}
- cp_msg_vs_eoc_cco_get_info_cnf_send(ctx, &mme->peer, status, tei, attenuation, snr, phy_uplink_speed,
- phy_downlink_speed, output_power, tx_success_counter, tx_crc_error_counter, tx_other_error_counter,
- rx_success_counter, rx_crc_error_counter, rx_other_error_counter);
+ cp_msg_vs_eoc_cco_get_info_cnf_send (
+ ctx, &mme->peer, status, tei, attenuation, snr,
+ phy_uplink_speed, phy_downlink_speed, output_power,
+ tx_success_counter, tx_crc_error_counter, tx_other_error_counter,
+ rx_success_counter, rx_crc_error_counter, rx_other_error_counter);
}
void
-cp_eoc_sta_action_vs_eoc__sta__vs_eoc_diagnostic_info_req(cp_t *ctx, cp_mme_rx_t *mme)
+cp_eoc_sta_action_vs__vs_eoc_diagnostic_info_req (
+ cp_t *ctx, cp_mme_rx_t *mme)
{
dbg_assert(ctx);
dbg_assert(mme);
bool ok;
- cp_msg_vs_eoc_diagnostic_info_req_result_t status = CP_MSG_VS_EOC_DIAGNOSTIC_INFO_REQ_RESULT_SUCCESS;
+ cp_msg_vs_eoc_diagnostic_info_req_result_t status =
+ CP_MSG_VS_EOC_DIAGNOSTIC_INFO_REQ_RESULT_SUCCESS;
u8 internal_eoc_index;
u8 control;
u8 assoc_stat = 0;
@@ -134,14 +146,15 @@ cp_eoc_sta_action_vs_eoc__sta__vs_eoc_diagnostic_info_req(cp_t *ctx, cp_mme_rx_t
u32 num_bad_could_not_auth = 0;
u32 num_leave = 0;
- ok = cp_msg_vs_eoc_cco_diagnostic_info_req_receive (ctx, mme, &internal_eoc_index, &control);
- if(ok)
+ ok = cp_msg_vs_eoc_cco_diagnostic_info_req_receive (
+ ctx, mme, &internal_eoc_index, &control);
+ if (ok)
{
- if(ctx->sta_mgr.sta_own_data.tei == MAC_TEI_UNASSOCIATED)
+ if (ctx->sta_mgr.sta_own_data.tei == MAC_TEI_UNASSOCIATED)
{
assoc_stat = 0;
}
- else if(!ctx->mac_config->authenticated)
+ else if (!ctx->mac_config->authenticated)
{
assoc_stat = 1;
}
@@ -154,7 +167,8 @@ cp_eoc_sta_action_vs_eoc__sta__vs_eoc_diagnostic_info_req(cp_t *ctx, cp_mme_rx_t
num_slots = 1;
he_mac_address = ctx->sta_action.assoc.peer.mac;
est_avg_phy_rate = 0;
- if(control == 1)
+
+ if (control == 1)
{
ctx->sta_mgr.sta_own_data.num_good_assoc_auth = 0;
ctx->sta_mgr.sta_own_data.num_bad_could_not_assoc = 0;
@@ -162,10 +176,14 @@ cp_eoc_sta_action_vs_eoc__sta__vs_eoc_diagnostic_info_req(cp_t *ctx, cp_mme_rx_t
ctx->sta_mgr.sta_own_data.num_bad_could_not_auth = 0;
ctx->sta_mgr.sta_own_data.num_leave = 0;
}
- num_good_assoc_auth = ctx->sta_mgr.sta_own_data.num_good_assoc_auth;
- num_bad_could_not_assoc = ctx->sta_mgr.sta_own_data.num_bad_could_not_assoc;
- num_bad_assoc_failure = ctx->sta_mgr.sta_own_data.num_bad_assoc_failure;
- num_bad_could_not_auth = ctx->sta_mgr.sta_own_data.num_bad_could_not_auth;
+ num_good_assoc_auth =
+ ctx->sta_mgr.sta_own_data.num_good_assoc_auth;
+ num_bad_could_not_assoc =
+ ctx->sta_mgr.sta_own_data.num_bad_could_not_assoc;
+ num_bad_assoc_failure =
+ ctx->sta_mgr.sta_own_data.num_bad_assoc_failure;
+ num_bad_could_not_auth =
+ ctx->sta_mgr.sta_own_data.num_bad_could_not_auth;
num_leave = ctx->sta_mgr.sta_own_data.num_leave;
}
else
@@ -173,17 +191,19 @@ cp_eoc_sta_action_vs_eoc__sta__vs_eoc_diagnostic_info_req(cp_t *ctx, cp_mme_rx_t
status = CP_MSG_VS_EOC_DIAGNOSTIC_INFO_REQ_RESULT_FAILURE;
}
- cp_msg_vs_eoc_cco_diagnostict_info_cnf_send(ctx, &mme->peer, status, assoc_stat, nid, num_slots,
- he_mac_address, est_avg_phy_rate, num_good_assoc_auth, num_bad_could_not_assoc, num_bad_assoc_failure,
- num_bad_could_not_auth, num_leave);
+ cp_msg_vs_eoc_cco_diagnostict_info_cnf_send (
+ ctx, &mme->peer, status, assoc_stat, nid, num_slots, he_mac_address,
+ est_avg_phy_rate, num_good_assoc_auth, num_bad_could_not_assoc,
+ num_bad_assoc_failure, num_bad_could_not_auth, num_leave);
}
-
void
-cp_eoc_sta_action_vs_eoc__sta__vs_eoc_get_real_time_statistics_req (cp_t *ctx, cp_mme_rx_t *mme)
+cp_eoc_sta_action_vs__vs_eoc_get_real_time_statistics_req (
+ cp_t *ctx, cp_mme_rx_t *mme)
{
bool ok = false;
- cp_msg_vs_eoc_get_info_req_result_t status = CP_MSG_VS_EOC_GET_REAL_TIME_STATISTICS_REQ_RESULT_SUCCESS;
+ cp_msg_vs_eoc_get_info_req_result_t status =
+ CP_MSG_VS_EOC_GET_REAL_TIME_STATISTICS_REQ_RESULT_SUCCESS;
u8 clear = 0;
static bool init = false;
real_time_stats_t rt_stats;
@@ -205,7 +225,7 @@ cp_eoc_sta_action_vs_eoc__sta__vs_eoc_get_real_time_statistics_req (cp_t *ctx, c
if (ok)
{
- if(clear == 1)
+ if (clear == 1)
{
memset (&rt_stats, 0x0, sizeof (real_time_stats_t));
@@ -236,6 +256,7 @@ cp_eoc_sta_action_vs_eoc__sta__vs_eoc_get_real_time_statistics_req (cp_t *ctx, c
ctx->cl->stats.rx_data_multicast;
rt_stats_offset.nb_multicast_packets_tx =
ctx->cl->stats.tx_data_multicast;
+
#if CONFIG_STATS
rt_stats_offset.avg_pre_fec_bit_error_rate =
ctx->sar->stats.ber_sum;
diff --git a/cesar/cp/eoc/sta/action/stub/Module b/cesar/cp/eoc/sta/action/stub/Module
index c3fe956685..3220ccf47b 100644
--- a/cesar/cp/eoc/sta/action/stub/Module
+++ b/cesar/cp/eoc/sta/action/stub/Module
@@ -1 +1,7 @@
-SOURCES := drv.c poweron.c bridge.c action.c
+SOURCES := action.c poweron.c drv.c vs.c assoc.c
+
+ifneq ($(VARIANT),master)
+ SOURCES += assoc_slave.c
+endif
+
+MODULES := cp/sta/action/stub
diff --git a/cesar/cp/eoc/sta/action/stub/src/action.c b/cesar/cp/eoc/sta/action/stub/src/action.c
index 695078269b..eecda50828 100644
--- a/cesar/cp/eoc/sta/action/stub/src/action.c
+++ b/cesar/cp/eoc/sta/action/stub/src/action.c
@@ -6,17 +6,14 @@
*
* }}} */
/**
- * \file cesar/cp/eoc/sta/action/stub/src/action.c
+ * \file cp/eoc/sta/action/stub/src/action.c
* \brief Station action stubs.
- * \ingroup cp_eoc
+ * \ingroup cp_eoc_sta_action_stub
*/
#include "common/std.h"
#include "cp/cp.h"
-u8
-cp_sta_action_get_average_ble (
- cp_t *ctx, cp_tei_t tei, bool tx, bool fc_format) __attribute__((weak));
-
-u8
-cp_sta_action_get_average_ble (cp_t *ctx, cp_tei_t tei, bool tx, bool fc_format)
-{ return 0; }
+void
+cp_eoc_sta_action_init (cp_t *ctx) __attribute__((weak));
+void
+cp_eoc_sta_action_init (cp_t *ctx) {};
diff --git a/cesar/cp/eoc/sta/action/stub/src/assoc.c b/cesar/cp/eoc/sta/action/stub/src/assoc.c
new file mode 100644
index 0000000000..4e5d4df5e9
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/stub/src/assoc.c
@@ -0,0 +1,26 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2012 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eoc/sta/action/stub/src/assoc.c
+ * \brief « brief description »
+ * \ingroup cp_eoc_sta_action_stub
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+
+void
+cp_eoc_sta_action_assoc_init (cp_t *ctx) __attribute__((weak));
+void
+cp_eoc_sta_action_assoc_init (cp_t *ctx) {}
+
+void
+cp_eoc_sta_action_assoc__start_retry_timer (cp_t *ctx) __attribute__((weak));
+void
+cp_eoc_sta_action_assoc__start_retry_timer (cp_t *ctx) {}
diff --git a/cesar/cp/eoc/sta/action/stub/src/assoc_slave.c b/cesar/cp/eoc/sta/action/stub/src/assoc_slave.c
new file mode 100644
index 0000000000..78306cbda4
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/stub/src/assoc_slave.c
@@ -0,0 +1,181 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2012 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eco/sta/action/stub/src/assoc_slave.c
+ * \brief « brief description »
+ * \ingroup cp_eoc_sta_action_stub
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+#include "cp/mme.h"
+#include "cp/sta/mgr/sta.h"
+#include "cp/sta/mgr/net.h"
+#include "bsu/beacon/beacon.h"
+
+void
+cp_eoc_sta_action_sta_clear_status (cp_t *ctx) __attribute__((weak));
+void
+cp_eoc_sta_action_sta_clear_status (cp_t *ctx) {}
+
+void
+cp_eoc_sta_action_assoc__detecting_detected (cp_t *ctx) __attribute__((weak));
+void
+cp_eoc_sta_action_assoc__detecting_detected (cp_t *ctx) {}
+
+void
+cp_eoc_sta_action_assoc__detecting_timeout (cp_t *ctx) __attribute__((weak));
+void
+cp_eoc_sta_action_assoc__detecting_timeout (cp_t *ctx) {}
+
+void
+cp_eoc_sta_action_detect__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
+ cp_net_t *net, cp_sta_t *sta)
+ __attribute__((weak));
+void
+cp_eoc_sta_action_detect__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
+ cp_net_t *net, cp_sta_t *sta) {}
+
+void
+cp_eoc_sta_action_assoc__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
+ cp_net_t *net, cp_sta_t *sta)
+ __attribute__((weak));
+void
+cp_eoc_sta_action_assoc__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
+ cp_net_t *net, cp_sta_t *sta) {}
+
+void
+cp_eoc_sta_action_auth__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
+ cp_net_t *net, cp_sta_t *sta)
+ __attribute__((weak));
+void
+cp_eoc_sta_action_auth__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
+ cp_net_t *net, cp_sta_t *sta) {}
+
+void
+cp_eoc_sta_action_assoc__associating_timeout (cp_t *ctx)
+ __attribute__((weak));
+void
+cp_eoc_sta_action_assoc__associating_timeout (cp_t *ctx) {}
+
+void
+cp_eoc_sta_action_assoc__associating_cnf (cp_t *ctx, cp_mme_rx_t *mme)
+ __attribute__((weak));
+void
+cp_eoc_sta_action_assoc__associating_cnf (cp_t *ctx, cp_mme_rx_t *mme) {}
+
+void
+cp_eoc_sta_action_assoc__associating_no_beacons (cp_t *ctx)
+ __attribute__((weak));
+void
+cp_eoc_sta_action_assoc__associating_no_beacons (cp_t *ctx) {}
+
+void
+cp_eoc_sta_action_assoc__unassociated_retry (cp_t *ctx)
+ __attribute__((weak));
+void
+cp_eoc_sta_action_assoc__unassociated_retry (cp_t *ctx) {}
+
+void
+cp_eoc_sta_action_assoc__associated_key_cnf (cp_t *ctx, cp_mme_rx_t *mme)
+ __attribute__((weak));
+void
+cp_eoc_sta_action_assoc__associated_key_cnf (cp_t *ctx, cp_mme_rx_t *mme) {}
+
+void
+cp_eoc_sta_action_auth__authenticated_key_cnf (cp_t *ctx, cp_mme_rx_t *mme)
+ __attribute__((weak));
+void
+cp_eoc_sta_action_auth__authenticated_key_cnf (cp_t *ctx, cp_mme_rx_t *mme) {}
+
+void
+cp_eoc_sta_action_auth__authenticated_set_key_req (
+ cp_t *ctx, cp_mme_rx_t *mme) __attribute__((weak));
+void
+cp_eoc_sta_action_auth__authenticated_set_key_req (
+ cp_t *ctx, cp_mme_rx_t *mme) {}
+
+void
+cp_eoc_sta_action_assoc__associated_no_beacons (cp_t *ctx)
+ __attribute__((weak));
+void
+cp_eoc_sta_action_assoc__associated_no_beacons (cp_t *ctx) {}
+
+void
+cp_eoc_sta_action_assoc__associated_timeout (cp_t *ctx) __attribute__((weak));
+void
+cp_eoc_sta_action_assoc__associated_timeout (cp_t *ctx) {}
+
+void
+cp_eoc_sta_action_assoc__associated_leave (cp_t *ctx, cp_mme_rx_t *mme)
+ __attribute__((weak));
+void
+cp_eoc_sta_action_assoc__associated_leave (cp_t *ctx, cp_mme_rx_t *mme) {}
+
+void
+cp_eoc_sta_action_assoc__authenticated_leave (cp_t *ctx, cp_mme_rx_t *mme)
+ __attribute__((weak));
+void
+cp_eoc_sta_action_assoc__authenticated_leave (cp_t *ctx, cp_mme_rx_t *mme) {}
+
+void
+cp_eoc_sta_action_assoc__authenticated_no_beacons (cp_t *ctx)
+ __attribute__((weak));
+void
+cp_eoc_sta_action_assoc__authenticated_no_beacons (cp_t *ctx) {}
+
+void
+cp_eoc_sta_action_assoc__beacon_not_received (cp_t *ctx)
+ __attribute__((weak));
+void
+cp_eoc_sta_action_assoc__beacon_not_received (cp_t *ctx) {}
+
+void
+cp_eoc_sta_action_unassoc__start_retry_timer (cp_t *ctx)
+ __attribute__((weak));
+void
+cp_eoc_sta_action_unassoc__start_retry_timer (cp_t *ctx) {}
+
+void
+cp_eoc_sta_action_unassoc__stop_retry_timer (cp_t *ctx) __attribute__((weak));
+void
+cp_eoc_sta_action_unassoc__stop_retry_timer (cp_t *ctx) {}
+
+void
+cp_eoc_sta_action_assoc__associated_encrypt_payload_rsp (
+ cp_t *ctx, cp_mme_rx_t *mme) __attribute__((weak));
+void
+cp_eoc_sta_action_assoc__associated_encrypt_payload_rsp (
+ cp_t *ctx, cp_mme_rx_t *mme) {}
+
+void
+cp_eoc_sta_action_auth__authenticated_set_out_lev (
+ cp_t *ctx, cp_mme_rx_t *mme) __attribute__((weak));
+void
+cp_eoc_sta_action_auth__authenticated_set_out_lev (
+ cp_t *ctx, cp_mme_rx_t *mme) {}
+
+void
+cp_eoc_sta_action_assoc__detecting_no_beacons (cp_t *ctx)
+ __attribute__((weak));
+void
+cp_eoc_sta_action_assoc__detecting_no_beacons (cp_t *ctx) {}
+
+void
+cp_eoc_sta_action_assoc__unassoc_no_beacons (cp_t *ctx) __attribute__((weak));
+void
+cp_eoc_sta_action_assoc__unassoc_no_beacons (cp_t *ctx) {}
+
+void
+cp_eoc_sta_action_unassoc__beacon_received (
+ cp_t *ctx, bsu_beacon_t *beacon, cp_net_t *net, cp_sta_t *sta)
+ __attribute__((weak));
+void
+cp_eoc_sta_action_unassoc__beacon_received (
+ cp_t *ctx, bsu_beacon_t *beacon, cp_net_t *net, cp_sta_t *sta) {}
diff --git a/cesar/cp/eoc/sta/action/stub/src/bridge.c b/cesar/cp/eoc/sta/action/stub/src/bridge.c
deleted file mode 100644
index 3276577d03..0000000000
--- a/cesar/cp/eoc/sta/action/stub/src/bridge.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp/eoc/sta/action/stub/src/bridge.c
- * \brief STA action, bridge table related implementations.
- * \ingroup cp_sta_action
- *
- * Bridge table request and reception implementations.
- */
-#include "common/std.h"
-
-#include "cp/mme.h" // cp_mme_rx_t
-#include "cp/msg/msg.h" // to include cp/msg/inc/msg_cm.h
-#include "cp/msg/inc/msg_cm.h" // cp_msg_cm_brg_info_cnf_receive_*
-#include "cp/sta/mgr/sta_mgr.h" // cp_sta_mgr_get_our_avln
-#include "cp/sta/mgr/sta.h" // cp_sta_get_peer
-#include "cp/sta/mgr/net.h" // cp_net_sta_get_*
-#include "cl/cl_mactotei.h" // cl_mactotei_*
-#include "cp/inc/context.h" // cp_t
-#include "cl/bridge_table.h" // bridge_table_*
-#include "lib/utils.h" // less_mod2p32
-#include "cp/sta/action/bridge.h"
-
-void
-cp_sta_action_bridge_first_com (cp_t *ctx, cp_net_t *net, cp_sta_t *sta)
-{
-}
-
-void
-cp_sta_action_process_cm_brg_info_cnf (cp_t *ctx, cp_mme_rx_t *mme)
-{
-}
-
-void
-cp_sta_action_process_cm_brg_info_req (cp_t *ctx, cp_mme_rx_t *mme)
-{
-}
-
diff --git a/cesar/cp/eoc/sta/action/stub/src/drv.c b/cesar/cp/eoc/sta/action/stub/src/drv.c
index e58f3ef012..07ba901b0a 100644
--- a/cesar/cp/eoc/sta/action/stub/src/drv.c
+++ b/cesar/cp/eoc/sta/action/stub/src/drv.c
@@ -6,154 +6,44 @@
*
* }}} */
/**
- * \file cp/sta/action/stub/src/drv.c
+ * \file cp/eoc/sta/action/stub/src/drv.c
* \brief STA action, driver related definitions.
- * \ingroup cp_sta_action
+ * \ingroup cp_eoc_sta_action_stub
*/
#include "common/std.h"
-
-#include "cp/sta/action/action.h"
-
-#include "cp/msg/msg.h"
-#include "cp/inc/context.h"
-#include "cp/fsm/fsm.h"
+#include "cp/cp.h"
+#include "cp/mme.h"
void
-cp_sta_action_drv__stopped__drv_sta_set_mac_addr_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
-
-}
-
-void
-cp_sta_action_drv__stopped__drv_sta_set_cco_pref_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
-
-}
-
-void
-cp_sta_action_drv__stopped__drv_sta_set_was_cco_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
-
-}
-
-void
-cp_sta_action_drv__stopped__drv_sta_set_npw_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
-
-}
-
+cp_eoc_sta_action_drv__stopped__drv_sta_set_tonemask_req (
+ cp_t *ctx, cp_mme_rx_t *mme) __attribute__((weak));
void
-cp_sta_action_drv__stopped__drv_sta_set_dpw_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
-
-}
+cp_eoc_sta_action_drv__stopped__drv_sta_set_tonemask_req (
+ cp_t *ctx, cp_mme_rx_t *mme) {}
void
-cp_sta_action_drv__stopped__drv_sta_set_sl_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
-
-}
-
+cp_eoc_sta_action_drv__stopped__drv_sta_set_key_req (
+ cp_t *ctx, cp_mme_rx_t *mme) __attribute__((weak));
void
-cp_sta_action_drv__stopped__drv_sta_set_nid_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
-
-}
+cp_eoc_sta_action_drv__stopped__drv_sta_set_key_req (
+ cp_t *ctx, cp_mme_rx_t *mme) {}
void
-cp_sta_action_drv__stopped__drv_sta_set_tonemask_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
-
-}
-
+cp_eoc_sta_action_drv__drv_sta_set_slave_config_req (
+ cp_t *ctx, cp_mme_rx_t *mme) __attribute__((weak));
void
-cp_sta_action_drv__stopped__drv_sta_mac_start_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
-
-
-}
+cp_eoc_sta_action_drv__drv_sta_set_slave_config_req (
+ cp_t *ctx, cp_mme_rx_t *mme) {}
void
-cp_sta_action_drv__started__drv_sta_mac_stop_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
-
-}
-
+cp_eoc_sta_action_drv__drv_sta_set_eoc_config_req (
+ cp_t *ctx, cp_mme_rx_t *mme) __attribute__((weak));
void
-cp_sta_action_drv__stopped__drv_sta_set_key_req (cp_t *ctx, cp_mme_rx_t *mme)
-{
-
-}
+cp_eoc_sta_action_drv__drv_sta_set_eoc_config_req (
+ cp_t *ctx, cp_mme_rx_t *mme) {}
void
-cp_sta_action_drv__stopped__drv_sta_set_dak_req (cp_t *ctx, cp_mme_rx_t *mme)
-{
-
-}
-
+cp_eoc_sta_action_drv__drv_sta_get_status_ind (cp_t *ctx)
+ __attribute__((weak));
void
-cp_sta_action_drv__stopped__drv_sta_set_m_sta_hfid_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
-
-}
-
-void
-cp_sta_action_drv__stopped__drv_sta_set_u_sta_hfid_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
-
-}
-
-void
-cp_sta_action_drv__stopped__drv_sta_set_avln_hfid_req (cp_t *ctx,
- cp_mme_rx_t *mme)
-{
-
-}
-
-void
-cp_sta_action_drv__stopping__stopped (cp_t *ctx)
-{
-
-}
-
-void
-cp_sta_action_drv__drv_sta_get_key_req (cp_t *ctx, cp_mme_rx_t *mme)
-{
-
-}
-
-void
-cp_sta_action_drv__drv_sta_get_status_ind(cp_t *ctx)
-{
-
-}
-
-void
-cp_sta_action_drv__drv_sta_set_config_req (cp_t *ctx, cp_mme_rx_t *mme)
-{
-
-}
-
-void
-cp_sta_action_drv__drv_sta_set_slave_config_req (cp_t *ctx, cp_mme_rx_t *mme)
-{
-
-}
-
-void
-cp_sta_action_drv__drv_sta_set_eoc_config_req (cp_t *ctx, cp_mme_rx_t *mme)
-{
-
-}
+cp_eoc_sta_action_drv__drv_sta_get_status_ind (cp_t *ctx) {}
diff --git a/cesar/cp/eoc/sta/action/stub/src/poweron.c b/cesar/cp/eoc/sta/action/stub/src/poweron.c
index a1970f7501..29ec7b6b2a 100644
--- a/cesar/cp/eoc/sta/action/stub/src/poweron.c
+++ b/cesar/cp/eoc/sta/action/stub/src/poweron.c
@@ -11,24 +11,16 @@
* \ingroup cp_eoc_sta_action_stub
*/
#include "common/std.h"
-
-#include "cp/inc/context.h"
+#include "cp/cp.h"
void
-cp_sta_action_poweron__idle__to_poweron (cp_t *ctx)
-{}
-
+cp_eoc_sta_action_poweron__many__to_idle (cp_t *ctx)
+ __attribute__((weak));
void
-cp_sta_action_poweron__many__to_idle (cp_t *ctx)
-{
-}
+cp_eoc_sta_action_poweron__many__to_idle (cp_t *ctx) {}
void
-cp_sta_action_poweron_start (cp_t *ctx)
-{
-}
-
+cp_eoc_sta_action_poweron__idle__to_poweron (cp_t *ctx)
+ __attribute__((weak));
void
-cp_sta_action_poweron_stop (cp_t *ctx)
-{
-}
+cp_eoc_sta_action_poweron__idle__to_poweron (cp_t *ctx) {}
diff --git a/cesar/cp/eoc/sta/action/stub/src/vs.c b/cesar/cp/eoc/sta/action/stub/src/vs.c
new file mode 100644
index 0000000000..5a43bbcfe4
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/stub/src/vs.c
@@ -0,0 +1,38 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2012 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eoc/sta/action/stub/vs.c
+ * \brief « brief description »
+ * \ingroup cp_eoc_sta_action_stub
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+#include "cp/mme.h"
+
+void
+cp_eoc_sta_action_vs__vs_eoc_get_info_req (
+ cp_t *ctx, cp_mme_rx_t *mme) __attribute__((weak));
+void
+cp_eoc_sta_action_vs__vs_eoc_get_info_req (
+ cp_t *ctx, cp_mme_rx_t *mme) {}
+
+void
+cp_eoc_sta_action_vs__vs_eoc_diagnostic_info_req (
+ cp_t *ctx, cp_mme_rx_t *mme) __attribute__((weak));
+void
+cp_eoc_sta_action_vs__vs_eoc_diagnostic_info_req (
+ cp_t *ctx, cp_mme_rx_t *mme) {}
+
+void
+cp_eoc_sta_action_vs__vs_eoc_get_real_time_statistics_req (
+ cp_t *ctx, cp_mme_rx_t *mme) __attribute__((weak));
+void
+cp_eoc_sta_action_vs__vs_eoc_get_real_time_statistics_req (
+ cp_t *ctx, cp_mme_rx_t *mme) {}
diff --git a/cesar/cp/eoc/sta/action/test/utest/actions-Config b/cesar/cp/eoc/sta/action/test/utest/actions-Config
index 29647af3fd..1b2a998b9b 100644
--- a/cesar/cp/eoc/sta/action/test/utest/actions-Config
+++ b/cesar/cp/eoc/sta/action/test/utest/actions-Config
@@ -1,9 +1,8 @@
+CONFIG_CP_EOC = y
+CONFIG_CP_MSG_EOC_DRV_MME = y
CONFIG_DEBUG_FATAL_CATCH = y
-CONFIG_CP_FSM_DEF = "cp/fsm/src/fsm/cp_eoc_sta.fsm"
-CONFIG_CP_EOC_CCO_FSM = y
+CONFIG_CP_FSM_DEF = "cp/eoc/fsm/src/fsm/cp_eoc_sta.fsm"
CONFIG_GPIO_LED_TRAFFIC = y
-CONFIG_CP_MSG_EOC_VS = y
-CONFIG_CP_MSG_EOC_DRV_MME = y
CONFIG_MAC_SAR_EOC_PERMANENT_MFS = y
CONFIG_MAC_PBPROC_EOC_FC = y
CONFIG_MAC_COMMON_EOC_TONEMASK = y
diff --git a/cesar/cp/eoc/sta/action/test/utest/actions-Makefile b/cesar/cp/eoc/sta/action/test/utest/actions-Makefile
index 2151ee71cf..afb8986956 100644
--- a/cesar/cp/eoc/sta/action/test/utest/actions-Makefile
+++ b/cesar/cp/eoc/sta/action/test/utest/actions-Makefile
@@ -2,30 +2,22 @@ BASE = ../../../../../..
VARIANT = actions
-INCLUDES = cp/eoc/sta/action/test/utest cp/eoc/sta/action/test/utest/actions-override
+INCLUDES = cp/eoc/sta/action/test/utest/actions-override
HOST_PROGRAMS = test_actions
-test_actions_SOURCES = test_actions.c pb_proc_stub.c beacon_stub.c cp_stub.c msg_stub.c actions.c\
-dataplane_stub.c bw_stub.c actions_stub.c ce_stub.c phy_stub.c
-
-test_actions_MODULES = lib lib/scenario cp/fsm cp cp/msg cp/msg/stub cp/eoc/sta/action\
-cp/eoc/sta/mgr cp/secu/stub mac/common cp/beacon/stub cp/sta/mgr mac/sar/stub\
-cp/sta/core/stub cp/cco/action/stub cl/stub cp/cl_interf\
-interface/stub cp/secu ce/tx/stub\
-cp/eoc/sta/action/stub cp/sta/action bsu/stub bufmgr/stub
-
-test_actions_CONFIG_MODULES = mac/pbproc cl mac/sar
-
-cp_eoc_sta_action_MODULE_SOURCES = drv.c poweron.c assoc.c sleep.c vs_eoc.c cco_stub.c
-cp_eoc_sta_action_stub_MODULE_SOURCES = bridge.c
-cp_eoc_sta_mgr_MODULE_SOURCES = sta_own_data.c sta_mgr.c
-cp_sta_mgr_MODULE_SOURCES = net.c sta.c
-cp_sta_action_MODULE_SOURCES = vs.c
-cp_msg_MODULE_SOURCES = msg_drv.c mme.c
-cp_msg_stub_MODULE_SOURCES = msg_cc.c msg_cm.c msg_vs.c
-
-cp_MODULE_MODULES =
-cp_MODULE_SOURCES = $(if $(filter y,$(CONFIG_TRACE)),trace.c,)
+
+test_actions_SOURCES = test_actions.c phy_stub.c cyg_stub.c cp_stub.c \
+ cl_interf_stub.c
+
+test_actions_MODULES = lib cp/eoc/fsm cp/eoc/sta/action cp/eoc/msg \
+ cp/eoc/sta/mgr cp/secu/stub mac/common cp/eoc/beacon/stub \
+ cp/eoc/cco/action/stub cp/eoc/cco/bw/stub \
+ mac/sar/stub cp/sta/core/stub cl/stub \
+ interface/stub cp/secu ce/tx/stub \
+ bsu/stub bufmgr/stub ce/rx/stub mac/pbproc/stub
+
+test_actions_CONFIG_MODULES = cp cp/eoc cl mac/sar mac/pbproc
+test_actions_LDLIBS = -lm
include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/eoc/sta/action/test/utest/actions-override/cp/inc/context.h b/cesar/cp/eoc/sta/action/test/utest/actions-override/cp/inc/context.h
index 55fb9388c5..20ec0c03c5 100644
--- a/cesar/cp/eoc/sta/action/test/utest/actions-override/cp/inc/context.h
+++ b/cesar/cp/eoc/sta/action/test/utest/actions-override/cp/inc/context.h
@@ -33,10 +33,11 @@
#include "cp/cl_interf/cl_interf.h"
#include "cp/cl_interf/inc/context.h"
#include "hal/phy/phy.h"
-#include "cp/beacon/inc/beacon.h"
-#include "cp/beacon/beacon.h"
+#include "cp/eoc/beacon/inc/beacon.h"
+#include "cp/eoc/beacon/beacon.h"
#include "ce/tx/inc/tx.h"
-#include "cp/cco/action/inc/cco_action.h"
+#include "cp/eoc/cco/action/inc/cco_action.h"
+#include "bsu/aclf/aclf.h"
#include "bufmgr/bufmgr.h"
#define CP_NID_SIZE_BITS 54
@@ -73,6 +74,8 @@ struct cp_t
cp_cl_interf_t cl_interf;
/** Phy context. */
phy_t *phy;
+ /** BSU. */
+ bsu_aclf_t *bsu_aclf;
cp_beacon_t beacon;
ce_tx_t ce_tx;
@@ -81,6 +84,7 @@ struct cp_t
bsu_t *bsu;
cp_cco_action_t cco_action;
+
/** Buffer manager. */
bufmgr_t *bufmgr;
};
diff --git a/cesar/cp/eoc/sta/action/test/utest/actions-override/cyg/kernel/kapi.h b/cesar/cp/eoc/sta/action/test/utest/actions-override/cyg/kernel/kapi.h
new file mode 100644
index 0000000000..019e5d3a07
--- /dev/null
+++ b/cesar/cp/eoc/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/sta/action/test/utest/fsm-Config b/cesar/cp/eoc/sta/action/test/utest/fsm-Config
index 37922ef4cf..cfd9d43a04 100644
--- a/cesar/cp/eoc/sta/action/test/utest/fsm-Config
+++ b/cesar/cp/eoc/sta/action/test/utest/fsm-Config
@@ -1,7 +1,5 @@
-CONFIG_DEBUG_FATAL_CATCH = y
-CONFIG_CP_FSM_DEF = "cp/fsm/src/fsm/cp_eoc_sta.fsm"
-CONFIG_CP_EOC_CCO_FSM = y
-CONFIG_CP_MSG_EOC_VS = y
+CONFIG_CP_EOC = y
CONFIG_CP_MSG_EOC_DRV_MME = y
-#CONFIG_MAC_COMMON_EOC_MFS = y
+CONFIG_DEBUG_FATAL_CATCH = y
+CONFIG_CP_FSM_DEF = "cp/eoc/fsm/src/fsm/cp_eoc_sta.fsm"
CONFIG_MAC_SAR_EOC_PERMANENT_MFS = y
diff --git a/cesar/cp/eoc/sta/action/test/utest/fsm-Makefile b/cesar/cp/eoc/sta/action/test/utest/fsm-Makefile
index de78a138b6..0ac9bf0f2f 100644
--- a/cesar/cp/eoc/sta/action/test/utest/fsm-Makefile
+++ b/cesar/cp/eoc/sta/action/test/utest/fsm-Makefile
@@ -2,15 +2,17 @@ BASE = ../../../../../..
VARIANT = fsm
-INCLUDES = cp/eoc/sta/action/test/utest cp/eoc/sta/action/test/utest/fsm-override
+INCLUDES = cp/eoc/sta/action/test/utest \
+ cp/eoc/sta/action/test/utest/fsm-override
HOST_PROGRAMS = test_fsm
-test_fsm_SOURCES = test_fsm.c fsm_stub.c actions.c
-test_fsm_MODULES = lib lib/scenario cp/fsm cp mac/sar/stub
-test_fsm_CONFIG_MODULES = cp/sta/mgr cp/msg mac/common cl mac/sar
-cp_fsm_MODULE_SOURCES = fsm.c events.c
-cp_MODULE_MODULES =
-cp_MODULE_SOURCES = $(if $(filter y,$(CONFIG_TRACE)),trace.c,)
+
+test_fsm_SOURCES = test_fsm.c actions.c
+
+test_fsm_MODULES = lib lib/scenario cp/eoc/fsm mac/sar/stub \
+ cp/eoc/sta/action/stub cp/eoc/beacon/stub ce/tx/stub
+
+test_fsm_CONFIG_MODULES = cp cp/eoc mac/common cl mac/sar
include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/eoc/sta/action/test/utest/inc/scenario_defs.h b/cesar/cp/eoc/sta/action/test/utest/inc/scenario_defs.h
index 83ae138295..8c3dca7d82 100644
--- a/cesar/cp/eoc/sta/action/test/utest/inc/scenario_defs.h
+++ b/cesar/cp/eoc/sta/action/test/utest/inc/scenario_defs.h
@@ -39,8 +39,9 @@
trigger, \
post_urgent, \
process, \
- process_urgent,\
- vs__started__vs_get_tonemap_req
+ process_urgent
+/*
+ vs__started__vs_get_tonemap_req*/
/* Actions with MME and parameters. */
@@ -210,72 +211,78 @@ __er (cp_beacon_synchronised)
#undef __er
#undef __ms
#undef __mr
-#undef __p_
typedef struct
{
cp_fsm_branch_t branch;
} scenario_event_transition_with_branch_t;
-typedef scenario_empty_t scenario_event_cp_fsm__STOPPED__drv_sta_set_mac_addr_req_t;
-typedef scenario_empty_t scenario_event_cp_fsm__STOPPED__drv_sta_set_cco_pref_req_t;
-typedef scenario_empty_t scenario_event_cp_fsm__STOPPED__drv_sta_set_was_cco_req_t;
-typedef scenario_empty_t scenario_event_cp_fsm__STOPPED__drv_sta_set_dpw_req_t;
-typedef scenario_empty_t scenario_event_cp_fsm__STOPPED__drv_sta_set_nid_req_t;
-typedef scenario_empty_t scenario_event_cp_fsm__STOPPED__drv_sta_set_tonemask_req_t;
-typedef scenario_empty_t scenario_event_cp_fsm__STOPPED__drv_sta_set_key_req_t;
-typedef scenario_empty_t scenario_event_cp_fsm__STOPPED__drv_sta_set_dak_req_t;
-typedef scenario_empty_t scenario_event_cp_fsm__STOPPED__drv_sta_mac_start_req_t;
-typedef scenario_empty_t scenario_event_cp_fsm__STOPPED__drv_sta_set_npw_req_t;
-typedef scenario_empty_t scenario_event_cp_fsm__STOPPED__drv_sta_set_sl_req_t;
-typedef scenario_empty_t scenario_event_cp_fsm__STOPPING__poweron__many__to_idle_t;
-typedef scenario_empty_t scenario_event_cp_fsm__STOPPING__drv__stopping__stopped_t;
-typedef scenario_empty_t scenario_event_cp_fsm__CCO__bridge_first_com_t;
-typedef scenario_empty_t scenario_event_cp_fsm__STOPPED__drv_sta_set_m_sta_hfid_req_t;
-typedef scenario_empty_t scenario_event_cp_fsm__STOPPED__drv_sta_set_u_sta_hfid_req_t;
-typedef scenario_empty_t scenario_event_cp_fsm__STOPPED__drv_sta_set_avln_hfid_req_t;
-typedef scenario_empty_t scenario_event_cp_sta_action_drv__drv_sta_set_config_req_t;
-typedef scenario_empty_t scenario_event_cp_fsm__STARTED__poweron__idle__to_poweron_t;
-typedef scenario_empty_t scenario_event_cp_fsm__DETECTING_BEACON__sta_clear_status_t;
-typedef scenario_empty_t scenario_event_cp_fsm__DETECTING_BEACON__BEACON_t;
-typedef scenario_empty_t scenario_event_cp_fsm__DETECTING_BEACON__BEACON_NOT_RECEIVED_t;
-typedef scenario_empty_t scenario_event_cp_fsm__DETECTING_BEACON__nd_beacon_t;
-typedef scenario_empty_t scenario_event_cp_fsm__DETECTING_BEACON__nd_beacon_timeout_t;
-typedef scenario_empty_t scenario_event_cp_fsm__ASSOCIATING__start_retry_timer_t;
-typedef scenario_event_transition_with_branch_t scenario_event_cp_fsm__ASSOCIATING__timeout_associating_t;
-typedef scenario_event_transition_with_branch_t scenario_event_cp_fsm__ASSOCIATING__CC_ASSOC_CNF_t;
-typedef scenario_empty_t scenario_event_cp_fsm__ASSOCIATING__no_beacons_t;
-typedef scenario_empty_t scenario_event_cp_fsm__ASSOCIATING__beacon_not_received_t;
-typedef scenario_empty_t scenario_event_cp_fsm__ASSOCIATING__stop_retry_timer_t;
-typedef scenario_empty_t scenario_event_cp_fsm__UNASSOCIATED__start_retry_timer_t;
-typedef scenario_empty_t scenario_event_cp_fsm__UNASSOCIATED__enter_sleep_unassociated_t;
-typedef scenario_empty_t scenario_event_cp_fsm__UNASSOCIATED__retry_unassociated_t;
-typedef scenario_empty_t scenario_event_cp_fsm__UNASSOCIATED__timeout_unassociating_t;
-typedef scenario_empty_t scenario_event_cp_fsm__UNASSOCIATED__no_beacons_t;
-typedef scenario_empty_t scenario_event_cp_fsm__UNASSOCIATED__BEACON_t;
-typedef scenario_empty_t scenario_event_cp_fsm__UNASSOCIATED__stop_retry_timer_t;
-typedef scenario_empty_t scenario_event_cp_fsm__SLEEP_UNASSOCIATED__exit_sleep_unassociated_t;
-typedef scenario_empty_t scenario_event_cp_fsm__ASSOCIATED__no_beacons_t;
-//typedef scenario_empty_t scenario_event_cp_fsm__ASSOCIATED__CC_LEAVE_IND_t;
-typedef scenario_event_transition_with_branch_t scenario_event_cp_fsm__ASSOCIATED__CC_LEAVE_IND_t;
-typedef scenario_empty_t scenario_event_cp_fsm__ASSOCIATED__timeout_associating_t;
-typedef scenario_empty_t scenario_event_cp_fsm__ASSOCIATED__cm_chan_est_ind_t;
-typedef scenario_empty_t scenario_event_cp_fsm__ASSOCIATED__cm_update_tm_ind_t;
-typedef scenario_event_transition_with_branch_t scenario_event_cp_fsm__ASSOCIATED__CM_GET_KEY_CNF_t;
-typedef scenario_empty_t scenario_event_cp_fsm__ASSOCIATED__encrypt_payload_rsp_t;
-typedef scenario_empty_t scenario_event_cp_fsm__AUTHENTICATED__no_beacons_t;
-typedef scenario_empty_t scenario_event_cp_fsm__AUTHENTICATED__BEACON_t;
-//typedef scenario_empty_t scenario_event_cp_fsm__AUTHENTICATED__CC_LEAVE_IND_t;
-typedef scenario_event_transition_with_branch_t scenario_event_cp_fsm__AUTHENTICATED__CC_LEAVE_IND_t;
-typedef scenario_empty_t scenario_event_cp_fsm__AUTHENTICATED__sleep_enter_cnf_t;
-typedef scenario_empty_t scenario_event_cp_fsm__AUTHENTICATED__drv__started__drv_sta_mac_stop_req_t;
-typedef scenario_empty_t scenario_event_cp_fsm__AUTHENTICATED__process_cm_brg_info_req_t;
-typedef scenario_empty_t scenario_event_cp_fsm__AUTHENTICATED__process_cm_brg_info_cnf_t;
-typedef scenario_empty_t scenario_event_cp_fsm__AUTHENTICATED__CM_SET_KEY_REQ_t;
-typedef scenario_empty_t scenario_event_cp_fsm__AUTHENTICATED__CM_NW_STATS_REQ_t;
-typedef scenario_empty_t scenario_event_cp_fsm__AUTHENTICATED__set_out_lev_ind_t;
-typedef scenario_empty_t scenario_event_cp_fsm__SLEEP_AUTHENTICATED__no_beacons_t;
-typedef scenario_empty_t scenario_event_cp_fsm__SLEEP_AUTHENTICATED__sleep_exit_rsp_t;
-
+/* Any event. */
+#define __e(event, param...) \
+ typedef struct \
+ { \
+ PREPROC_FOR_EACH (__p_, ## param) \
+ } scenario_event_ ## event ## _t;
+
+__e (cp_fsm__STOPPED__drv_sta_set_mac_addr_req)
+__e (cp_fsm__STOPPED__drv_sta_set_cco_pref_req)
+__e (cp_fsm__STOPPED__drv_sta_set_was_cco_req)
+__e (cp_fsm__STOPPED__drv_sta_set_dpw_req)
+__e (cp_fsm__STOPPED__drv_sta_set_nid_req)
+__e (cp_fsm__STOPPED__drv_sta_set_tonemask_req)
+__e (cp_fsm__STOPPED__drv_sta_set_key_req)
+__e (cp_fsm__STOPPED__drv_sta_set_dak_req)
+__e (cp_fsm__STOPPED__drv_sta_mac_start_req)
+__e (cp_fsm__STOPPED__drv_sta_set_npw_req)
+__e (cp_fsm__STOPPED__drv_sta_set_sl_req)
+__e (cp_fsm__STOPPING__poweron__many__to_idle)
+__e (cp_fsm__STOPPING__drv__stopping__stopped)
+__e (cp_fsm__CCO__bridge_first_com)
+__e (cp_fsm__STOPPED__drv_sta_set_m_sta_hfid_req)
+__e (cp_fsm__STOPPED__drv_sta_set_u_sta_hfid_req)
+__e (cp_fsm__STOPPED__drv_sta_set_avln_hfid_req)
+__e (cp_fsm__STARTED__poweron__idle__to_poweron)
+__e (cp_fsm__DETECTING_BEACON__sta_clear_status)
+__e (cp_fsm__DETECTING_BEACON__BEACON)
+__e (cp_fsm__DETECTING_BEACON__BEACON_NOT_RECEIVED)
+__e (cp_fsm__DETECTING_BEACON__nd_beacon)
+__e (cp_fsm__DETECTING_BEACON__nd_beacon_timeout)
+__e (cp_fsm__ASSOCIATING__start_retry_timer)
+__e (cp_fsm__ASSOCIATING__timeout_associating, cp_fsm_branch_t branch)
+__e (cp_fsm__ASSOCIATING__CC_ASSOC_CNF, cp_fsm_branch_t branch)
+__e (cp_fsm__ASSOCIATING__no_beacons)
+__e (cp_fsm__ASSOCIATING__beacon_not_received)
+__e (cp_fsm__ASSOCIATING__stop_retry_timer)
+__e (cp_fsm__UNASSOCIATED__start_retry_timer)
+__e (cp_fsm__UNASSOCIATED__enter_sleep_unassociated)
+__e (cp_fsm__UNASSOCIATED__retry_unassociated)
+__e (cp_fsm__UNASSOCIATED__timeout_unassociating)
+__e (cp_fsm__UNASSOCIATED__no_beacons)
+__e (cp_fsm__UNASSOCIATED__BEACON)
+__e (cp_fsm__UNASSOCIATED__stop_retry_timer)
+__e (cp_fsm__SLEEP_UNASSOCIATED__exit_sleep_unassociated)
+__e (cp_fsm__ASSOCIATED__no_beacons)
+__e (cp_fsm__ASSOCIATED__CC_LEAVE_IND, cp_fsm_branch_t branch)
+__e (cp_fsm__ASSOCIATED__CM_GET_KEY_CNF, cp_fsm_branch_t branch)
+__e (cp_fsm__ASSOCIATED__timeout_associating)
+__e (cp_fsm__ASSOCIATED__cm_chan_est_ind)
+__e (cp_fsm__ASSOCIATED__cm_update_tm_ind)
+__e (cp_fsm__ASSOCIATED__encrypt_payload_rsp)
+__e (cp_fsm__AUTHENTICATED__no_beacons)
+__e (cp_fsm__AUTHENTICATED__BEACON)
+__e (cp_fsm__AUTHENTICATED__CC_LEAVE_IND, cp_fsm_branch_t branch)
+__e (cp_fsm__AUTHENTICATED__sleep_enter_cnf)
+__e (cp_fsm__AUTHENTICATED__drv__started__drv_sta_mac_stop_req)
+__e (cp_fsm__AUTHENTICATED__process_cm_brg_info_req)
+__e (cp_fsm__AUTHENTICATED__process_cm_brg_info_cnf)
+__e (cp_fsm__AUTHENTICATED__CM_SET_KEY_REQ)
+__e (cp_fsm__AUTHENTICATED__CM_NW_STATS_REQ)
+__e (cp_fsm__AUTHENTICATED__set_out_lev_ind)
+__e (cp_fsm__SLEEP_AUTHENTICATED__no_beacons)
+__e (cp_fsm__SLEEP_AUTHENTICATED__sleep_exit_rsp)
+__e (cp_sta_action_drv__drv_sta_set_config_req)
+
+#undef __e
+#undef __p_
#endif /* inc_scenario_defs_h */
diff --git a/cesar/cp/eoc/sta/action/test/utest/src/actions.c b/cesar/cp/eoc/sta/action/test/utest/src/actions.c
index 81eaca3c0c..09258d2361 100644
--- a/cesar/cp/eoc/sta/action/test/utest/src/actions.c
+++ b/cesar/cp/eoc/sta/action/test/utest/src/actions.c
@@ -115,5 +115,4 @@ scenario_action_ ## ACTION ## _cb (scenario_globals_t *globals, \
-__m (vs__started__vs_get_tonemap_req)
diff --git a/cesar/cp/eoc/sta/action/test/utest/src/actions_stub.c b/cesar/cp/eoc/sta/action/test/utest/src/actions_stub.c
deleted file mode 100644
index 8242d211fd..0000000000
--- a/cesar/cp/eoc/sta/action/test/utest/src/actions_stub.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2010 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file src/actions_stub.c
- * \brief Override STA FSM tables.
- * \ingroup test
- */
-#include "common/std.h"
-#include "lib/scenario/scenario.h"
-#include "cp/inc/context.h"
-#include "cp/eoc/sta/action/drv.h"
-
-
-void
-cp_sta_action_process_cm_sta_cap_req (cp_t *ctx, cp_mme_rx_t *rx_mme);
-
-void
-cp_sta_action_poweron__idle__to_poweron (cp_t *ctx);
-
-void
-cp_sta_action_poweron__many__to_idle (cp_t *ctx);
-
-void
-cp_eoc_sta_action_assoc__beacon_received (cp_t *ctx);
-
-void
-cp_eoc_sta_action_assoc__beacon_not_received (cp_t *ctx);
-
-void
-cp_eoc_sta_action_assoc__detecting_detected (cp_t *ctx);
-
-void
-cp_eoc_sta_action_assoc__detecting_timeout (cp_t *ctx);
-
-void
-cp_eoc_sta_action_sleep__unassociated_enter_sleep (cp_t *ctx);
-
-void
-cp_eoc_sta_action_assoc__associating_timeout (cp_t *ctx);
-
-void
-cp_eoc_sta_action_assoc__associating_no_beacons (cp_t *ctx);
-
-void
-cp_eoc_sta_action_assoc__associating_cnf (cp_t *ctx);
-
-void
-cp_eoc_sta_action_auth__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
- cp_net_t *net, cp_sta_t *sta);
-
-void
-cp_eoc_sta_action_assoc__associated_timeout (cp_t *ctx);
-
-void
-cp_eoc_sta_action_assoc__associated_no_beacons (cp_t *ctx);
-
-void
-cp_eoc_sta_action_assoc__associated_encrypt_payload_rsp (cp_t *ctx);
-
-void
-cp_eoc_sta_action_assoc__associated_leave (cp_t *ctx);
-
-void
-cp_eoc_sta_action_assoc__associated_key_cnf (cp_t *ctx);
-
-void
-ce_tx_process__cm_chan_est_ind (cp_t *ctx, cp_mme_rx_t *mme);
-
-void
-ce_tx_process__cm_update_tm_ind (cp_t *ctx, cp_mme_rx_t *mme);
-
-void
-cp_eoc_sta_action_assoc__authenticated_no_beacons (cp_t *ctx);
-
-void
-cp_beacon_beacon_not_received (cp_t *ctx);
-
-void
-cp_eoc_sta_action_sleep__authenticated_sleep_enter (cp_t *ctx);
-
-void
-cp_sta_action_bridge_first_com (cp_t *ctx, cp_net_t *net, cp_sta_t *sta);
-
-void
-cp_eoc_sta_action_auth__authenticated_set_out_lev(cp_t *ctx,
- cp_mme_rx_t *mme);
-
-void
-cp_eoc_sta_action_auth__authenticated_set_key_req (cp_t *ctx,
- cp_mme_rx_t *mme);
-
-void
-cp_eoc_sta_action_auth__authenticated_key_cnf(cp_t *ctx);
-
-void
-cp_sta_action_process_cm_brg_info_req (cp_t *ctx, cp_mme_rx_t *mme);
-
-void
-cp_sta_action_process_cm_brg_info_cnf (cp_t *ctx, cp_mme_rx_t *mme);
-
-void
-cp_eoc_sta_action_sleep__sleep_unassociated_exit_sleep (cp_t *ctx);
-
-void
-cp_eoc_sta_action_assoc__sleep_authenticated_no_beacons (cp_t *ctx);
-
-void
-cp_eoc_sta_action_sleep__sleep_authenticated_exit (cp_t *ctx);
-
-void
-cp_eoc_sta_action_assoc__authenticated_leave (cp_t *ctx);
-
-void
-cp_sta_action_unassoc__start_retry_timer (cp_t *ctx);
-
-void
-cp_sta_action_unassoc__stop_retry_timer (cp_t *ctx);
-
-void
-cp_sta_action_assoc__start_retry_timer (cp_t *ctx);
-
-void
-cp_sta_action_assoc__stop_retry_timer (cp_t *ctx);
-
-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_sta_action_assoc__unassociated_retry (cp_t *ctx);
-
-void
-cp_sta_action_drv__drv_sta_get_key_req (cp_t *ctx, cp_mme_rx_t *mme);
-
-double
-log (double value);
-
-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)
-{
-}
-
-u8
-cp_sta_action_get_average_ble (cp_t *ctx, cp_tei_t tei, bool tx,
- bool fc_format)
-{
- return 0;
-}
-
-double
-log (double value)
-{
-return value;
-}
diff --git a/cesar/cp/eoc/sta/action/test/utest/src/beacon_stub.c b/cesar/cp/eoc/sta/action/test/utest/src/beacon_stub.c
deleted file mode 100644
index 2f47b34637..0000000000
--- a/cesar/cp/eoc/sta/action/test/utest/src/beacon_stub.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* 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)
-{
-}
-
-bool
-cp_beacon_synchronised (cp_t *ctx)
-{
- scenario_event (cp_beacon_synchronised, param);
- return param->ok;
-}
diff --git a/cesar/cp/eoc/sta/action/test/utest/src/bw_stub.c b/cesar/cp/eoc/sta/action/test/utest/src/bw_stub.c
deleted file mode 100644
index b4a249feec..0000000000
--- a/cesar/cp/eoc/sta/action/test/utest/src/bw_stub.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include "common/std.h"
-#include "lib/blk.h"
-#include "lib/slab.h"
-#include "lib/list.h"
-
-#include "cp/defs.h"
-#include "cp/cp.h"
-#include "cp/cco/bw/bw.h"
-
-#include "cp/inc/context.h"
-#include "mac/ca/inc/context.h"
-#include "cp/cco/bw/inc/context.h"
-
-#include "cp/eoc/cco/bw/bw.h"
-#include "cp/eoc/cco/bw/inc/bw.h"
-
-#include "mac/common/sta.h"
-
-void
-cp_eoc_cco_bw_allocations_adjust (cp_t *ctx, bool adjust)
-{
-}
-
-void
-cp_eoc_cco_bw_sta_allocations (cp_t *ctx)
-{
- dbg_assert (ctx);
-}
diff --git a/cesar/cp/eoc/sta/action/test/utest/src/ce_stub.c b/cesar/cp/eoc/sta/action/test/utest/src/ce_stub.c
deleted file mode 100644
index 8d99b65842..0000000000
--- a/cesar/cp/eoc/sta/action/test/utest/src/ce_stub.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file src/ce_stub.c
- * \brief CE stub.
- * \ingroup test
- */
-#include "common/std.h"
-#include "lib/blk.h"
-#include "ce/rx/rx.h"
-
-blk_t* nsr_block;
-
-blk_t *
-ce_rx_get_nsr (ce_rx_t *ce_rx, cp_tei_t tei, uint int_index,
- uint int_version, u16* tm_ber)
-{
- return nsr_block;
-}
diff --git a/cesar/cp/eoc/sta/action/test/utest/src/cl_interf_stub.c b/cesar/cp/eoc/sta/action/test/utest/src/cl_interf_stub.c
new file mode 100644
index 0000000000..48c4240092
--- /dev/null
+++ b/cesar/cp/eoc/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] __attribute__((aligned(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/sta/action/test/utest/src/cp_stub.c b/cesar/cp/eoc/sta/action/test/utest/src/cp_stub.c
index 672ffb388b..0b82956cb9 100644
--- a/cesar/cp/eoc/sta/action/test/utest/src/cp_stub.c
+++ b/cesar/cp/eoc/sta/action/test/utest/src/cp_stub.c
@@ -15,7 +15,6 @@
#include "cp/cp.h"
#include "cp/mme.h"
#include "cp/inc/context.h"
-#include "cp/msg/inc/cc_assoc.h"
/**
* Compute the NID and the NMK from the network password.
diff --git a/cesar/cp/eoc/sta/action/test/utest/src/cyg_stub.c b/cesar/cp/eoc/sta/action/test/utest/src/cyg_stub.c
new file mode 100644
index 0000000000..e5163a30c1
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest/src/cyg_stub.c
@@ -0,0 +1,39 @@
+/* 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 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_20HZ_TCK;
+}
+
+cyg_tick_count_t
+cyg_current_time (void)
+{
+ /* For tests purpose we can simulate 1000 beacon periods */
+ return (u32)((BSU_ACLF_BP_20HZ_TCK * 1000ull) / TCK_PER_RTC);
+}
diff --git a/cesar/cp/eoc/sta/action/test/utest/src/dataplane_stub.c b/cesar/cp/eoc/sta/action/test/utest/src/dataplane_stub.c
deleted file mode 100644
index d8b7edd8fc..0000000000
--- a/cesar/cp/eoc/sta/action/test/utest/src/dataplane_stub.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file src/dataplane_stub.c
- * \brief Data plane layers stub.
- * \ingroup test
- */
-#include "common/std.h"
-
-#include "lib/scenario/scenario.h"
-
-#include "cl/cl_mactotei.h"
-#include "mac/pbproc/pbproc.h"
-#include "cp/inc/context.h"
-
-void
-sar_sta_remove (sar_t *ctx, u8 tei)
-{
- cp_t *cp = (void *) ctx;
- dbg_check (mac_store_sta_remove (cp->mac_store, tei));
-}
-
-
diff --git a/cesar/cp/eoc/sta/action/test/utest/src/fsm_stub.c b/cesar/cp/eoc/sta/action/test/utest/src/fsm_stub.c
index 4f83ebd43c..f17e27ea0b 100644
--- a/cesar/cp/eoc/sta/action/test/utest/src/fsm_stub.c
+++ b/cesar/cp/eoc/sta/action/test/utest/src/fsm_stub.c
@@ -36,15 +36,9 @@ void
cp_eoc_sta_action_assoc__associating_no_beacons (cp_t *ctx);
void
-cp_eoc_sta_action_sleep__unassociated_enter_sleep (cp_t *ctx);
-
-void
cp_eoc_sta_action_assoc__unassociated_retry (cp_t *ctx);
void
-cp_eoc_sta_action_sleep__sleep_unassociated_exit_sleep (cp_t *ctx);
-
-void
cp_eoc_sta_action_assoc__associated_key_cnf (cp_t *ctx);
void
@@ -60,21 +54,12 @@ void
cp_eoc_sta_action_assoc__associated_leave (cp_t *ctx);
void
-cp_eoc_sta_action_sleep__authenticated_sleep_enter (cp_t *ctx);
-
-void
cp_eoc_sta_action_assoc__authenticated_no_beacons (cp_t *ctx);
void
cp_eoc_sta_action_assoc__authenticated_leave (cp_t *ctx);
void
-cp_eoc_sta_action_sleep__sleep_authenticated_exit (cp_t *ctx);
-
-void
-cp_eoc_sta_action_assoc__sleep_authenticated_no_beacons (cp_t *ctx);
-
-void
cp_eoc_sta_action_assoc__beacon_received (cp_t *ctx);
void
@@ -113,9 +98,6 @@ cp_sta_action_drv__stopped__drv_sta_mac_start_req (cp_t *ctx,
cp_mme_rx_t *mme);
void
-cp_sta_action_poweron__idle__to_poweron (cp_t *ctx);
-
-void
cp_beacon_beacon_not_received (cp_t *ctx);
void
@@ -131,16 +113,13 @@ void
cp_sta_action_process_cm_brg_info_cnf (cp_t *ctx, cp_mme_rx_t *mme);
void
-cp_eoc_sta_action_sta_clear_status (cp_t *ctx);
-
-void
-cp_sta_action_unassoc__start_retry_timer (cp_t *ctx);
+cp_eoc_sta_action_unassoc__start_retry_timer (cp_t *ctx);
void
cp_sta_action_assoc__start_retry_timer (cp_t *ctx);
void
-cp_sta_action_unassoc__stop_retry_timer (cp_t *ctx);
+cp_eoc_sta_action_unassoc__stop_retry_timer (cp_t *ctx);
void
cp_sta_action_assoc__stop_retry_timer (cp_t *ctx);
@@ -216,26 +195,25 @@ void
cp_sta_action_process_cm_link_stats_req (cp_t *ctx, cp_mme_rx_t *rx_mme);
void
-cp_sta_action_drv__drv_sta_set_slave_config_req (cp_t *ctx, cp_mme_rx_t *mme);
+cp_eoc_sta_action_drv__drv_sta_set_slave_config_req (cp_t *ctx, cp_mme_rx_t *mme);
void
-cp_sta_action_drv__drv_sta_set_eoc_config_req (cp_t *ctx, cp_mme_rx_t *mme);
+cp_eoc_sta_action_drv__drv_sta_set_eoc_config_req (cp_t *ctx, cp_mme_rx_t *mme);
void
cp_eoc_sta_action_detect__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
cp_net_t *net, cp_sta_t *sta);
void
-cp_eoc_sta_action_vs_eoc__sta__vs_eoc_get_info_req (cp_t *ctx,
- cp_mme_rx_t *mme);
+cp_eoc_sta_action_vs__vs_eoc_get_info_req (cp_t *ctx, cp_mme_rx_t *mme);
void
-cp_eoc_sta_action_vs_eoc__sta__vs_eoc_diagnostic_info_req (cp_t *ctx,
- cp_mme_rx_t *mme);
+cp_eoc_sta_action_vs__vs_eoc_diagnostic_info_req (
+ cp_t *ctx, cp_mme_rx_t *mme);
void
-cp_eoc_sta_action_vs_eoc__sta__vs_eoc_get_real_time_statistics_req (cp_t *ctx,
- cp_mme_rx_t *mme);
+cp_eoc_sta_action_vs__vs_eoc_get_real_time_statistics_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);
@@ -246,16 +224,6 @@ 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_eoc_sta_action_assoc__detecting_no_beacons (cp_t *ctx);
-
-void
-cp_eoc_sta_action_assoc__unassoc_no_beacons (cp_t *ctx);
-
-void
-cp_eoc_sta_action_unassoc__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
- cp_net_t *net, cp_sta_t *sta);
-
/* Include generated tables. */
#include "cp_fsm_tables.h"
@@ -336,12 +304,6 @@ cp_sta_action_drv__stopped__drv_sta_mac_start_req (cp_t *ctx,
}
void
-cp_sta_action_poweron__idle__to_poweron (cp_t *ctx)
-{
- scenario_event (cp_fsm__STARTED__poweron__idle__to_poweron);
-}
-
-void
cp_beacon_beacon_not_received (cp_t *ctx)
{
scenario_event (cp_fsm__ASSOCIATING__beacon_not_received);
@@ -380,24 +342,12 @@ cp_eoc_sta_action_assoc__associating_no_beacons (cp_t *ctx)
}
void
-cp_eoc_sta_action_sleep__unassociated_enter_sleep (cp_t *ctx)
-{
- scenario_event (cp_fsm__UNASSOCIATED__enter_sleep_unassociated);
-}
-
-void
cp_eoc_sta_action_assoc__unassociated_retry (cp_t *ctx)
{
scenario_event (cp_fsm__UNASSOCIATED__retry_unassociated);
}
void
-cp_eoc_sta_action_sleep__sleep_unassociated_exit_sleep (cp_t *ctx)
-{
- scenario_event (cp_fsm__SLEEP_UNASSOCIATED__exit_sleep_unassociated);
-}
-
-void
cp_eoc_sta_action_assoc__associated_key_cnf (cp_t *ctx)
{
scenario_event (cp_fsm__ASSOCIATED__CM_GET_KEY_CNF, param);
@@ -430,12 +380,6 @@ cp_eoc_sta_action_assoc__associated_leave (cp_t *ctx)
}
void
-cp_eoc_sta_action_sleep__authenticated_sleep_enter (cp_t *ctx)
-{
- scenario_event (cp_fsm__AUTHENTICATED__sleep_enter_cnf);
-}
-
-void
cp_eoc_sta_action_assoc__authenticated_no_beacons (cp_t *ctx)
{
scenario_event (cp_fsm__AUTHENTICATED__no_beacons);
@@ -449,18 +393,6 @@ cp_eoc_sta_action_assoc__authenticated_leave (cp_t *ctx)
}
void
-cp_eoc_sta_action_sleep__sleep_authenticated_exit (cp_t *ctx)
-{
- scenario_event (cp_fsm__SLEEP_AUTHENTICATED__sleep_exit_rsp);
-}
-
-void
-cp_eoc_sta_action_assoc__sleep_authenticated_no_beacons (cp_t *ctx)
-{
- scenario_event (cp_fsm__SLEEP_AUTHENTICATED__no_beacons);
-}
-
-void
cp_eoc_sta_action_assoc__beacon_received (cp_t *ctx)
{
@@ -485,12 +417,7 @@ ce_tx_process__cm_update_tm_ind (cp_t *ctx, cp_mme_rx_t *mme)
}
void
-cp_eoc_sta_action_sta_clear_status (cp_t *ctx)
-{
-}
-
-void
-cp_sta_action_unassoc__start_retry_timer (cp_t *ctx)
+cp_eoc_sta_action_unassoc__start_retry_timer (cp_t *ctx)
{
scenario_event (cp_fsm__UNASSOCIATED__start_retry_timer);
}
@@ -502,7 +429,7 @@ cp_sta_action_assoc__start_retry_timer (cp_t *ctx)
}
void
-cp_sta_action_unassoc__stop_retry_timer (cp_t *ctx)
+cp_eoc_sta_action_unassoc__stop_retry_timer (cp_t *ctx)
{
scenario_event (cp_fsm__UNASSOCIATED__stop_retry_timer);
}
@@ -635,12 +562,12 @@ cp_sta_action_process_cm_link_stats_req (cp_t *ctx, cp_mme_rx_t *rx_mme)
}
void
-cp_sta_action_drv__drv_sta_set_slave_config_req (cp_t *ctx, cp_mme_rx_t *mme)
+cp_eoc_sta_action_drv__drv_sta_set_slave_config_req (cp_t *ctx, cp_mme_rx_t *mme)
{
}
void
-cp_sta_action_drv__drv_sta_set_eoc_config_req (cp_t *ctx, cp_mme_rx_t *mme)
+cp_eoc_sta_action_drv__drv_sta_set_eoc_config_req (cp_t *ctx, cp_mme_rx_t *mme)
{
}
@@ -652,18 +579,17 @@ scenario_event (cp_fsm__DETECTING_BEACON__BEACON);
}
void
-cp_eoc_sta_action_vs_eoc__sta__vs_eoc_get_info_req (cp_t *ctx,
- cp_mme_rx_t *mme)
+cp_eoc_sta_action_vs__vs_eoc_get_info_req (cp_t *ctx, cp_mme_rx_t *mme)
{}
void
-cp_eoc_sta_action_vs_eoc__sta__vs_eoc_diagnostic_info_req (cp_t *ctx,
- cp_mme_rx_t *mme)
+cp_eoc_sta_action_vs__vs_eoc_diagnostic_info_req (
+ cp_t *ctx, cp_mme_rx_t *mme)
{}
void
-cp_eoc_sta_action_vs_eoc__sta__vs_eoc_get_real_time_statistics_req (cp_t *ctx,
- cp_mme_rx_t *mme)
+cp_eoc_sta_action_vs__vs_eoc_get_real_time_statistics_req (
+ cp_t *ctx, cp_mme_rx_t *mme)
{
}
@@ -681,22 +607,3 @@ void
cp_sta_action_vs__started__vs_get_mactotei_req (cp_t *ctx, cp_mme_rx_t *mme)
{
}
-
-void
-cp_eoc_sta_action_assoc__detecting_no_beacons (cp_t *ctx)
-{
- scenario_event (cp_fsm__DETECTING_BEACON__sta_clear_status);
-}
-
-void
-cp_eoc_sta_action_assoc__unassoc_no_beacons (cp_t *ctx)
-{
- scenario_event (cp_fsm__UNASSOCIATED__no_beacons);
-}
-
-void
-cp_eoc_sta_action_unassoc__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
- cp_net_t *net, cp_sta_t *sta)
-{
- scenario_event (cp_fsm__UNASSOCIATED__BEACON);
-}
diff --git a/cesar/cp/eoc/sta/action/test/utest/src/msg_stub.c b/cesar/cp/eoc/sta/action/test/utest/src/msg_stub.c
deleted file mode 100644
index 0b176a9222..0000000000
--- a/cesar/cp/eoc/sta/action/test/utest/src/msg_stub.c
+++ /dev/null
@@ -1,478 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file src/msg.c
- * \brief « brief description »
- * \ingroup « module »
- *
- * « long description »
- */
-#include "common/std.h"
-
-#include "cp/cp.h"
-#include "cp/msg/msg.h"
-
-#include "lib/scenario/scenario.h"
-#include "mac/common/tonemap.h"
-
-#include "cp/inc/context.h"
-
-#include "hal/phy/defs.h"
-#include "cp/msg/inc/vs_get_tonemap.h"
-#include "cp/msg/inc/cm_key.h"
-
-#include <string.h>
-
-#include "cp/msg/inc/msg_vs_eoc.h"
-
-void
-cp_msg_init (cp_t *ctx) __attribute__((weak));
-
-void
-cp_msg_init (cp_t *ctx) {}
-
-void
-cp_msg_uninit (cp_t *ctx) __attribute__((weak));
-
-void
-cp_msg_uninit (cp_t *ctx) {}
-
-void
-cp_msg_dispatch (cp_t *ctx, cp_mme_rx_t *mme) __attribute__((weak));
-
-void
-cp_msg_dispatch (cp_t *ctx, cp_mme_rx_t *mme) {}
-
-cp_mme_tx_t *
-cp_msg_mme_init_not_frag (cp_t *ctx, cp_mme_peer_t *peer, cp_mmtype_t mmtype) __attribute__((weak));
-
-bool
-cp_msg_imac_get_discover_list_req_receive (cp_t *ctx, cp_mme_rx_t *mme) __attribute__((weak));
-
-cp_mme_tx_t *
-cp_msg_imac_get_discover_list_cnf_send_begin (cp_t *ctx, cp_mme_peer_t *peer,
- cp_msg_imac_get_discover_list_cnf_result_t result, u8 version,
- u8 num_stations) __attribute__((weak));
-
-void
-cp_msg_imac_get_discover_list_cnf_send (cp_t *ctx, cp_mme_tx_t *mme,
- const cp_msg_imac_discover_list_sta_info_t *data) __attribute__((weak));
-
-void
-cp_msg_imac_get_discover_list_cnf_send_end (cp_t *ctx, cp_mme_tx_t *mme) __attribute__((weak));
-
-bool
-cp_msg_vs_eoc_cco_get_real_time_stats_req_receive (cp_t *ctx, cp_mme_rx_t *mme, u8 *control) __attribute__((weak));
-
-void
-cp_msg_vs_eoc_cco_get_real_time_stats_cnf_send (cp_t *ctx, cp_mme_peer_t *peer,
- cp_msg_vs_eoc_get_real_time_statistics_req_result_t status, real_time_stats_t *rt_stats ) __attribute__((weak));
-
-cp_mme_tx_t *
-cp_msg_mme_init_encrypted (cp_t *ctx, cp_mme_peer_t *peer,
- cp_mmtype_t mmtype,
- cp_mme_peks_t peks,
- const cp_secu_protocol_run_t *prun) __attribute__((weak));
-cp_mme_tx_t *
-cp_msg_mme_init_encrypted (cp_t *ctx, cp_mme_peer_t *peer,
- cp_mmtype_t mmtype,
- cp_mme_peks_t peks,
- const cp_secu_protocol_run_t *prun)
-{
- return NULL;
-}
-
-void
-cp_msg_mme_write_frag_header (cp_t *ctx, cp_mme_tx_t *msg, bitstream_t *bs,
- cp_mmtype_t mmtype) __attribute__((weak));
-
-void
-cp_msg_mme_write_frag_header (cp_t *ctx, cp_mme_tx_t *msg, bitstream_t *bs,
- cp_mmtype_t mmtype) {}
-
-cp_mme_tx_t *
-cp_msg_mme_init_frag (cp_t *ctx, cp_mme_peer_t *peer, cp_mmtype_t mmtype,
- uint fmi_nbFrag) __attribute__((weak));
-
-cp_mme_tx_t *
-cp_msg_mme_init_frag (cp_t *ctx, cp_mme_peer_t *peer, cp_mmtype_t mmtype,
- uint fmi_nbFrag)
-{
- return NULL;
-}
-
-void
-cp_msg_mme_send (cp_t *ctx, cp_mme_tx_t *mme) __attribute__((weak));
-
-void
-cp_msg_mme_send (cp_t *ctx, cp_mme_tx_t *mme) {}
-
-cp_mme_rx_t *
-cp_msg_mme_read_header (cp_t *ctx, u8 *mme, uint length, cp_tei_t tei,
- uint *fmi) __attribute__((weak));
-
-cp_mme_rx_t *
-cp_msg_mme_read_header (cp_t *ctx, u8 *mme, uint length, cp_tei_t tei,
- uint *fmi)
-{
- return NULL;
-}
-
-bool
-cp_msg_mme_read_header_enc (cp_t *ctx, cp_mme_rx_t *mme) __attribute__((weak));
-
-bool
-cp_msg_mme_read_header_enc (cp_t *ctx, cp_mme_rx_t *mme)
-{
- return true;
-}
-
-void
-cp_msg_mme_rx_change_buffer (cp_mme_rx_t *msg) __attribute__((weak));
-
-void
-cp_msg_mme_rx_change_buffer (cp_mme_rx_t *msg) {}
-
-void
-cp_msg_mme_tx_change_buffer (bitstream_t *bs, cp_mme_tx_t *mme) __attribute__((weak));
-
-void
-cp_msg_mme_tx_change_buffer (bitstream_t *bs, cp_mme_tx_t *mme) {}
-
-void
-cp_msg_mme_read_error_process (bitstream_t *ctx, void *user_data) __attribute__((weak));
-
-void
-cp_msg_mme_read_error_process (bitstream_t *ctx, void *user_data)
-{
-}
-
-bool
-cp_msg_imac_get_discover_list_req_receive (cp_t *ctx, cp_mme_rx_t *mme)
-{
- return true;
-}
-
-cp_mme_tx_t *
-cp_msg_imac_get_discover_list_cnf_send_begin (cp_t *ctx, cp_mme_peer_t *peer,
- cp_msg_imac_get_discover_list_cnf_result_t result, u8 version,
- u8 num_stations)
-{
- cp_mme_tx_t * mme;
-
- dbg_assert (ctx);
- dbg_assert (peer);
-
- mme = cp_msg_mme_init_not_frag (ctx, peer, IMAC_GET_DISCOVER_LIST_CNF);
- dbg_assert (mme);
-
- return mme;
-}
-
-void
-cp_msg_imac_get_discover_list_cnf_send (cp_t *ctx, cp_mme_tx_t *mme,
- const cp_msg_imac_discover_list_sta_info_t *data)
-{
-}
-
-void
-cp_msg_imac_get_discover_list_cnf_send_end (cp_t *ctx, cp_mme_tx_t *mme)
-{
-}
-
-
-#define __ptr_(TYPE) PASTE_EXPAND (__ptr__, TYPE)
-#define __ptr__assign *
-#define __ms_test_(TYPE, PARAM, KIND) \
- PASTE_EXPAND (__ms_test__, KIND) (PARAM)
-#define __ms_test__assign(PARAM) \
- test_fail_unless (PARAM == param->PARAM);
-#define __ms_pdecl_(TYPE, PARAM, KIND) , TYPE PARAM
-#define __ms_test_peer \
- test_fail_unless (peer->mac == param->peer.mac); \
- test_fail_unless (peer->eth_type == param->peer.eth_type); \
- test_fail_unless (peer->vlan_tci == param->peer.vlan_tci); \
- test_fail_unless (peer->tei == param->peer.tei); \
-
-#define __mr_pdecl_(TYPE, PARAM, KIND) , TYPE __ptr_ (KIND) PARAM
-
-#define __mr_assert_(TYPE, PARAM, KIND) dbg_assert_ptr (PARAM);
-#define __mr_copy_(TYPE, PARAM, KIND) PASTE_EXPAND (__mr_copy__, KIND) (PARAM)
-
-#define __mr_copy__assign(PARAM) *PARAM = param->PARAM;
-
-
-/* Code for MME reception. */
-#define __mr(EVENT, PARAMS...) \
-bool \
-EVENT (cp_t *ctx, cp_mme_rx_t *mme \
- PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __mr_pdecl_, ## PARAMS)) \
-{ \
- dbg_assert (ctx); \
- dbg_assert (mme); \
- PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __mr_assert_, ## PARAMS) \
- scenario_event (EVENT, param); \
- if (param->ok) \
- { \
- PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __mr_copy_, ## PARAMS) \
- return true; \
- } \
- else \
- return false; \
-}
-
-/* Code for MME transmission. */
-#define __ms(EVENT, PARAMS...) \
-void \
-EVENT (cp_t *ctx, cp_mme_peer_t *peer \
- PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __ms_pdecl_, ## PARAMS)) \
-{ \
- dbg_assert (ctx); \
- dbg_assert (peer); \
- scenario_event (EVENT, param); \
- __ms_test_peer \
- PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __ms_test_, ## PARAMS) \
-}
-
-__ms (cp_msg_vs_get_tonemap_cnf_send,
- (cp_msg_vs_get_tonemap_cnf_result_t, result, assign),
- (uint, beacon_delta, assign),
- (u8, int_id, assign),
- (tonemaps_t*, tms, assign),
- (cp_msg_vs_get_tonemap_tmi_t, tmi, assign))
-__mr (cp_msg_vs_get_tonemap_req_receive,
- (mac_t, mac_addr, assign),
- (cp_msg_vs_get_tonemap_tmi_t, tmi, assign),
- (u8, int_id, assign),
- (cp_msg_vs_get_tonemap_req_dir_t, dir, assign))
-
-bool
-cp_msg_vs_get_snr_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
- mac_t *mac_addr,
- cp_msg_vs_get_snr_req_int_t *tm_int_i,
- u8 *int_id,
- u8 *carrier_gr)
-{
- return true;
-}
-
-void
-cp_msg_vs_get_snr_cnf_send (cp_t *ctx, cp_mme_peer_t *peer,
- const cp_msg_vs_get_snr_cnf_t *data)
-{
-}
-
-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);
- dbg_assert (mme);
- dbg_assert (data);
-
- if (cp_msg_mme_read_error (ctx, mme))
- {
- data->result = 0;
- data->nid = cp_sta_own_data_get_nid (ctx);
- data->snid = cp_sta_own_data_get_snid (ctx);
- data->sta_tei = cp_sta_own_data_get_tei (ctx);
-
- /* Verify. */
- if ((data->nid >> CP_NID_SIZE_BITS)
- || (data->result >= CP_MSG_CC_ASSOC_CNF_RESULT_NB)
- || (!MAC_TEI_IS_STA (data->sta_tei)))
- {
- return false;
- }
-
- return true;
- }
- return false;
-}
-
-bool
-cp_msg_cm_get_key_cnf_receive (cp_t *ctx, cp_mme_rx_t *mme,
- cp_msg_cm_get_key_cnf_t *data)
-{
- // Within the first function call, key type will be CP_MSG_KEY_NEK. Within the second
- // call, key type will be CP_MSG_KEY_TEK
- static enum cp_msg_key_type_t key_type = CP_MSG_KEY_NEK;
- data->nid = cp_sta_own_data_get_nid (ctx);
- data->result = CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED;
- data->key_type = key_type;
- key_type++;
- return true;
-}
-
-bool
-cp_msg_cm_set_key_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
- cp_msg_cm_set_key_req_t *data)
-{
- data->key_type = CP_MSG_KEY_NEK;
- data->nid = cp_sta_own_data_get_nid (ctx);
- return true;
-}
-
-bool
-cp_msg_cc_leave_ind_receive (cp_t *ctx, cp_mme_rx_t *mme,
- enum cp_msg_cc_leave_ind_reason_t *reason,
- cp_nid_t *nid)
-{
- *nid = cp_sta_own_data_get_nid (ctx);
- return true;
-}
-
-bool
-cp_msg_eoc_sta_vs_set_out_lev_ind_receive(cp_t *ctx, cp_mme_rx_t *mme, uint *output_level)
-{
- *output_level = 0;
- return true;
-}
-
-bool
-cp_msg_vs_eoc_cco_get_info_req_receive (cp_t *ctx, cp_mme_rx_t *mme, u8 *internal_eoc_index, u8 *control)
-{
-return true;
-}
-
-void
-cp_msg_vs_eoc_cco_get_info_cnf_send(cp_t *ctx, cp_mme_peer_t *peer, cp_msg_vs_eoc_get_info_req_result_t status,
- u16 tei, u8 attenuation, u8 snr, u16 phy_uplink_speed, u16 phy_downlink_speed, u8 output_power,
- u32 tx_success_counter, u32 tx_crc_error_counter, u32 tx_other_error_counter, u32 rx_success_counter,
- u32 rx_crc_error_counter, u32 rx_other_error_counter)
-{
-}
-
-
-bool
-cp_msg_vs_eoc_cco_diagnostic_info_req_receive (cp_t *ctx, cp_mme_rx_t *mme, u8 *internal_eoc_index, u8 *control)
-{
-return true;
-}
-
-void
-cp_msg_vs_eoc_cco_diagnostict_info_cnf_send(cp_t *ctx, cp_mme_peer_t *peer, cp_msg_vs_eoc_diagnostic_info_req_result_t status,
- u8 assoc_stat, u64 nid, u8 num_slots, mac_t he_mac_address, u16 est_avg_phy_rate, u8 num_good_assoc_auth,
- u16 num_bad_could_not_assoc, u32 num_bad_assoc_failure, u32 num_bad_could_not_auth, u32 num_leave)
-{
-}
-
-void
-cp_msg_vs_eoc_cco_set_out_lev_ind_send(cp_t *ctx, cp_mme_peer_t *peer, uint output_level)
-{
- dbg_assert(ctx);
-
- cp_mme_tx_t *tx;
-
- tx = cp_msg_mme_init_not_frag (ctx, peer, VS_EOC_CCO_SET_OUT_LEV_IND);
- dbg_assert(tx);
-
- bitstream_write(&tx->bitstream, output_level, 8);
- bitstream_write_finalise(&tx->bitstream);
- cp_msg_mme_send (ctx, tx);
-}
-
-bool
-cp_msg_vs_eoc_cco_get_real_time_stats_req_receive (cp_t *ctx, cp_mme_rx_t *mme, u8 *control)
-{
- return true;
-}
-
-void
-cp_msg_vs_eoc_cco_get_real_time_stats_cnf_send (cp_t *ctx, cp_mme_peer_t *peer,
- cp_msg_vs_eoc_get_real_time_statistics_req_result_t status, real_time_stats_t *rt_stats )
-{
-}
-
-void
-cp_msg_vs_get_ce_stats_cnf_send (cp_t *ctx, cp_mme_peer_t *peer,
- u8 version,
- u8 result,
- sta_t *sta,
- tonemask_info_t *ti)
-{
-}
-
-cp_mme_tx_t *
-cp_msg_mme_init_not_frag (cp_t *ctx, cp_mme_peer_t *peer, cp_mmtype_t mmtype)
-{
-
- static cp_mme_tx_t my_mme;
- cp_mme_tx_t *mme = &my_mme;
-
- u64 data;
- static u8 buffer[2048];
- bitstream_t bitstream;
-
- if ((mmtype == DRV_STA_GET_KEY_CNF) || (mmtype == VS_EOC_CCO_SET_OUT_LEV_IND))
- {
- bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
- bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_READ);
-
- //ODA
- data = 0x2;
- bitstream_access (&my_mme.bitstream, &data, 48);
- // OSA.
- data = 0x1;
- bitstream_access (&my_mme.bitstream, &data, 48);
- // Mtype
- data = HPAV_MTYPE_MME;
- bitstream_access (&my_mme.bitstream, &data, 16);
- // MMV.
- data = HPAV_MMV1;
- bitstream_access (&my_mme.bitstream, &data, 8);
- // MMtype.
- data = CM_GET_KEY_REQ;
- bitstream_access (&my_mme.bitstream, &data, 16);
- // FMI
- data = 0;
- bitstream_access (&my_mme.bitstream, &data, 16);
-
- bitstream_finalise (&my_mme.bitstream);
-
- mme->length = 19;
- mme->p_mme = buffer;
- mme->peer.mac = 2;
- mme->bitstream.data = my_mme.bitstream.data;
- mme->bitstream.data_bits = my_mme.bitstream.data_bits;
- }
- else
- {
- bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer), BITSTREAM_READ);
- bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
-
- //ODA
- data = 0x2;
- bitstream_access (&bitstream, &data, 48);
- // OSA.
- data = 0x1;
- bitstream_access (&bitstream, &data, 48);
- // Mtype
- data = HPAV_MTYPE_MME;
- bitstream_access (&bitstream, &data, 16);
- // MMV.
- data = HPAV_MMV1;
- bitstream_access (&bitstream, &data, 8);
- // MMtype.
- data = CM_GET_KEY_REQ;
- bitstream_access (&bitstream, &data, 16);
- // FMI
- data = 0;
- bitstream_access (&bitstream, &data, 16);
-
- bitstream_finalise (&bitstream);
-
- mme->length = 19;
- mme->p_mme = buffer;
- mme->peer.mac = 2;
- mme->bitstream.data = bitstream.data;
- mme->bitstream.data_bits = bitstream.data_bits;
- }
-
- return mme;
-}
diff --git a/cesar/cp/eoc/sta/action/test/utest/src/pb_proc_stub.c b/cesar/cp/eoc/sta/action/test/utest/src/pb_proc_stub.c
deleted file mode 100644
index f4c27d9ec4..0000000000
--- a/cesar/cp/eoc/sta/action/test/utest/src/pb_proc_stub.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2007 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp/eoc/multi/sta/action/test/utest/src.pb_proc_stub.c
- * \brief General PB Processing functions.
- * \ingroup pbproc
- */
-
-
-#include "common/std.h"
-#include "mac/pbproc/inc/context.h"
-
-#include "hal/gpio/gpio.h"
-#include "mac/common/timings.h"
-
-#include "mac/pbproc/inc/fsm_top.h"
-#include "mac/pbproc/inc/fsm_handle_fc.h"
-#include "mac/pbproc/inc/fsm_rx_data.h"
-#include "mac/pbproc/inc/fsm_rx_beacon.h"
-#include "mac/pbproc/inc/fsm_rx_sound.h"
-#include "mac/pbproc/inc/fsm_tx_rts_cts.h"
-#include "mac/pbproc/inc/fsm_tx_data.h"
-#include "mac/pbproc/inc/fsm_tx_sound.h"
-
-
-void
-pbproc_activate (pbproc_t *ctx, bool flag)
-{
-}
-
-void pbproc_parameters_adjust (pbproc_t *ctx, bool adjust)
-{
-}
-
-u8
-ce_rx_bl_nsr_compute_total_mean (ce_rx_bitloading_t *bl)
-{
- return 1;
-}
diff --git a/cesar/cp/eoc/sta/action/test/utest/src/test_actions.c b/cesar/cp/eoc/sta/action/test/utest/src/test_actions.c
index c5c1e85a0d..acc818c504 100644
--- a/cesar/cp/eoc/sta/action/test/utest/src/test_actions.c
+++ b/cesar/cp/eoc/sta/action/test/utest/src/test_actions.c
@@ -14,7 +14,6 @@
#include "stdio.h"
#include "common/std.h"
#include "lib/blk.h"
-#include "lib/scenario/scenario.h"
#include "cp/inc/context.h"
#include "cp/msg/msg.h"
#include "lib/test.h"
@@ -296,6 +295,10 @@ test_case_association_and_authentication_action (test_t test)
cp_net_t *net;
sar_t sar;
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+ memset (&sar, 0, sizeof (sar_t));
+
//sample network id: 0x11223344556677
nid = 0x11223344556677ull;
@@ -304,7 +307,7 @@ test_case_association_and_authentication_action (test_t test)
ctx.cl = (cl_t *) &cl;
cp_cl_interf_init (&ctx);
lib_rnd_init (&ctx.rnd, 1234);
- cp_sta_mgr_init (&ctx);
+ cp_eoc_sta_mgr_init (&ctx);
ctx.sar = &sar;
//set our avln
@@ -342,6 +345,9 @@ test_case_association_and_authentication_action (test_t test)
u8 buffer[1024];
char m_sta_hfid[CP_HFID_SIZE + 1];
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
//sample manufacturer human friendly identifier: Spidcom_SPC_300_EoC_m_HFID_123;
strcpy(m_sta_hfid, "Spidcom_SPC_300_EoC_m_HFID_123");
@@ -386,6 +392,9 @@ test_case_association_and_authentication_action (test_t test)
u8 buffer[1024];
char u_sta_hfid[CP_HFID_SIZE + 1];
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
//sample user human friendly identifier: Spidcom_SPC_300_EoC_u_HFID_123;
strcpy(u_sta_hfid, "Spidcom_SPC_300_EoC_u_HFID_123");
@@ -430,6 +439,9 @@ test_case_association_and_authentication_action (test_t test)
u8 buffer[1024];
char avln_hfid[CP_HFID_SIZE + 1];
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
//sample avln human friendly identifier: Spidcom_SPC_300_EoC_avln_HFID_123;
strcpy(avln_hfid, "Spidcom_SPC_300_EoC_avln_HFID_123");
@@ -479,6 +491,9 @@ test_case_association_and_authentication_action (test_t test)
enum cp_msg_drv_sta_set_key_type_t type;
cp_security_level_t sl;
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
//sample network id: 0x11223344556677
nid = 0x11223344556677ull;
@@ -501,7 +516,7 @@ test_case_association_and_authentication_action (test_t test)
ctx.cl = (cl_t *) &cl;
cp_cl_interf_init (&ctx);
lib_rnd_init (&ctx.rnd, 1234);
- cp_sta_mgr_init (&ctx);
+ cp_eoc_sta_mgr_init (&ctx);
//set our avln
net = cp_sta_mgr_add_avln (&ctx, 1, 1);
@@ -527,7 +542,7 @@ test_case_association_and_authentication_action (test_t test)
mme->length = 25;
- cp_sta_action_drv__stopped__drv_sta_set_key_req (&ctx, mme);
+ cp_eoc_sta_action_drv__stopped__drv_sta_set_key_req (&ctx, mme);
for (i = 0; i < COUNT (nmk.key); i++)
{
@@ -559,6 +574,9 @@ test_case_association_and_authentication_action (test_t test)
enum cp_msg_drv_sta_set_key_type_t type;
cp_security_level_t sl;
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
//sample network id: 0x11223344556677
nid = 0x11223344556677ull;
@@ -581,7 +599,7 @@ test_case_association_and_authentication_action (test_t test)
ctx.cl = (cl_t *) &cl;
cp_cl_interf_init (&ctx);
lib_rnd_init (&ctx.rnd, 1234);
- cp_sta_mgr_init (&ctx);
+ cp_eoc_sta_mgr_init (&ctx);
//set our avln
net = cp_sta_mgr_add_avln (&ctx, 1, 1);
@@ -628,6 +646,9 @@ test_case_association_and_authentication_action (test_t test)
cp_t ctx;
mac_config_t mac_config;
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
cp_mme_rx_t my_mme;
cp_mme_rx_t *mme = &my_mme;
uint i;
@@ -675,6 +696,10 @@ test_case_association_and_authentication_action (test_t test)
{
cp_t ctx;
mac_config_t mac_config;
+
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
cp_mme_rx_t my_mme;
cp_mme_rx_t *mme = &my_mme;
uint i;
@@ -747,6 +772,10 @@ test_case_association_and_authentication_action (test_t test)
{
cp_t ctx;
mac_config_t mac_config;
+
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
cp_mme_rx_t my_mme;
cp_mme_rx_t *mme = &my_mme;
uint i;
@@ -786,6 +815,10 @@ test_case_association_and_authentication_action (test_t test)
{
cp_t ctx;
mac_config_t mac_config;
+
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
cp_mme_rx_t my_mme;
cp_mme_rx_t *mme = &my_mme;
bitstream_t bitstream;
@@ -808,7 +841,7 @@ test_case_association_and_authentication_action (test_t test)
ctx.cl = (cl_t *) &cl;
cp_cl_interf_init (&ctx);
lib_rnd_init (&ctx.rnd, 1234);
- cp_sta_mgr_init (&ctx);
+ cp_eoc_sta_mgr_init (&ctx);
//set our avln
net = cp_sta_mgr_add_avln (&ctx, 1, 1);
@@ -904,9 +937,12 @@ test_case_association_and_authentication_action (test_t test)
{
cp_t ctx;
mac_config_t mac_config;
+
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
uint cl;
cp_net_t *net;
- cp_sta_t *sta;
cp_mme_rx_t my_mme;
cp_mme_rx_t *mme = &my_mme;
@@ -915,7 +951,7 @@ test_case_association_and_authentication_action (test_t test)
cp_msg_init(&ctx);
ctx.cl = (cl_t *) &cl;
cp_cl_interf_init (&ctx);
- cp_sta_mgr_init (&ctx);
+ cp_eoc_sta_mgr_init (&ctx);
//set our avln
net = cp_sta_mgr_add_avln (&ctx, 1, 1);
@@ -923,7 +959,7 @@ test_case_association_and_authentication_action (test_t test)
mme->peer.mac = 2;
mme->peer.tei = 5;
- sta = cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei, mme->peer.mac);
+ cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei, mme->peer.mac);
cp_sta_action_assoc_init (&ctx);
cp_eoc_sta_action_sta_clear_status(&ctx);
@@ -957,6 +993,10 @@ test_case_association_and_authentication_action (test_t test)
{
cp_t ctx;
mac_config_t mac_config;
+
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
uint cl;
cp_net_t *net;
cp_sta_t *sta;
@@ -970,7 +1010,7 @@ test_case_association_and_authentication_action (test_t test)
cp_msg_init(&ctx);
ctx.cl = (cl_t *) &cl;
cp_cl_interf_init (&ctx);
- cp_sta_mgr_init (&ctx);
+ cp_eoc_sta_mgr_init (&ctx);
//set our avln
net = cp_sta_mgr_add_avln (&ctx, 1, 1);
@@ -991,6 +1031,10 @@ test_case_association_and_authentication_action (test_t test)
static pbproc_t ARCH_DLRAM_BSS pbproc_global;
cp_t ctx;
mac_config_t mac_config;
+
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
uint cl;
cp_net_t *net;
cp_sta_t *sta;
@@ -1004,7 +1048,7 @@ test_case_association_and_authentication_action (test_t test)
cp_msg_init(&ctx);
ctx.cl = (cl_t *) &cl;
cp_cl_interf_init (&ctx);
- cp_sta_mgr_init (&ctx);
+ cp_eoc_sta_mgr_init (&ctx);
ctx.pbproc = &pbproc_global;
@@ -1034,9 +1078,12 @@ test_case_association_and_authentication_action (test_t test)
{
cp_t ctx;
mac_config_t mac_config;
+
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
uint cl;
cp_net_t *net;
- cp_sta_t *sta;
bitstream_t bitstream;
u8 result;
cp_nid_t nid;
@@ -1052,7 +1099,7 @@ test_case_association_and_authentication_action (test_t test)
cp_msg_init(&ctx);
ctx.cl = (cl_t *) &cl;
cp_cl_interf_init (&ctx);
- cp_sta_mgr_init (&ctx);
+ cp_eoc_sta_mgr_init (&ctx);
lib_rnd_init (&ctx.rnd, 1234);
ctx.fsm.handled_active_state = 0;
@@ -1067,7 +1114,7 @@ test_case_association_and_authentication_action (test_t test)
net = cp_sta_mgr_add_avln (&ctx, snid, nid);
cp_sta_mgr_set_our_avln (&ctx, net);
- sta = cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei, mme->peer.mac);
+ cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei, mme->peer.mac);
mme->mmtype = CC_ASSOC_CNF;
cp_secu_protocol_run_new (&mme->prun, 0, &ctx.rnd);
@@ -1101,9 +1148,12 @@ test_case_association_and_authentication_action (test_t test)
{
cp_t ctx;
mac_config_t mac_config;
+
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
uint cl;
cp_net_t *net;
- cp_sta_t *sta;
cp_mme_rx_t my_mme;
cp_mme_rx_t *mme = &my_mme;
@@ -1112,7 +1162,7 @@ test_case_association_and_authentication_action (test_t test)
cp_msg_init(&ctx);
ctx.cl = (cl_t *) &cl;
cp_cl_interf_init (&ctx);
- cp_sta_mgr_init (&ctx);
+ cp_eoc_sta_mgr_init (&ctx);
//set our avln
net = cp_sta_mgr_add_avln (&ctx, 1, 1);
@@ -1120,7 +1170,7 @@ test_case_association_and_authentication_action (test_t test)
mme->peer.mac = 2;
mme->peer.tei = 5;
- sta = cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei, mme->peer.mac);
+ cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei, mme->peer.mac);
cp_eoc_sta_action_assoc__associating_no_beacons(&ctx);
@@ -1145,9 +1195,12 @@ test_case_association_and_authentication_action (test_t test)
{
cp_t ctx;
mac_config_t mac_config;
+
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
uint cl;
cp_net_t *net;
- cp_sta_t *sta;
bitstream_t bitstream;
u8 result, eks, req_key_type;
cp_nid_t nid;
@@ -1163,7 +1216,7 @@ test_case_association_and_authentication_action (test_t test)
cp_msg_init(&ctx);
ctx.cl = (cl_t *) &cl;
cp_cl_interf_init (&ctx);
- cp_sta_mgr_init (&ctx);
+ cp_eoc_sta_mgr_init (&ctx);
lib_rnd_init (&ctx.rnd, 1234);
mme->prun.my_nonce = ctx.sta_action.assoc.prun.my_nonce = lib_rnd32 (&ctx.rnd);
mme->prun.your_nonce = ctx.sta_action.assoc.prun.your_nonce = lib_rnd32 (&ctx.rnd);
@@ -1190,7 +1243,7 @@ test_case_association_and_authentication_action (test_t test)
net = cp_sta_mgr_add_avln (&ctx, snid, nid);
cp_sta_mgr_set_our_avln (&ctx, net);
- sta = cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei, mme->peer.mac);
+ cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei, mme->peer.mac);
mme->mmtype = CM_GET_KEY_CNF;
bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer), BITSTREAM_READ);
@@ -1231,6 +1284,10 @@ test_case_association_and_authentication_action (test_t test)
{
cp_t ctx;
mac_config_t mac_config;
+
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
uint cl;
cp_net_t *net;
cp_sta_t *sta;
@@ -1249,7 +1306,7 @@ test_case_association_and_authentication_action (test_t test)
cp_msg_init(&ctx);
ctx.cl = (cl_t *) &cl;
cp_cl_interf_init (&ctx);
- cp_sta_mgr_init (&ctx);
+ cp_eoc_sta_mgr_init (&ctx);
lib_rnd_init (&ctx.rnd, 1234);
mme->prun.my_nonce = ctx.sta_action.assoc.prun.my_nonce = lib_rnd32 (&ctx.rnd);
mme->prun.your_nonce = ctx.sta_action.assoc.prun.your_nonce = lib_rnd32 (&ctx.rnd);
@@ -1318,6 +1375,10 @@ test_case_association_and_authentication_action (test_t test)
{
cp_t ctx;
mac_config_t mac_config;
+
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
uint cl;
cp_net_t *net;
cp_sta_t *sta;
@@ -1336,7 +1397,7 @@ test_case_association_and_authentication_action (test_t test)
cp_msg_init(&ctx);
ctx.cl = (cl_t *) &cl;
cp_cl_interf_init (&ctx);
- cp_sta_mgr_init (&ctx);
+ cp_eoc_sta_mgr_init (&ctx);
lib_rnd_init (&ctx.rnd, 1234);
mme->prun.my_nonce = ctx.sta_action.nek_prun.my_nonce = lib_rnd32 (&ctx.rnd);
mme->prun.your_nonce = ctx.sta_action.nek_prun.your_nonce = lib_rnd32 (&ctx.rnd);
@@ -1406,9 +1467,12 @@ test_case_association_and_authentication_action (test_t test)
{
cp_t ctx;
mac_config_t mac_config;
+
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
uint cl;
cp_net_t *net;
- cp_sta_t *sta;
cp_mme_rx_t my_mme;
cp_mme_rx_t *mme = &my_mme;
@@ -1417,7 +1481,7 @@ test_case_association_and_authentication_action (test_t test)
cp_msg_init(&ctx);
ctx.cl = (cl_t *) &cl;
cp_cl_interf_init (&ctx);
- cp_sta_mgr_init (&ctx);
+ cp_eoc_sta_mgr_init (&ctx);
//set our avln
net = cp_sta_mgr_add_avln (&ctx, 1, 1);
@@ -1425,7 +1489,7 @@ test_case_association_and_authentication_action (test_t test)
mme->peer.mac = 2;
mme->peer.tei = 5;
- sta = cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei, mme->peer.mac);
+ cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei, mme->peer.mac);
cp_eoc_sta_action_assoc__associated_no_beacons(&ctx);
@@ -1442,9 +1506,12 @@ test_case_association_and_authentication_action (test_t test)
{
cp_t ctx;
mac_config_t mac_config;
+
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
uint cl;
cp_net_t *net;
- cp_sta_t *sta;
cp_mme_rx_t my_mme;
cp_mme_rx_t *mme = &my_mme;
@@ -1453,7 +1520,7 @@ test_case_association_and_authentication_action (test_t test)
cp_msg_init(&ctx);
ctx.cl = (cl_t *) &cl;
cp_cl_interf_init (&ctx);
- cp_sta_mgr_init (&ctx);
+ cp_eoc_sta_mgr_init (&ctx);
//set our avln
net = cp_sta_mgr_add_avln (&ctx, 1, 1);
@@ -1461,7 +1528,7 @@ test_case_association_and_authentication_action (test_t test)
mme->peer.mac = 2;
mme->peer.tei = 5;
- sta = cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei, mme->peer.mac);
+ cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei, mme->peer.mac);
//cp_sta_own_data_t *own = cp_sta_mgr_get_sta_own_data (&ctx);
@@ -1480,9 +1547,12 @@ test_case_association_and_authentication_action (test_t test)
{
cp_t ctx;
mac_config_t mac_config;
+
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
uint cl;
cp_net_t *net;
- cp_sta_t *sta;
bitstream_t bitstream;
u8 reason;
cp_nid_t nid;
@@ -1496,7 +1566,7 @@ test_case_association_and_authentication_action (test_t test)
cp_msg_init(&ctx);
ctx.cl = (cl_t *) &cl;
cp_cl_interf_init (&ctx);
- cp_sta_mgr_init (&ctx);
+ cp_eoc_sta_mgr_init (&ctx);
lib_rnd_init (&ctx.rnd, 1234);
reason = 0;
@@ -1510,7 +1580,7 @@ test_case_association_and_authentication_action (test_t test)
net = cp_sta_mgr_add_avln (&ctx, snid, nid);
cp_sta_mgr_set_our_avln (&ctx, net);
- sta = cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei, mme->peer.mac);
+ cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei, mme->peer.mac);
mme->mmtype = CC_LEAVE_IND;
bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer), BITSTREAM_READ);
@@ -1547,9 +1617,12 @@ test_case_association_and_authentication_action (test_t test)
{
cp_t ctx;
mac_config_t mac_config;
+
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
uint cl;
cp_net_t *net;
- cp_sta_t *sta;
bitstream_t bitstream;
u8 reason;
cp_nid_t nid;
@@ -1563,7 +1636,7 @@ test_case_association_and_authentication_action (test_t test)
cp_msg_init(&ctx);
ctx.cl = (cl_t *) &cl;
cp_cl_interf_init (&ctx);
- cp_sta_mgr_init (&ctx);
+ cp_eoc_sta_mgr_init (&ctx);
lib_rnd_init (&ctx.rnd, 1234);
reason = 0;
@@ -1577,7 +1650,7 @@ test_case_association_and_authentication_action (test_t test)
net = cp_sta_mgr_add_avln (&ctx, snid, nid);
cp_sta_mgr_set_our_avln (&ctx, net);
- sta = cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei, mme->peer.mac);
+ cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei, mme->peer.mac);
mme->mmtype = CC_LEAVE_IND;
bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer), BITSTREAM_READ);
@@ -1614,9 +1687,12 @@ test_case_association_and_authentication_action (test_t test)
{
cp_t ctx;
mac_config_t mac_config;
+
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
uint cl;
cp_net_t *net;
- cp_sta_t *sta;
cp_mme_rx_t my_mme;
cp_mme_rx_t *mme = &my_mme;
@@ -1625,7 +1701,7 @@ test_case_association_and_authentication_action (test_t test)
cp_msg_init(&ctx);
ctx.cl = (cl_t *) &cl;
cp_cl_interf_init (&ctx);
- cp_sta_mgr_init (&ctx);
+ cp_eoc_sta_mgr_init (&ctx);
//set our avln
net = cp_sta_mgr_add_avln (&ctx, 1, 1);
@@ -1633,7 +1709,7 @@ test_case_association_and_authentication_action (test_t test)
mme->peer.mac = 2;
mme->peer.tei = 5;
- sta = cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei, mme->peer.mac);
+ cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei, mme->peer.mac);
cp_eoc_sta_action_assoc__authenticated_no_beacons(&ctx);
@@ -1662,9 +1738,12 @@ test_case_association_and_authentication_action (test_t test)
{
cp_t ctx;
mac_config_t mac_config;
+
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
uint cl;
cp_net_t *net;
- cp_sta_t *sta;
bitstream_t bitstream;
u8 out_level;
u8 buffer[1024];
@@ -1676,7 +1755,7 @@ test_case_association_and_authentication_action (test_t test)
cp_msg_init(&ctx);
ctx.cl = (cl_t *) &cl;
cp_cl_interf_init (&ctx);
- cp_sta_mgr_init (&ctx);
+ cp_eoc_sta_mgr_init (&ctx);
lib_rnd_init (&ctx.rnd, 1234);
mme->peer.tei = 5;
@@ -1687,7 +1766,7 @@ test_case_association_and_authentication_action (test_t test)
net = cp_sta_mgr_add_avln (&ctx, 1, 1);
cp_sta_mgr_set_our_avln (&ctx, net);
- sta = cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei, mme->peer.mac);
+ cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei, mme->peer.mac);
mme->mmtype = CC_LEAVE_IND;
bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer), BITSTREAM_READ);
@@ -1712,6 +1791,11 @@ test_case_poweron (test_t test)
{
test_case_begin (test, "Poweron");
+ /* TODO : Rewrite this test.
+ * because 'cp_eoc_sta_action__power_on_no_beacons' is not a public
+ * function.
+ */
+#if 0
test_begin (test, "Receiving and processing cp_eoc_sta_action__power_on_no_beacons")
{
cp_t ctx;
@@ -1721,7 +1805,7 @@ test_case_poweron (test_t test)
sar_t sar;
ctx.mac_config = &mac_config;
- cp_sta_mgr_init (&ctx);
+ cp_eoc_sta_mgr_init (&ctx);
ctx.cl=&cl;
ctx.sar=&sar;
@@ -1742,6 +1826,7 @@ test_case_poweron (test_t test)
test_fail_unless(ctx.sta_action.assoc.beacon_loss == 0);
}
test_end
+#endif
test_begin (test, "Receiving and processing cp_sta_action_poweron__idle__to_poweron")
{
@@ -1749,8 +1834,12 @@ test_case_poweron (test_t test)
mac_config_t mac_config;
sar_t sar;
+ memset (&ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+ memset (&sar, 0, sizeof (sar_t));
+
ctx.mac_config = &mac_config;
- cp_sta_mgr_init (&ctx);
+ cp_eoc_sta_mgr_init (&ctx);
ctx.sar=&sar;
ctx.sta_mgr.sta_own_data.nid = 1;
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/Config b/cesar/cp/eoc/sta/action/test/utest2/Config
index 4571a93921..7cd6185d05 100644
--- a/cesar/cp/eoc/sta/action/test/utest_eoc/Config
+++ b/cesar/cp/eoc/sta/action/test/utest2/Config
@@ -1,7 +1,8 @@
+CONFIG_CP_EOC = y
CONFIG_DEBUG_FATAL_CATCH = y
-CONFIG_CP_FSM_DEF = "cp/fsm/src/fsm/cp_eoc_sta.fsm"
+CONFIG_CP_FSM_DEF = "cp/eoc/fsm/src/fsm/cp_eoc_sta.fsm"
CONFIG_CP_EOC_STA_CON_ALLOWED = n
CONFIG_MAC_PBPROC_EOC_FC = y
-CONFIG_CP_MSG_EOC_VS = y
CONFIG_CP_EOC_DBG_PRINT_LEVEL = 0
CONFIG_CP_MSG_EOC_DRV_MME = y
+CONFIG_MAC_COMMON_EOC_SCHED = y
diff --git a/cesar/cp/eoc/sta/action/test/utest2/Makefile b/cesar/cp/eoc/sta/action/test/utest2/Makefile
new file mode 100644
index 0000000000..8fb7efb263
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest2/Makefile
@@ -0,0 +1,18 @@
+BASE = ../../../../../..
+
+INCLUDES = cp/eoc/sta/action/test/utest2/override
+
+HOST_PROGRAMS = assoc
+
+assoc_SOURCES = assoc.c mgr_stub.c core_stub.c cp_stub.c msg_stub.c phy_stub.c
+
+assoc_MODULES = lib mac/common cp/secu \
+ cp/eoc/sta/action cp/eoc/sta/mgr \
+ cp/eoc/fsm/stub cp/eoc/msg/stub cp/eoc/beacon/stub \
+ cp/eoc/cco/bw/stub cl/stub mac/sar/stub bsu/stub \
+ mac/pbproc/stub ce/rx/stub ce/tx/stub
+
+assoc_CONFIG_MODULES = cp cp/eoc mac cl
+assoc_LDLIBS = -lm
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/assoc-override/cp/inc/context.h b/cesar/cp/eoc/sta/action/test/utest2/override/cp/inc/context.h
index b421f966a8..8d1cacdf64 100644
--- a/cesar/cp/eoc/sta/action/test/utest_eoc/assoc-override/cp/inc/context.h
+++ b/cesar/cp/eoc/sta/action/test/utest2/override/cp/inc/context.h
@@ -20,6 +20,7 @@
#include "cp/inc/trace.h"
#include "cp/cp.h"
+#include "ce/rx/rx.h"
#include "mac/common/store.h"
#include "cp/types.h"
#include "cp/sta/action/inc/context.h"
@@ -31,6 +32,7 @@
#include "cl/cl.h"
#include "cp/msg/inc/context.h"
#include "mac/pbproc/inc/context.h"
+#include "bsu/aclf/aclf.h"
struct cp_t
{
@@ -58,6 +60,10 @@ struct cp_t
cl_t *cl;
/** Segmentation and reassembly context */
sar_t *sar;
+ /** Context of the CE in RX. */
+ ce_rx_t *ce_rx;
+ /** Context of the aclf. */
+ bsu_aclf_t *bsu_aclf;
/** Random generator. */
lib_rnd_t rnd;
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/assoc-override/cp/sta/core/core.h b/cesar/cp/eoc/sta/action/test/utest2/override/cp/sta/core/core.h
index 50037dbf8e..50037dbf8e 100644
--- a/cesar/cp/eoc/sta/action/test/utest_eoc/assoc-override/cp/sta/core/core.h
+++ b/cesar/cp/eoc/sta/action/test/utest2/override/cp/sta/core/core.h
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/assoc-override/mac/sar/inc/sar_context.h b/cesar/cp/eoc/sta/action/test/utest2/override/mac/sar/inc/context.h
index e380fb66e7..9f3d703e62 100644
--- a/cesar/cp/eoc/sta/action/test/utest_eoc/assoc-override/mac/sar/inc/sar_context.h
+++ b/cesar/cp/eoc/sta/action/test/utest2/override/mac/sar/inc/context.h
@@ -1,19 +1,20 @@
-#ifndef overide_mac_sar_inc_context_h
-#define overide_mac_sar_inc_context_h
+#ifndef cp_eoc_sta_action_test_utest2_override_mac_sar_inc_context_h
+#define cp_eoc_sta_action_test_utest2_override_mac_sar_inc_context_h
/* Cesar project {{{
*
- * Copyright (C) 2008 Spidcom
+ * Copyright (C) 2009 Spidcom
*
* <<<Licence>>>
*
* }}} */
/**
- * \file overide/mac/sar/inc/context.h
+ * \file cp/eoc/sta/action/test/utest2/override/mac/sar/inc/context_h.h
* \brief « brief description »
- * \ingroup « module »
+ * \ingroup cp_eoc_sta_action_test_utest2_override_mac_sar_inc
*
* « long description »
*/
+
struct sar_stats_t
{
/** Total number of PB received by ourself (from anyone). */
@@ -34,4 +35,4 @@ struct sar_t
sar_stats_t stats;
};
-#endif /* overide_mac_sar_inc_context_h */
+#endif /* cp_eoc_sta_action_test_utest2_override_mac_sar_inc_context_h */
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/src/assoc.c b/cesar/cp/eoc/sta/action/test/utest2/src/assoc.c
index 737b1d0bf1..737b1d0bf1 100644
--- a/cesar/cp/eoc/sta/action/test/utest_eoc/src/assoc.c
+++ b/cesar/cp/eoc/sta/action/test/utest2/src/assoc.c
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/src/core_stub.c b/cesar/cp/eoc/sta/action/test/utest2/src/core_stub.c
index c44446385a..c44446385a 100644
--- a/cesar/cp/eoc/sta/action/test/utest_eoc/src/core_stub.c
+++ b/cesar/cp/eoc/sta/action/test/utest2/src/core_stub.c
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/src/cp_stub.c b/cesar/cp/eoc/sta/action/test/utest2/src/cp_stub.c
index 672ffb388b..672ffb388b 100644
--- a/cesar/cp/eoc/sta/action/test/utest_eoc/src/cp_stub.c
+++ b/cesar/cp/eoc/sta/action/test/utest2/src/cp_stub.c
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/src/mgr_stub.c b/cesar/cp/eoc/sta/action/test/utest2/src/mgr_stub.c
index ef3d52049c..51d1f9f472 100644
--- a/cesar/cp/eoc/sta/action/test/utest_eoc/src/mgr_stub.c
+++ b/cesar/cp/eoc/sta/action/test/utest2/src/mgr_stub.c
@@ -17,45 +17,6 @@
#include "cp/inc/context.h"
#include "cp/msg/inc/cc_assoc.h"
-// void
-// cp_sta_mgr_set_our_avln (cp_t *ctx, cp_net_t *net)
-// {
-// }
-//
-// void
-// cp_sta_mgr_sta_remove (cp_t *ctx, cp_sta_t * sta)
-// {
-// }
-//
-// cp_sta_t *
-// cp_sta_mgr_sta_get_assoc (cp_t *ctx, cp_net_t *net, cp_tei_t tei)
-// {
-// return NULL;
-// }
-//
-// cp_sta_t *
-// cp_sta_mgr_sta_add (cp_t *ctx, cp_net_t *net, cp_tei_t tei, mac_t mac_address)
-// {
-// return NULL;
-// }
-//
-// cp_sta_own_data_t *
-// cp_sta_mgr_get_sta_own_data (cp_t *ctx)
-// {
-// dbg_assert (ctx);
-//
-// return (cp_sta_own_data_t *) &ctx->sta_mgr.sta_own_data;
-// }
-//
-// cp_net_t *
-// cp_sta_mgr_get_our_avln (cp_t *ctx)
-// {
-// dbg_assert (ctx);
-// dbg_assert (ctx->sta_mgr.our_avln);
-//
-// return ctx->sta_mgr.our_avln;
-// }
-
bool
cp_msg_cc_assoc_cnf_receive (cp_t *ctx, cp_mme_rx_t *mme,
cp_msg_cc_assoc_cnf_t *data)
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/src/msg_stub.c b/cesar/cp/eoc/sta/action/test/utest2/src/msg_stub.c
index a48f4afb21..a48f4afb21 100644
--- a/cesar/cp/eoc/sta/action/test/utest_eoc/src/msg_stub.c
+++ b/cesar/cp/eoc/sta/action/test/utest2/src/msg_stub.c
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/src/phy_stub.c b/cesar/cp/eoc/sta/action/test/utest2/src/phy_stub.c
index 92ff6578ef..92ff6578ef 100644
--- a/cesar/cp/eoc/sta/action/test/utest_eoc/src/phy_stub.c
+++ b/cesar/cp/eoc/sta/action/test/utest2/src/phy_stub.c
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/Makefile b/cesar/cp/eoc/sta/action/test/utest_eoc/Makefile
deleted file mode 100644
index 1c0b9308f5..0000000000
--- a/cesar/cp/eoc/sta/action/test/utest_eoc/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-all: scenario assoc
-
-scenario: scenario-Makefile
- make -f scenario-Makefile
-
-assoc: assoc-Makefile
- make -f assoc-Makefile
-
-clean: scenario-Makefile assoc-Makefile
- make -f scenario-Makefile clean
- make -f assoc-Makefile clean
- rm -rf obj
-
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/assoc-override/mac/sar/inc/context.h b/cesar/cp/eoc/sta/action/test/utest_eoc/assoc-override/mac/sar/inc/context.h
deleted file mode 100644
index b74c7a57e3..0000000000
--- a/cesar/cp/eoc/sta/action/test/utest_eoc/assoc-override/mac/sar/inc/context.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef overide_mac_sar_inc_context_h
-#define overide_mac_sar_inc_context_h
-/* Cesar project {{{
- *
- * Copyright (C) 2009 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file overide/mac/sar/inc/context.h
- * \brief « brief description »
- * \ingroup « module »
- *
- * « long description »
- */
-
-struct sar_t
-{
- mac_store_t *mac_store;
-};
-
-#endif /* overide_mac_sar_inc_context_h */
diff --git a/cesar/cp/eoc/sta/action/vs.h b/cesar/cp/eoc/sta/action/vs.h
new file mode 100644
index 0000000000..a8b2c5c95d
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/vs.h
@@ -0,0 +1,38 @@
+#ifndef cp_eoc_sta_action_vs_h
+#define cp_eoc_sta_action_vs_h
+/* Cesar-EoC project {{{
+ *
+ * Copyright (C) 2009 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eoc/sta/action/vs.h
+ * \brief sta action, Vendor Specific EoC MME related prototypes.
+ * \ingroup cp_eoc_sta_action
+ */
+#include "cp/cp.h"
+#include "cp/mme.h"
+
+/** Forward declaration. */
+typedef struct real_time_stats_t real_time_stats_t;
+
+BEGIN_DECLS
+
+void
+cp_eoc_sta_action_vs__vs_eoc_get_info_req (
+ cp_t *ctx, cp_mme_rx_t *mme);
+
+void
+cp_eoc_sta_action_vs__vs_eoc_diagnostic_info_req (
+ cp_t *ctx, cp_mme_rx_t *mme);
+
+void
+cp_eoc_sta_action_vs__vs_eoc_get_real_time_statistics_req (
+ cp_t *ctx, cp_mme_rx_t *mme);
+
+
+END_DECLS
+
+#endif /* cp_eoc_sta_action_vs_h */
diff --git a/cesar/cp/eoc/sta/action/vs_eoc.h b/cesar/cp/eoc/sta/action/vs_eoc.h
deleted file mode 100644
index 624822dc1d..0000000000
--- a/cesar/cp/eoc/sta/action/vs_eoc.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef cp_eoc_sta_action_vs_eoc_h
-#define cp_eoc_sta_action_vs_eoc_h
-/* Cesar-EoC project {{{
- *
- * Copyright (C) 2009 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file cp/eoc/sta/action/vs_eoc.h
- * \brief sta action, Vendor Specific EoC MME related prototypes.
- * \ingroup cp_eoc_sta_action
- */
-
-
-struct real_time_stats_t {
- uint nb_unicast_packets_rx;
- uint nb_unicast_packets_tx;
- uint total_nb_bytes_rx;
- uint total_nb_bytes_tx;
- uint nb_broadcast_packets_rx;
- uint nb_broadcast_packets_tx;
- uint nb_multicast_packets_rx;
- uint nb_multicast_packets_tx;
- uint nb_packets_rx_crc;
- uint nb_packets_rx_short;
- uint nb_packets_tx_short;
- uint nb_packets_tx_dropped;
- uint nb_packets_rx_discarded;
- uint avg_pre_fec_bit_error_rate;
-};
-typedef struct real_time_stats_t real_time_stats_t;
-
-
-BEGIN_DECLS
-
-void
-cp_eoc_sta_action_vs_eoc__sta__vs_eoc_get_info_req(cp_t *ctx, cp_mme_rx_t *mme);
-
-void
-cp_eoc_sta_action_vs_eoc__sta__vs_eoc_diagnostic_info_req(cp_t *ctx, cp_mme_rx_t *mme);
-
-void
-cp_eoc_sta_action_vs_eoc__sta__vs_eoc_get_real_time_statistics_req(cp_t *ctx, cp_mme_rx_t *mme);
-
-
-END_DECLS
-
-#endif /* cp_eoc_sta_action_vs_eoc_h */
diff --git a/cesar/cp/eoc/sta/mgr/Module b/cesar/cp/eoc/sta/mgr/Module
index 4c1c9cc32b..ae884c7de9 100644
--- a/cesar/cp/eoc/sta/mgr/Module
+++ b/cesar/cp/eoc/sta/mgr/Module
@@ -1 +1,3 @@
-SOURCES:= sta_mgr.c sta_own_data.c
+SOURCES := sta_mgr.c sta_own_data.c
+
+MODULES := cp/sta/mgr
diff --git a/cesar/cp/eoc/sta/mgr/src/sta_mgr.c b/cesar/cp/eoc/sta/mgr/src/sta_mgr.c
index d9b3d450be..01803ea5c0 100644
--- a/cesar/cp/eoc/sta/mgr/src/sta_mgr.c
+++ b/cesar/cp/eoc/sta/mgr/src/sta_mgr.c
@@ -12,189 +12,25 @@
*
*/
#include "common/std.h"
-#include "lib/rnd.h"
+/* Private headers. */
+#include "cp/inc/context.h"
+#include "cp/sta/mgr/inc/sta_mgr.h"
+#include "cp/sta/mgr/inc/sta.h"
+
+/* Public headers. */
+#include "lib/rnd.h"
#include "cp/defs.h"
-#include "cp/cp.h"
-#include "cp/fsm/fsm.h"
#include "cp/eoc/sta/mgr/sta_mgr.h"
#include "cp/sta/mgr/sta_own_data.h"
#include "cp/sta/core/core.h"
#include "cp/eoc/cco/action/cco_action.h"
-#include "cp/cco/action/cco_action.h"
#include "cl/cl_mactotei.h"
#include "mac/sar/sar.h"
-#include "cp/inc/context.h"
-#include "cp/sta/mgr/inc/sta.h"
+/* Config headers. */
#include "config/cp/sta/mgr/cco/eoc.h"
-#include "stdio.h"
-
-/**
- * Elects a station in our AVLN to be the acknowledge station for all the
- * station to which the packet is send.
- * \param ctx the module context.
- *
- * This function choose the station using the data of the tone maps in the
- * station contained in the mac store. It shall insert in the mac config the
- * station's TEI which will acknowledge the packets.
- * The station manager is responsible to elects another station if the current
- * one is removed or if another one shall become the acknowledge station.
- */
-
-void
-cp_sta_mgr_elects_sta_partial_ack (cp_t *ctx)
-{
- dbg_assert (ctx);
- cp_net_t *net = ctx->sta_mgr.our_avln;
- cp_tei_t pack = MAC_TEI_BCAST;
- if (net)
- {
- cp_sta_t *sta;
- u8 *tei_table = blk_alloc ();
- uint tei_nb = 0;
- /* Get all the TEI of the network and store it into the tei table. */
- /* Store the TEI of the station. */
- for (sta = cp_net_sta_get_first (ctx, net, CP_NET_STA_ASSOC);
- sta;
- sta = cp_net_sta_get_next (ctx, net, sta))
- tei_table[tei_nb++] = cp_sta_get_tei (sta);
- if (tei_nb)
- {
- /* Choose the TEI of the partial ACK station, */
- uint pos = lib_rnd_uniform (&ctx->rnd, tei_nb);
- pack = tei_table[pos];
- }
- /* Release the block used. */
- blk_release (tei_table);
- }
- ctx->mac_config->partial_ack_tei_default = pack;
-}
-
-/**
- * Compare two station with the mac address.
- * \param left the left station.
- * \param right the right station.
- */
-static bool
-cp_sta_mgr_sta_mac_address_less (set_node_t *left, set_node_t *right)
-{
- cp_sta_private_t *sta_left;
- cp_sta_private_t *sta_right;
-
- dbg_assert (left);
- dbg_assert (right);
-
- sta_left = (cp_sta_private_t *) PARENT_OF (cp_sta_t,
- node_sta_mgr,
- left);
- sta_right = (cp_sta_private_t *) PARENT_OF (cp_sta_t,
- node_sta_mgr,
- right);
-
- if (sta_left->mac_address < sta_right->mac_address)
- return true;
- else
- return false;
-}
-
-/**
- * Get the first station from the release station list.
- * \param ctx the CP context.
- * \return the first station of the list.
- *
- * \warn It does not add a reference on the list, so a slab_release on the
- * station will free the station data, without removing it from the dataplane.
- */
-static cp_sta_t *
-cp_sta_mgr_release_sta_get_first (cp_t *ctx)
-{
- cp_sta_t *sta = NULL;
-
- dbg_assert (ctx);
-
- if (!list_empty (&ctx->sta_mgr.release_sta_list))
- {
- sta = PARENT_OF (cp_sta_t, release_node,
- list_begin (&ctx->sta_mgr.release_sta_list));
- dbg_check (sta);
- }
-
- return sta;
-}
-
-/**
- * Add a station to the station manager.
- * \param ctx the CP context.
- * \param net the network within the station exists.
- * \param tei the station's TEI.
- * \param mac_address the station's mac address.
- * \return the newly created station.
- */
-static cp_sta_t*
-cp_sta_mgr_sta_add_realy (cp_t *ctx, cp_net_t *net, cp_tei_t tei,
- mac_t mac_address)
-{
- cp_sta_private_t *sta;
- bool state;
-
- sta = (cp_sta_private_t *) cp_sta_init (&ctx->sta_mgr.sta_slab_cache);
-
- sta->tei = tei;
- sta->mac_address = mac_address;
- sta->net = net;
-
- if (MAC_TEI_IS_STA (tei))
- sta->net->num_associated_stas ++;
-
- net->num_visible_stas ++;
- net->num_stas ++;
- sta->visible = true;
- sta->association_confirmed = true;
-
- /* Add the station to the station manager set only if the mac address is
- * not a broadcast one. */
- if (mac_address != MAC_BROADCAST)
- {
- state = set_insert (&ctx->sta_mgr.stas,
- &sta->public_data.node_sta_mgr);
- dbg_check (state);
- }
-
-
- // Add the station to the non unassociated list.
- if (tei == MAC_TEI_UNASSOCIATED)
- {
- state = set_insert (&net->unassociated_stas,
- &sta->public_data.node_net);
- dbg_check (state);
- }
- // Add the station to the authenticated list.
- else
- {
- state = set_insert (&net->associated_stas,
- &sta->public_data.node_net);
- dbg_check (state);
-
- if (net == ctx->sta_mgr.our_avln)
- {
- dbg_assert (ctx->mac_store);
- dbg_assert (ctx->cl);
-
- mac_store_sta_add (ctx->mac_store, tei);
- cp_sta_set_assoc_confirmed (ctx, (cp_sta_t *) sta, true);
- cp_sta_mgr_commit_to_dataplane (ctx);
- }
- }
-
- // Add a reference on the station.
- slab_addref (sta);
-
- return &sta->public_data;
-}
-
-
/**
* Add a station to the associated or unassociated list.
* \param ctx the CP context.
@@ -203,54 +39,55 @@ cp_sta_mgr_sta_add_realy (cp_t *ctx, cp_net_t *net, cp_tei_t tei,
* \param mac_address the station's mac address.
* \param sta the station.
*/
-void
-cp_sta_mgr_sta_add_to_assoc_or_unassoc (cp_t *ctx, cp_net_t *net, cp_tei_t tei,
- mac_t mac_address, cp_sta_private_t *sta)
+static void
+cp_eoc_sta_mgr_sta_add_to_assoc_or_unassoc (
+ cp_t *ctx, cp_net_t *net, cp_tei_t tei, mac_t mac_address,
+ cp_sta_private_t *sta)
{
bool state;
if (MAC_TEI_IS_STA (tei))
sta->net->num_associated_stas ++;
- if(MAC_TEI_IS_STA (tei))
+ if (MAC_TEI_IS_STA (tei))
{
- if(!((cp_sta_mgr_sta_is_assoc (ctx, net, tei))
- || (cp_sta_mgr_sta_is_unassoc (ctx, net, mac_address))))
+ if (!((cp_eoc_sta_mgr_sta_is_assoc (ctx, net, tei))
+ || (cp_eoc_sta_mgr_sta_is_unassoc (ctx, net, mac_address))))
{
net->num_visible_stas ++;
net->num_stas ++;
sta->visible = true;
}
}
- else if(!(cp_sta_mgr_sta_is_unassoc (ctx, net, mac_address)))
+ else if (!(cp_eoc_sta_mgr_sta_is_unassoc (ctx, net, mac_address)))
{
net->num_visible_stas ++;
net->num_stas ++;
sta->visible = true;
}
- // Add the station to the non unassociated list.
+ /* Add the station to the non unassociated list. */
if (tei == MAC_TEI_UNASSOCIATED)
{
- if(cp_sta_mgr_sta_is_assoc (ctx, net, sta->tei))
+ if (cp_eoc_sta_mgr_sta_is_assoc (ctx, net, sta->tei))
{
- set_remove(&net->associated_stas, &sta->public_data.node_net);
+ set_remove (&net->associated_stas, &sta->public_data.node_net);
if (MAC_TEI_IS_STA (sta->tei))
sta->net->num_associated_stas--;
}
- if(!(cp_sta_mgr_sta_is_unassoc (ctx, net, mac_address)))
+ if (!(cp_eoc_sta_mgr_sta_is_unassoc (ctx, net, mac_address)))
{
state = set_insert (&net->unassociated_stas,
&sta->public_data.node_net);
dbg_check (state);
}
}
- // Add the station to the associated list.
+ /* Add the station to the associated list. */
else
{
- if(cp_sta_mgr_sta_is_unassoc (ctx, net, mac_address))
- set_remove(&net->unassociated_stas, &sta->public_data.node_net);
+ if (cp_eoc_sta_mgr_sta_is_unassoc (ctx, net, mac_address))
+ set_remove (&net->unassociated_stas, &sta->public_data.node_net);
dbg_assert (ctx->mac_store);
@@ -262,14 +99,8 @@ cp_sta_mgr_sta_add_to_assoc_or_unassoc (cp_t *ctx, cp_net_t *net, cp_tei_t tei,
}
}
-/**
- * Add a station to the stas list.
- * \param ctx the CP context.
- * \param station the station.
- */
-
void
-cp_eoc_sta_mgr_sta_insert_into_stas_list(cp_t *ctx, cp_sta_private_t *station)
+cp_eoc_sta_mgr_sta_insert_into_stas_list (cp_t *ctx, cp_sta_private_t *station)
{
bool state;
state = set_insert (&ctx->sta_mgr.stas,
@@ -279,25 +110,25 @@ cp_eoc_sta_mgr_sta_insert_into_stas_list(cp_t *ctx, cp_sta_private_t *station)
void
-cp_sta_mgr_init (cp_t *ctx)
+cp_eoc_sta_mgr_init (cp_t *ctx)
{
dbg_assert (ctx);
memset (&ctx->sta_mgr, 0, sizeof (cp_sta_mgr_t));
- // Initialise the station own data.
+ /* Initialise the station own data. */
cp_sta_own_data_init (ctx);
- // Initialise the list of releasing stations.
+ /* Initialise the list of releasing stations. */
list_init (&ctx->sta_mgr.release_sta_list);
- // Initialise the slab cache.
+ /* Initialise the slab cache. */
slab_cache_init (&ctx->sta_mgr.sta_slab_cache,
"Station cache",
sizeof (cp_sta_private_t),
(slab_object_destructor_t) cp_sta_uninit);
- // Initialise the set of station sorted by mac addresses.
+ /* Initialise the set of station sorted by mac addresses. */
set_init (&ctx->sta_mgr.stas, cp_sta_mgr_sta_mac_address_less);
lib_stats_set_stat_value_notype ("OUTPUT_LEVEL_ALL",
@@ -307,165 +138,7 @@ cp_sta_mgr_init (cp_t *ctx)
}
void
-cp_sta_mgr_uninit (cp_t *ctx)
-{
- cp_net_t *net;
- dbg_assert (ctx);
-
- // Uninitialise the station contained in the release list.
- if (ctx->sta_mgr.our_avln)
- {
- cp_sta_t *sta;
- while ((sta = cp_sta_mgr_release_sta_get_first (ctx)))
- {
- sar_sta_remove (ctx->sar, cp_sta_get_tei (sta));
- /* Remove the station from the list. */
- list_remove (&ctx->sta_mgr.release_sta_list,
- &sta->release_node);
- slab_release (sta);
- }
-
- while ((sta = cp_net_sta_get_first (ctx, ctx->sta_mgr.our_avln,
- CP_NET_STA_ASSOC)))
- {
- cp_sta_mgr_sta_remove (ctx, sta);
- slab_release (sta);
- }
- }
-
- /* Remove all the AVLN present in the station manager. */
- for (net = cp_sta_mgr_get_first_avln (ctx);
- net;
- net = cp_sta_mgr_get_next_avln (ctx, net))
- cp_sta_mgr_remove_avln (
- ctx, cp_net_get_snid (ctx, net), cp_net_get_nid (ctx, net));
- // Uninitialise the station own data.
- cp_sta_own_data_uninit (ctx);
-}
-
-cp_net_t *
-cp_sta_mgr_add_avln (cp_t *ctx, cp_snid_t snid, cp_nid_t nid)
-{
- dbg_assert (ctx);
- dbg_assert (HPAV_NID_IS_VALID (nid));
- /* Search in the network list. */
- cp_net_t *net = cp_sta_mgr_get_avln (ctx, snid, nid);
- if (!net)
- {
- uint i;
- for (i = 0; i < HPAV_AVLNS_NB_MAX && !net; i++)
- {
- if (ctx->sta_mgr.networks[i].present == false)
- {
- net = &ctx->sta_mgr.networks[i];
- cp_net_init (ctx, net);
- net->present = true;
- net->snid = snid;
- net->nid = nid;
- }
- }
- }
- return net;
-}
-
-void
-cp_sta_mgr_remove_avln (cp_t *ctx, cp_snid_t snid, cp_nid_t nid)
-{
- dbg_assert (ctx);
- dbg_assert (HPAV_NID_IS_VALID (nid));
- cp_net_t *net = cp_sta_mgr_get_avln (ctx, snid, nid);
- if (net)
- {
- /* Is it our net ? */
- if (ctx->sta_mgr.our_avln == net)
- cp_sta_mgr_set_our_avln (ctx, NULL);
- /* Get the CCo to inform the BSU. */
- mac_t cco_mac = MAC_ZERO;
- cp_sta_t *cco = cp_net_get_cco (ctx, net);
- if (cco)
- {
- cco_mac = cp_sta_get_mac_address (cco);
- /* Mac address can be broadcast. */
- if (cco_mac == MAC_BROADCAST)
- cco_mac = MAC_ZERO;
- slab_release (cco);
- }
- if (net == ctx->sta_mgr.our_avln)
- cp_sta_mgr_set_our_avln (ctx, NULL);
- /* Inform BSU. */
- bsu_avln_remove (ctx->bsu, nid, snid, cco_mac);
- cp_net_uninit (ctx, net);
- }
-}
-
-cp_net_t *
-cp_sta_mgr_get_avln (cp_t *ctx, cp_snid_t snid, cp_nid_t nid)
-{
- dbg_assert (ctx);
- dbg_assert (HPAV_NID_IS_VALID (nid));
- cp_net_t *net = NULL;
- for (net = cp_sta_mgr_get_first_avln (ctx);
- net;
- net = cp_sta_mgr_get_next_avln (ctx, net))
- {
- if (net->nid == nid && net->snid == snid)
- return net;
- }
- return NULL;
-}
-
-cp_net_t *
-cp_sta_mgr_get_first_avln (cp_t *ctx)
-{
- dbg_assert (ctx);
- uint i;
- cp_net_t *net = NULL;
- for (i = 0; i < HPAV_AVLNS_NB_MAX && !net; i++)
- {
- if (ctx->sta_mgr.networks[i].present)
- net = &ctx->sta_mgr.networks[i];
- }
- return net;
-}
-
-cp_net_t *
-cp_sta_mgr_get_next_avln (cp_t *ctx, cp_net_t *prev)
-{
- dbg_assert (ctx);
- dbg_assert (prev);
- dbg_assert (prev <= &ctx->sta_mgr.networks[HPAV_AVLNS_NB_MAX-1]);
- cp_net_t *net = NULL;
- /* Two possibilities, prev is already the last AVLN. */
- if (prev == &ctx->sta_mgr.networks[HPAV_AVLNS_NB_MAX-1])
- return NULL;
- else
- for (net = prev + 1;
- !net->present
- && net != &ctx->sta_mgr.networks[HPAV_AVLNS_NB_MAX-1];
- net++)
- ;
- /* If net is present return it. */
- if (net->present)
- return net;
- else
- return NULL;
-}
-
-u16
-cp_sta_mgr_get_present_snids (cp_t *ctx)
-{
- dbg_assert (ctx);
- uint snidflags = 0;
- cp_net_t *net;
- for (net = cp_sta_mgr_get_first_avln (ctx);
- net;
- net = cp_sta_mgr_get_next_avln (ctx, net))
- snidflags |= (u16) (1 << (net->snid));
- return snidflags;
-}
-
-void
-cp_sta_mgr_garbage (cp_t *ctx)
+cp_eoc_sta_mgr_garbage (cp_t *ctx)
{
cp_sta_t *sta;
cp_net_t *net;
@@ -496,148 +169,8 @@ cp_sta_mgr_garbage (cp_t *ctx)
cp_sta_mgr_elects_sta_partial_ack (ctx);
}
-cp_sta_own_data_t *
-cp_sta_mgr_get_sta_own_data (cp_t *ctx)
-{
- dbg_assert (ctx);
-
- return (cp_sta_own_data_t *) &ctx->sta_mgr.sta_own_data;
-}
-
-u8
-cp_sta_mgr_get_slot_usage (cp_t *ctx)
-{
- dbg_assert (ctx);
- uint slot_usage = 0;
- cp_net_t *net;
- for (net = cp_sta_mgr_get_first_avln (ctx);
- net;
- net = cp_sta_mgr_get_next_avln (ctx, net))
- slot_usage |= 1 << (net->avln_slot_id);
- return slot_usage;
-}
-
-u8
-cp_sta_mgr_get_num_discovered_stas (cp_t *ctx)
-{
- dbg_assert (ctx);
- uint num = 0;
- cp_net_t *net;
- for (net = cp_sta_mgr_get_first_avln (ctx);
- net;
- net = cp_sta_mgr_get_next_avln (ctx, net))
- num += cp_net_get_num_discovered_stas (ctx, net);
- return num;
-}
-
-u8
-cp_sta_mgr_get_num_discovered_net (cp_t *ctx)
-{
- dbg_assert (ctx);
- uint num = 0;
- cp_net_t *net;
- for (net = cp_sta_mgr_get_first_avln (ctx);
- net;
- net = cp_sta_mgr_get_next_avln (ctx, net))
- {
- if (ctx->sta_mgr.our_avln != net)
- num ++;
- }
- return num;
-}
-
-bool
-cp_sta_mgr_net_list_is_empty (cp_t *ctx)
-{
- dbg_assert (ctx);
- cp_net_t *net;
- for (net = cp_sta_mgr_get_first_avln (ctx);
- net;
- net = cp_sta_mgr_get_next_avln (ctx, net))
- {
- if (net != ctx->sta_mgr.our_avln)
- return false;
- }
- /* If we are here, all the AVLNs are empty, test our one. */
- if (ctx->sta_mgr.our_avln)
- return (set_empty (&ctx->sta_mgr.our_avln->associated_stas)
- && set_empty (&ctx->sta_mgr.our_avln->unassociated_stas));
- else
- return true;
-}
-
-cp_net_t *
-cp_sta_mgr_get_our_avln (cp_t *ctx)
-{
- dbg_assert (ctx);
- dbg_assert (ctx->sta_mgr.our_avln);
- dbg_assert (ctx->sta_mgr.our_avln->present);
- return ctx->sta_mgr.our_avln;
-}
-
-void
-cp_sta_mgr_set_our_avln (cp_t *ctx, cp_net_t *net)
-{
- cp_sta_t *sta;
- dbg_assert (ctx);
- dbg_assert (ctx->cl);
- dbg_assert (ctx->sar);
-
- /* If our AVLN was already setted, remove the station from the store. */
- if (ctx->sta_mgr.our_avln)
- {
- cp_sta_t *sta;
- /* Release the CL's mac to tei table. */
- cl_mactotei_release_table (ctx->cl);
-
- /* Release the station from the mac store. */
- sta = cp_net_sta_get_first (ctx, ctx->sta_mgr.our_avln,
- CP_NET_STA_ASSOC);
- while (sta)
- {
- sar_sta_remove (ctx->sar, cp_sta_get_tei (sta));
- sta = cp_net_sta_get_next (ctx, net, sta);
- }
-
- /* Release the station in the release state. */
- if (cp_sta_own_data_get_cco_status (ctx))
- {
- while ((sta = cp_sta_mgr_release_sta_get_first (ctx)))
- {
- sar_sta_remove (ctx->sar, cp_sta_get_tei (sta));
- /* Remove the station from the list. */
- list_remove (&ctx->sta_mgr.release_sta_list,
- &sta->release_node);
- slab_release (sta);
- }
- }
-
- sar_cleanup (ctx->sar);
- }
-
- ctx->sta_mgr.our_avln = net;
-
- if (net)
- {
- // Store the nid and the snid to the station own data.
- cp_sta_own_data_set_nid (ctx, cp_net_get_nid (ctx, net));
- cp_sta_own_data_set_snid (ctx, cp_net_get_snid (ctx, net));
-
- /* Commit the new list. */
- cp_sta_mgr_commit_to_dataplane (ctx);
-
- /* Add the station to the store. */
- for (sta = cp_net_sta_get_first (ctx, net, CP_NET_STA_ASSOC);
- sta;
- sta = cp_net_sta_get_next (ctx, net, sta))
- {
- mac_store_sta_add (ctx->mac_store, cp_sta_get_tei (sta));
- }
- }
-}
-
void
-cp_sta_mgr_release_station (cp_t *ctx, cp_tei_t tei)
+cp_eoc_sta_mgr_release_station (cp_t *ctx, cp_tei_t tei)
{
cp_sta_t *sta;
cp_net_t *net;
@@ -653,16 +186,17 @@ cp_sta_mgr_release_station (cp_t *ctx, cp_tei_t tei)
/* Remove the station from the set of the net. */
set_remove (&net->associated_stas, &sta->node_net);
set_insert (&net->unassociated_stas, &sta->node_net);
- net->num_associated_stas--;
+ net->num_associated_stas --;
/* Remove the station from the sta mgr set. */
- if(((cp_sta_private_t *)sta)->tei == MAC_TEI_UNASSOCIATED)
+ if (((cp_sta_private_t *)sta)->tei == MAC_TEI_UNASSOCIATED)
set_remove (&ctx->sta_mgr.stas, &sta->node_sta_mgr);
/* Remove the reference provided. */
slab_release (sta);
}
cp_sta_t *
-cp_sta_mgr_sta_add (cp_t *ctx, cp_net_t *net, cp_tei_t tei, mac_t mac_address)
+cp_eoc_sta_mgr_sta_add (cp_t *ctx, cp_net_t *net, cp_tei_t tei,
+ mac_t mac_address)
{
cp_sta_private_t *sta = NULL;
@@ -672,19 +206,18 @@ cp_sta_mgr_sta_add (cp_t *ctx, cp_net_t *net, cp_tei_t tei, mac_t mac_address)
|| (mac_address & ~MAC_BROADCAST) == 0);
/* Try to get the station by the TEI. */
-
if (tei)
sta = (cp_sta_private_t *) cp_sta_mgr_sta_get_assoc (ctx, net, tei);
/* Try to get the station by the mac address. */
if (!sta && (mac_address != MAC_BROADCAST))
- sta = (cp_sta_private_t *) cp_sta_mgr_sta_get_from_mac (ctx,
- mac_address);
+ sta = (cp_sta_private_t *) cp_sta_mgr_sta_get_from_mac (
+ ctx, mac_address);
if (!sta)
{
- sta = (cp_sta_private_t *) cp_sta_mgr_sta_add_realy (ctx, net,
- tei, mac_address);
+ sta = (cp_sta_private_t *) cp_sta_mgr_sta_add_realy (
+ ctx, net, tei, mac_address);
}
else
{
@@ -694,8 +227,8 @@ cp_sta_mgr_sta_add (cp_t *ctx, cp_net_t *net, cp_tei_t tei, mac_t mac_address)
cp_sta_mgr_sta_remove (ctx, (cp_sta_t *) sta);
slab_release (sta);
- sta = (cp_sta_private_t *) cp_sta_mgr_sta_add_realy (ctx, net, tei,
- mac_address);
+ sta = (cp_sta_private_t *) cp_sta_mgr_sta_add_realy (
+ ctx, net, tei, mac_address);
}
/* First case only the TEI change from the previous state. */
else if ((sta->tei == MAC_TEI_UNASSOCIATED)
@@ -707,8 +240,8 @@ cp_sta_mgr_sta_add (cp_t *ctx, cp_net_t *net, cp_tei_t tei, mac_t mac_address)
slab_release (sta);
/* Add the station with the new TEI. */
- sta = (cp_sta_private_t *) cp_sta_mgr_sta_add_realy (ctx, net, tei,
- mac_address);
+ sta = (cp_sta_private_t *) cp_sta_mgr_sta_add_realy (
+ ctx, net, tei, mac_address);
if (net == ctx->sta_mgr.our_avln)
mac_store_sta_add (ctx->mac_store, tei);
}
@@ -741,10 +274,10 @@ cp_sta_mgr_sta_add (cp_t *ctx, cp_net_t *net, cp_tei_t tei, mac_t mac_address)
&& (sta->mac_address == mac_address)
&& (mac_address != MAC_BROADCAST))
{
- if(!((cp_sta_mgr_sta_is_assoc (ctx, net, sta->tei))
- || (cp_sta_mgr_sta_is_unassoc (ctx, net, mac_address))))
- cp_sta_mgr_sta_add_to_assoc_or_unassoc (ctx, net, tei,
- mac_address, sta);
+ if (!((cp_eoc_sta_mgr_sta_is_assoc (ctx, net, sta->tei))
+ || (cp_eoc_sta_mgr_sta_is_unassoc (ctx, net, mac_address))))
+ cp_eoc_sta_mgr_sta_add_to_assoc_or_unassoc (
+ ctx, net, tei, mac_address, sta);
}
/* Fifth case, Same TEI only the mac address change from A to B
* without being null or broadcast. */
@@ -755,9 +288,8 @@ cp_sta_mgr_sta_add (cp_t *ctx, cp_net_t *net, cp_tei_t tei, mac_t mac_address)
cp_sta_mgr_sta_remove (ctx, (cp_sta_t *) sta);
slab_release (sta);
- sta = (cp_sta_private_t *) cp_sta_mgr_sta_add_realy (ctx, net,
- tei,
- mac_address);
+ sta = (cp_sta_private_t *) cp_sta_mgr_sta_add_realy (
+ ctx, net, tei, mac_address);
}
/* Sixth case, Same TEI, same mac address,
* but the sta is not in the associated list. First ASSOC_REQ. */
@@ -765,9 +297,9 @@ cp_sta_mgr_sta_add (cp_t *ctx, cp_net_t *net, cp_tei_t tei, mac_t mac_address)
&& (sta->tei == tei)
&& (tei != MAC_TEI_UNASSOCIATED))
{
- if(!(cp_sta_mgr_sta_is_assoc (ctx, net, tei)))
- cp_sta_mgr_sta_add_to_assoc_or_unassoc (ctx, net, tei,
- mac_address, sta);
+ if (!(cp_eoc_sta_mgr_sta_is_assoc (ctx, net, tei)))
+ cp_eoc_sta_mgr_sta_add_to_assoc_or_unassoc (
+ ctx, net, tei, mac_address, sta);
}
}
@@ -777,7 +309,7 @@ cp_sta_mgr_sta_add (cp_t *ctx, cp_net_t *net, cp_tei_t tei, mac_t mac_address)
}
void
-cp_sta_mgr_sta_remove (cp_t *ctx, cp_sta_t * station)
+cp_eoc_sta_mgr_sta_remove (cp_t *ctx, cp_sta_t * station)
{
set_t *set;
cp_sta_private_t *sta = (cp_sta_private_t *) station;
@@ -789,12 +321,12 @@ cp_sta_mgr_sta_remove (cp_t *ctx, cp_sta_t * station)
net = sta->net;
- // If the station is CCo, modify the net CCo pointer to NULL.
+ /* If the station is CCo, modify the net CCo pointer to NULL. */
if (cp_sta_get_cco_status(station))
net->cco = NULL;
- // If the station is PCo to communicate with the CCo, modify the
- // pointer in the net.
+ /* If the station is PCo to communicate with the CCo, modify the
+ * pointer in the net. */
if (net->pco == station)
net->pco = NULL;
@@ -805,14 +337,14 @@ cp_sta_mgr_sta_remove (cp_t *ctx, cp_sta_t * station)
/* Remove the station from its net. */
if (cp_sta_get_tei (&sta->public_data))
{
- if (cp_sta_mgr_sta_is_assoc (ctx, net, sta->tei))
+ if (cp_eoc_sta_mgr_sta_is_assoc (ctx, net, sta->tei))
{
set = &sta->net->associated_stas;
set_remove (set, &sta->public_data.node_net);
- sta->net->num_associated_stas--;
+ sta->net->num_associated_stas --;
sta->net->num_stas --;
}
- else if (cp_sta_mgr_sta_is_unassoc(ctx, net, sta->mac_address))
+ else if (cp_eoc_sta_mgr_sta_is_unassoc(ctx, net, sta->mac_address))
{
set = &sta->net->unassociated_stas;
set_remove (set, &sta->public_data.node_net);
@@ -822,7 +354,7 @@ cp_sta_mgr_sta_remove (cp_t *ctx, cp_sta_t * station)
else
{
set = &sta->net->unassociated_stas;
- if (cp_sta_mgr_sta_is_unassoc (ctx, net, sta->mac_address))
+ if (cp_eoc_sta_mgr_sta_is_unassoc (ctx, net, sta->mac_address))
{
set_remove (set, &sta->public_data.node_net);
sta->net->num_stas --;
@@ -842,79 +374,10 @@ cp_sta_mgr_sta_remove (cp_t *ctx, cp_sta_t * station)
/* Release the station. */
slab_release (sta);
-
-/* if (cp_sta_mgr_net_list_is_empty (ctx))
- cp_fsm_trigger_new_event (ctx, bare, net_list_empty);*/
-}
-
-void
-cp_sta_mgr_sta_remove_from_mac (cp_t *ctx, mac_t mac_addr)
-{
- cp_sta_t *sta;
- dbg_assert (ctx);
- dbg_assert (mac_addr && (mac_addr < MAC_BROADCAST));
-
- sta = cp_sta_mgr_sta_get_from_mac (ctx, mac_addr);
- /* Remove the reference provided by the station manager. */
- slab_release (sta);
-
- cp_sta_mgr_sta_remove (ctx, sta);
-}
-
-void
-cp_sta_mgr_sta_remove_assoc (cp_t *ctx, cp_net_t *net, cp_tei_t tei)
-{
- cp_sta_t *sta;
-
- dbg_assert (ctx);
- dbg_assert (net);
- dbg_assert (MAC_TEI_IS_STA(tei));
-
- sta = cp_sta_mgr_sta_get_assoc (ctx, net, tei);
-
- if (sta)
- {
- // The get STA returns another reference on the station which we
- // want to release this reference is not useful, this release
- // allows to remove the reference just added by the get STA.
- slab_release (sta);
-
- /* Release the station. */
- cp_sta_mgr_sta_remove (ctx, sta);
- }
-}
-
-
-cp_sta_t *
-cp_sta_mgr_sta_get_assoc (cp_t *ctx, cp_net_t *net, cp_tei_t tei)
-{
- cp_sta_t *sta = NULL;
- cp_sta_private_t sta_cmp;
- set_node_t *node;
-
- dbg_assert (ctx);
- dbg_assert (net);
- dbg_assert (tei);
-
- if (! set_empty (&net->associated_stas))
- {
- memset (&sta_cmp, 0, sizeof (cp_sta_private_t));
- sta_cmp.tei = tei;
-
- node = set_find (&net->associated_stas,
- &sta_cmp.public_data.node_net);
-
- if (node)
- {
- sta = PARENT_OF (cp_sta_t, node_net, node);
- slab_addref (sta);
- }
- }
- return sta;
}
bool
-cp_sta_mgr_sta_is_assoc (cp_t *ctx, cp_net_t *net, cp_tei_t tei)
+cp_eoc_sta_mgr_sta_is_assoc (cp_t *ctx, cp_net_t *net, cp_tei_t tei)
{
set_node_t *node = NULL;
@@ -922,7 +385,7 @@ cp_sta_mgr_sta_is_assoc (cp_t *ctx, cp_net_t *net, cp_tei_t tei)
dbg_assert (net);
dbg_assert (tei);
- if (! set_empty (&net->associated_stas))
+ if (!set_empty (&net->associated_stas))
{
cp_sta_private_t sta_cmp;
memset (&sta_cmp, 0, sizeof (cp_sta_private_t));
@@ -936,7 +399,7 @@ cp_sta_mgr_sta_is_assoc (cp_t *ctx, cp_net_t *net, cp_tei_t tei)
}
bool
-cp_sta_mgr_sta_is_unassoc (cp_t *ctx, cp_net_t *net, mac_t mac)
+cp_eoc_sta_mgr_sta_is_unassoc (cp_t *ctx, cp_net_t *net, mac_t mac)
{
set_node_t *node = NULL;
@@ -944,7 +407,7 @@ cp_sta_mgr_sta_is_unassoc (cp_t *ctx, cp_net_t *net, mac_t mac)
dbg_assert (net);
dbg_assert (mac);
- if (! set_empty (&net->unassociated_stas))
+ if (!set_empty (&net->unassociated_stas))
{
cp_sta_private_t sta_cmp;
memset (&sta_cmp, 0, sizeof (cp_sta_private_t));
@@ -957,39 +420,8 @@ cp_sta_mgr_sta_is_unassoc (cp_t *ctx, cp_net_t *net, mac_t mac)
return (node);
}
-
-
-
-cp_sta_t *
-cp_sta_mgr_sta_get_from_mac (cp_t *ctx, mac_t mac_addr)
-{
- cp_sta_private_t sta;
- set_node_t *node;
- cp_sta_t *sta_found = NULL;
-
- dbg_assert (ctx);
- dbg_assert (mac_addr);
- dbg_assert (mac_addr < MAC_BROADCAST);
-
-
- if (!set_empty (&ctx->sta_mgr.stas))
- {
- sta.mac_address = mac_addr;
- set_node_init (&sta.public_data.node_sta_mgr);
- node = set_find (&ctx->sta_mgr.stas, &sta.public_data.node_sta_mgr);
-
- if (node)
- {
- sta_found = PARENT_OF (cp_sta_t, node_sta_mgr, node);
- slab_addref (sta_found);
- }
- }
-
- return sta_found;
-}
-
void
-cp_sta_mgr_commit_to_dataplane (cp_t *ctx)
+cp_eoc_sta_mgr_commit_to_dataplane (cp_t *ctx)
{
cp_sta_t *sta;
cl_mactotei_blk_t *mactotei;
@@ -997,71 +429,47 @@ cp_sta_mgr_commit_to_dataplane (cp_t *ctx)
dbg_assert (ctx);
dbg_assert (ctx->cl);
- // If the net does not correspond to the AVLN, do not commit.
+ /* If the net does not correspond to the AVLN, do not commit. */
if (!ctx->sta_mgr.our_avln)
return;
- // Get the first station from the set.
+ /* Get the first station from the set. */
if (set_empty (&ctx->sta_mgr.our_avln->associated_stas))
{
cl_mactotei_release_table (ctx->cl);
}
else
{
- // There is at least a station in the network list.
+ /* There is at least a station in the network list. */
mactotei = cl_mactotei_new ();
for (sta = cp_net_sta_get_first (ctx, ctx->sta_mgr.our_avln,
- CP_NET_STA_ASSOC);
- sta; sta = cp_net_sta_get_next (ctx, ctx->sta_mgr.our_avln, sta))
+ CP_NET_STA_ASSOC);
+ sta;
+ sta = cp_net_sta_get_next (ctx, ctx->sta_mgr.our_avln, sta))
{
cp_sta_private_t *sta_private = (cp_sta_private_t *) sta;
- // Copy all the bridge table from the previous list.
+ /* Copy all the bridge table from the previous list. */
cl_mactotei_copy_tei_and_tag (ctx->cl, mactotei, sta_private->tei,
sta_private->tei);
- // Add the current station.
+ /* Add the current station. */
cl_mactotei_addr_add (mactotei, sta_private->mac_address,
sta_private->tei, MAC_TEI_UNASSOCIATED);
}
- // Request the CL to use the table.
+ /* Request the CL to use the table. */
cl_mactotei_use_table (ctx->cl, mactotei);
}
}
-void
-cp_sta_mgr__assoc__timeout (cp_t *ctx, uint time_ms)
-{
- cp_sta_t *sta;
- cp_net_t *net;
- dbg_assert (ctx);
- dbg_assert (cp_sta_own_data_get_cco_status (ctx));
-
- net = ctx->sta_mgr.our_avln;
-
- if (net)
- {
- /* Parse only the associated stations. */
- for (sta = cp_net_sta_get_first (ctx, net, CP_NET_STA_ASSOC);
- sta;
- sta = cp_net_sta_get_next (ctx, net, sta))
- {
- if (!cp_sta_get_assoc_confirmed (ctx, sta)
- && lesseq_mod2p32 (sta->assoc_req_last_ms
- + CP_ASSOC_FULL_TIMEOUT_MS, time_ms))
- cp_sta_set_assoc_confirmed (ctx, sta, true);
- }
- }
-}
-
-
#if CONFIG_CP_STA_MGR_CCO_EOC
void
-cp_eoc_sta_mgr_get_wl (cp_t *ctx, uint *numStas,
- cp_tei_t *stas_teis, mac_t *stas_macs, u8 *stas_authorizations,
- u8 *stas_output_levels, u32 *stas_start_times, u32 *stas_end_times,
- cp_key_t *stas_daks, cp_dpw_t *stas_dpws, u8 *stas_actions)
+cp_eoc_sta_mgr_get_wl (
+ cp_t *ctx, uint *numStas, cp_tei_t *stas_teis, mac_t *stas_macs,
+ u8 *stas_authorizations, u8 *stas_output_levels, u32 *stas_start_times,
+ u32 *stas_end_times, cp_key_t *stas_daks, cp_dpw_t *stas_dpws,
+ u8 *stas_actions)
{
dbg_assert (ctx);
dbg_assert (numStas);
@@ -1104,10 +512,10 @@ cp_eoc_sta_mgr_get_wl (cp_t *ctx, uint *numStas,
}
}
-
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])
+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])
{
dbg_assert (ctx);
dbg_assert (numStas);
@@ -1130,13 +538,13 @@ cp_eoc_sta_mgr_get_ports (cp_t *ctx, uint *numStas, mac_t *stas_macs,
if (((cp_sta_private_t *)sta)->tei != 0)
{
stas_macs[i] = ((cp_sta_private_t *)sta)->mac_address;
- for(j = 0; j < PORT_NB; j++)
+ for (j = 0; j < PORT_NB; j++)
{
stas_port_ed[i][j] = sta->multi_sta.ports.port[j].enabled;
stas_port_service[i][j] =
sta->multi_sta.ports.port[j].index_of_service;
}
- i++;
+ i ++;
}
node = set_next(&ctx->sta_mgr.stas, node);
}
diff --git a/cesar/cp/eoc/sta/mgr/src/sta_own_data.c b/cesar/cp/eoc/sta/mgr/src/sta_own_data.c
index 87027b0b8c..622dc44fc2 100644
--- a/cesar/cp/eoc/sta/mgr/src/sta_own_data.c
+++ b/cesar/cp/eoc/sta/mgr/src/sta_own_data.c
@@ -6,37 +6,28 @@
*
* }}} */
/**
- * \file cp/eoc/sta/data/src/sta_own_data.c
+ * \file cp/eoc/sta/mgr/src/sta_own_data.c
* \brief Station data source.
- * \ingroup cp_eoc_sta_data
+ * \ingroup cp_eoc_sta_mgr
*
*/
#include "common/std.h"
-#include "lib/rnd.h"
-#include "string.h"
-#include "lib/dbg.h"
-#include "lib/bitstream.h"
-#include "cp/fsm/fsm.h"
-
-#include "hal/gpio/gpio.h"
-
-/* Public interfaces. */
-#include "cp/sta/mgr/sta_own_data.h"
-#include "cp/msg/msg.h"
-
-/* Private interfaces. */
+/* Private headers. */
#include "cp/inc/context.h"
#include "cp/sta/mgr/inc/sta_own_data.h"
-#include "config/av/only/mode.h"
+/* Public headers. */
+#include "hal/gpio/gpio.h"
+#include "cp/eoc/sta/mgr/sta_own_data.h"
+#include "cp/msg/msg.h"
/**
* Initialise the station own data to default values.
* \param ctx the module context.
*/
void
-cp_sta_own_data_init (cp_t *ctx)
+cp_eoc_sta_own_data_init (cp_t *ctx)
{
dbg_assert (ctx);
@@ -44,139 +35,16 @@ cp_sta_own_data_init (cp_t *ctx)
0, sizeof (cp_sta_own_data_private_t));
/* Store the hybrid mode. */
- if (CONFIG_AV_ONLY_MODE)
- {
- ctx->sta_mgr.sta_own_data.public.hybrid_mode = MAC_COEXISTENCE_AV_ONLY_MODE;
- }
- else
- {
- ctx->sta_mgr.sta_own_data.public.hybrid_mode = MAC_COEXISTENCE_FULL_HYBRID_MODE;
- }
+ ctx->sta_mgr.sta_own_data.public.hybrid_mode =
+ MAC_COEXISTENCE_AV_ONLY_MODE;
/* Debug only. */
GPIO_SETUP (LED_IS_CCO_GPIO, GPIO_DIRECTION_OUT);
GPIO_SET (LED_IS_CCO_GPIO, 0);
}
-/**
- * Uninitialise the station own data to default values.
- * \param ctx the module context.
- */
-void
-cp_sta_own_data_uninit (cp_t *ctx)
-{
- dbg_assert (ctx);
- memset ((u8*) &ctx->sta_mgr.sta_own_data,
- 0, sizeof (cp_sta_own_data_private_t));
-}
-
-/**
- * Set the TEI of the station.
- * \param ctx the module context.
- * \param tei The TEI station.
- */
-void
-cp_sta_own_data_set_tei (cp_t * ctx, u8 tei)
-{
- dbg_assert (ctx);
-// dbg_assert (ctx->mac_config);
-
- if (tei != ctx->sta_mgr.sta_own_data.tei)
- {
- ctx->sta_mgr.sta_own_data.tei = tei;
- ctx->mac_config->tei = tei;
-
-// cp_fsm_post_new_event (ctx, bare, sta_status_changed);
- }
-}
-
-/**
- * Get the value of the constant TEI.
- * \param ctx the module context.
- * \return Get the station TEI.
- */
-cp_tei_t
-cp_sta_own_data_get_tei (cp_t *ctx)
-{
- dbg_assert (ctx);
-
- return ctx->sta_mgr.sta_own_data.tei;
-}
-
-/**
- * Set the station Mac address.
- * \param ctx the module context.
- * \param mac_addr The Mac address of the station.
- */
-void
-cp_sta_own_data_set_mac_address (cp_t *ctx, mac_t mac_addr)
-{
- dbg_assert (ctx);
- dbg_assert (mac_addr);
- dbg_assert (ctx->mac_config);
-
- // Add the mac address to the sta own data.
- ctx->sta_mgr.sta_own_data.mac_addr = mac_addr;
-
- // Add the mac address to the mac config referred in the CP.
- ctx->mac_config->sta_mac_address = mac_addr;
-}
-
-/**
- * Get the station mac address.
- * \param ctx the module context.
- * \return Get the station Mac address.
- *
- */
-mac_t
-cp_sta_own_data_get_mac_address (cp_t *ctx)
-{
- return ctx->sta_mgr.sta_own_data.mac_addr;
-}
-
-/**
- * Set the Station NPW.
- * \param ctx the module context.
- * \param npw The new NPW.
- *
- * TODO : inform the driver ?
- */
-void
-cp_sta_own_data_set_npw (cp_t *ctx, const char * npw)
-{
- dbg_assert (ctx);
- dbg_assert (npw);
-
- // Store the NPW.
- strcpy(ctx->sta_mgr.sta_own_data.npw, npw);
-
- // TODO : inform the driver ?
-}
-
-/**
- * Return the pointer to the NPW as a constant data.
- * \param ctx the module context.
- * \return Get the station NPW.
- *
- * The user shall call the set_npw function to modify the NPW
- */
-const char *
-cp_sta_own_data_get_npw (cp_t *ctx)
-{
- dbg_assert (ctx);
- return ctx->sta_mgr.sta_own_data.npw;
-}
-
-/**
- * Set the station NMK.
- * \param ctx the module context.
- * \param nmk The NMK to set.
- * \param length The NMK length.
- *
- * \todo Call the MSG to send a MME to the linux Driver.
- */
bool
-cp_sta_own_data_set_nmk (cp_t *ctx, const cp_key_t nmk,
+cp_eoc_sta_own_data_set_nmk (cp_t *ctx, const cp_key_t nmk,
cp_msg_drv_sta_set_key_type_t type)
{
dbg_assert (ctx);
@@ -192,451 +60,14 @@ cp_sta_own_data_set_nmk (cp_t *ctx, const cp_key_t nmk,
if (i < COUNT(nmk.key))
{
ctx->sta_mgr.sta_own_data.nmk = nmk;
- /* Not implemented for now */
-#if 0
- /* Report new computed values to HLE. */
- cp_mme_peer_t peer = CP_MME_PEER (cp_sta_own_data_get_mac_address (ctx),
- MAC_TEI_FOREIGN);
- cp_nid_t nid = 0;
- cp_security_level_t sl = 0;
-
- if (type == CP_MSG_DRV_STA_SET_KEY_TYPE_CHANGE_NID)
- nid = cp_sta_own_data_get_nid (ctx);
- else
- sl = cp_sta_own_data_get_security_level (ctx);
-
- cp_msg_drv_sta_set_key_ind_send (ctx, &peer,
- nmk,
- type,
- nid,
- sl);
-#endif
return true;
}
return false;
}
-/**
- * Get the NMK of the AVLN.
- * \param ctx the module context.
- * \return Get the station NMK
- */
-cp_key_t
-cp_sta_own_data_get_nmk (cp_t *ctx)
-{
- dbg_assert (ctx);
- return ctx->sta_mgr.sta_own_data.nmk;
-}
-
-/**
- * Set the device password.
- * \param ctx the module context.
- * \param dpw The new device password.
- * \param length The length in bytes of the DPW provided.
- *
- * // TODO : inform the driver ?
- */
void
-cp_sta_own_data_set_dpw (cp_t *ctx, const char *dpw)
-{
- dbg_assert (ctx);
- dbg_assert (dpw);
-
- strcpy (ctx->sta_mgr.sta_own_data.dpw, dpw);
-
- // TODO : inform the driver ?
-}
-
-/**
- * Return the Device password.
- * \param ctx the module context.
- * \return Get the station DPW.
- */
-const char*
-cp_sta_own_data_get_dpw (cp_t *ctx)
-{
- dbg_assert (ctx);
-
- return ctx->sta_mgr.sta_own_data.dpw;
-}
-
-/**
- * Set the security level.
- * \param ctx the module context.
- * \param sl The security level.
- *
- * // TODO : inform the driver ?
- */
-void
-cp_sta_own_data_set_security_level (cp_t *ctx,
- cp_security_level_t sl)
-{
- dbg_assert (ctx);
-
- ctx->sta_mgr.sta_own_data.security_level = sl;
-
- // TODO : inform the driver ?
-}
-
-/**
- * Return the security level.
- * \param ctx the module context.
- * \return Get the security level.
- *
- */
-cp_security_level_t
-cp_sta_own_data_get_security_level (cp_t *ctx)
-{
- dbg_assert (ctx);
- return ctx->sta_mgr.sta_own_data.security_level;
-}
-
-/**
- * Set the CCo status of the station.
- * \param ctx the module context.
- * \param status The current CCo status of the station.
- *
- * It shall send a message to the Linux Driver
- */
-void
-cp_sta_own_data_set_was_cco (cp_t *ctx, bool status)
-{
- dbg_assert (ctx);
- ctx->sta_mgr.sta_own_data.was_cco = status;
-
- // inform the driver
- // TODO.
-}
-
-/**
- * Get the CCo status of the station after a reboot.
- * \param ctx the module context.
- * \return \todo fill this
- *
- */
-bool
-cp_sta_own_data_get_was_cco (cp_t *ctx)
-{
- dbg_assert (ctx);
- return ctx->sta_mgr.sta_own_data.was_cco;
-}
-
-/**
- * Set the HFID.
- *
- * \param hfid the HFID to set.
- * \param data the human identifier.
- */
-static void
-cp_sta_own_data_set_hfid (const char *hfid, const char *data)
-{
- dbg_assert (data);
- dbg_assert (hfid);
-
- strcpy ((char *) hfid, (char *) data);
-}
-
-/**
- * Set the AVLN HFID.
- *
- * \param ctx the module context.
- * \param data the human identifier.
- */
-void
-cp_sta_own_data_set_hfid_avln (cp_t *ctx, const char* data)
-{
- cp_sta_own_data_t *sta;
-
- dbg_assert (ctx);
- sta = cp_sta_mgr_get_sta_own_data (ctx);
- cp_sta_own_data_set_hfid (sta->hfid_avln, data);
-}
-
-/**
- * Set the User HFID.
- *
- * \param ctx the module context.
- * \param data the human identifier.
- */
-void
-cp_sta_own_data_set_hfid_user (cp_t *ctx, const char* data)
-{
- cp_sta_own_data_t *sta;
-
- dbg_assert (ctx);
- sta = cp_sta_mgr_get_sta_own_data (ctx);
- cp_sta_own_data_set_hfid (sta->hfid_user, data);
-}
-
-/**
- * Set the Manufacturer HFID.
- *
- * \param ctx the module context.
- * \param data the human identifier.
- */
-void
-cp_sta_own_data_set_hfid_manufacturer (cp_t *ctx, const char* data)
-{
- cp_sta_own_data_t *sta;
-
- dbg_assert (ctx);
- sta = cp_sta_mgr_get_sta_own_data (ctx);
- cp_sta_own_data_set_hfid (sta->hfid_manufacturer, data);
-}
-
-/**
- * Set the GLID to send proxy data.
- * \param ctx the module context.
- * \param glid The GLID to use when a proxy beacon shall be sent.
- */
-void
-cp_sta_own_data_set_pco_glid (cp_t *ctx, u8 glid)
-{
- dbg_assert (ctx);
- dbg_assert ((glid >= MAC_GLID_MIN) || (glid == 0));
-
- ctx->sta_mgr.sta_own_data.pco_glid = glid;
-}
-
-/**
- * Get the PCO GLID.
- * \param ctx the module context.
- * \return The GLID to send proxy data.
- */
-u8
-cp_sta_own_data_get_pco_glid (cp_t *ctx)
-{
- dbg_assert (ctx);
-
- return (ctx->sta_mgr.sta_own_data.pco_glid);
-}
-
-/**
- * Get the PCO status.
- * \param ctx the module context.
- * \return The PCO status.
- *
- */
-bool
-cp_sta_own_data_get_pco_status (cp_t *ctx)
-{
- dbg_assert (ctx);
-
- return (ctx->sta_mgr.sta_own_data.pco_glid);
-}
-
-/**
- * Set the PCO status.
- * \param ctx the module context.
- * \param pco The PCO status.
- *
- */
-void
-cp_sta_own_data_set_pco_status (cp_t *ctx, bool pco)
-{
- dbg_assert (ctx);
-
- if (cp_sta_own_data_get_pco_status (ctx) != pco)
- {
- if (pco == false)
- ctx->sta_mgr.sta_own_data.pco_glid = 0;
- else
- ctx->sta_mgr.sta_own_data.pco_glid |= (pco << 7);
-// cp_fsm_post_new_event (ctx, bare, sta_status_changed);
- }
-}
-
-/**
- * Set the CCo status of the station.
- * \param ctx the CP context.
- */
-void
-cp_sta_own_data_set_cco_status (cp_t *ctx, bool cco)
-{
- cp_sta_t *sta;
- cp_net_t *net;
- dbg_assert (ctx);
-
- if (ctx->sta_mgr.sta_own_data.is_cco != cco)
- {
- dbg_assert (ctx->sta_mgr.sta_own_data.tei != MAC_TEI_UNASSOCIATED);
- ctx->sta_mgr.sta_own_data.is_cco = cco;
-
- // If the net has already a CCo.
- if (cco)
- {
- net = cp_sta_mgr_get_our_avln (ctx);
- sta = cp_net_get_cco (ctx, net);
- if (sta)
- {
- cp_net_set_cco (ctx, net, MAC_TEI_UNASSOCIATED);
- slab_release (sta);
- }
- }
-
-// cp_fsm_post_new_event (ctx, bare, sta_status_changed);
- }
-
-}
-
-
-/**
- * Get the CCo status of the station.
- * \param ctx the CP context.
- * \return the boolean indicating the state.
- */
-bool
-cp_sta_own_data_get_cco_status (cp_t *ctx)
-{
- dbg_assert (ctx);
-
- return ctx->sta_mgr.sta_own_data.is_cco;
-
-}
-
-/**
- * Set the authentication status.
- * \param ctx the CP context.
- * \param authenticated the station status.
- */
-void
-cp_sta_own_data_set_authenticated_status (cp_t *ctx, bool authenticated)
-{
- dbg_assert (ctx);
- dbg_assert (ctx->mac_config);
-
- if (ctx->sta_mgr.sta_own_data.authenticated != authenticated)
- {
- ctx->sta_mgr.sta_own_data.authenticated = authenticated;
- ctx->mac_config->authenticated = authenticated;
-// cp_fsm_post_new_event (ctx, bare, sta_status_changed);
- }
-}
-
-/**
- * Get the authentication status.
- * \param ctx the CP context.
- * \return the station authentication status.
- */
-bool
-cp_sta_own_data_get_authenticated_status (cp_t *ctx)
-{
- dbg_assert (ctx);
-
- return ctx->sta_mgr.sta_own_data.authenticated;
-}
-
-/**
- * Set the Station NID.
- * \param ctx the Control plane context.
- * \param nid the station NID.
- */
-void
-cp_sta_own_data_set_nid (cp_t *ctx, cp_nid_t nid)
-{
- dbg_assert (ctx);
- dbg_assert (HPAV_NID_IS_VALID (nid));
- ctx->sta_mgr.sta_own_data.nid = nid;
- /* If the station AVLN is setted, modified the network. */
- if (ctx->sta_mgr.our_avln)
- {
- ctx->sta_mgr.our_avln->nid = nid;
- bsu_update_nid_snid (ctx->bsu, nid, ctx->sta_mgr.our_avln->snid);
- }
- /* Change the Security Level. */
- cp_sta_own_data_set_security_level (ctx, nid >> (HPAV_NID_SIZE_BITS - 2));
-}
-
-/**
- * Get the Station NID.
- * \param ctx the Control plane context.
- * \param nid the station NID.
- */
-cp_nid_t
-cp_sta_own_data_get_nid (cp_t *ctx)
-{
- dbg_assert (ctx);
-
- return ctx->sta_mgr.sta_own_data.nid;
-}
-
-/**
- * Set the Station SNID.
- * \param ctx the Control plane context.
- * \param snid the station SNID.
- */
-void
-cp_sta_own_data_set_snid (cp_t *ctx, cp_snid_t snid)
-{
- dbg_assert (ctx);
-
- ctx->sta_mgr.sta_own_data.snid = snid;
-
- if (ctx->sta_mgr.our_avln)
- {
- ctx->sta_mgr.our_avln->snid = snid;
- bsu_update_nid_snid (ctx->bsu, ctx->sta_mgr.our_avln->nid, snid);
- }
-}
-
-/**
- * Get the Station SNID.
- * \param ctx the Control plane context.
- * \return the station SNID.
- */
-cp_snid_t
-cp_sta_own_data_get_snid (cp_t *ctx)
-{
- dbg_assert (ctx);
-
- return ctx->sta_mgr.sta_own_data.snid;
-}
-
-void
-cp_sta_own_data_set_tek (cp_t *ctx, const cp_key_t key)
-{
- dbg_assert (ctx);
-
- memcpy (&ctx->sta_mgr.sta_own_data.tek, &key, sizeof (cp_key_t));
-}
-
-cp_key_t
-cp_sta_own_data_get_tek (cp_t *ctx)
-{
- dbg_assert (ctx);
-
- return ctx->sta_mgr.sta_own_data.tek;
-}
-
-bool
-cp_sta_own_data_get_backup_cco_status (cp_t *ctx)
-{
- /* FIXME: this is a temporary fix. As soon we have implement CCo backup
- * functionality, we should return it. */
- return CP_BACKUP_CCO_CAP;
-}
-
-void
-cp_sta_own_data_set_dak (cp_t *ctx, cp_key_t dak)
-{
- uint i;
- dbg_assert (ctx);
-
- for (i = 0; i < COUNT (dak.key); i++)
- ctx->sta_mgr.sta_own_data.dak.key[i] = dak.key[i];
-}
-
-cp_key_t
-cp_sta_own_data_get_dak (cp_t *ctx)
-{
- dbg_assert (ctx);
-
- return ctx->sta_mgr.sta_own_data.dak;
-}
-
-void
-cp_sta_own_data_set_original_dak (cp_t *ctx, cp_key_t dak)
+cp_eoc_sta_own_data_set_original_dak (cp_t *ctx, cp_key_t dak)
{
uint i;
dbg_assert (ctx);
@@ -646,29 +77,9 @@ cp_sta_own_data_set_original_dak (cp_t *ctx, cp_key_t dak)
}
cp_key_t
-cp_sta_own_data_get_original_dak (cp_t *ctx)
+cp_eoc_sta_own_data_get_original_dak (cp_t *ctx)
{
dbg_assert (ctx);
return ctx->sta_mgr.sta_own_data.original_dak;
}
-
-void
-cp_sta_own_data_set_sc (cp_t *ctx, bool status)
-{
- dbg_assert (ctx);
-
- if (ctx->sta_mgr.sta_own_data.sc != status)
- {
- ctx->sta_mgr.sta_own_data.sc = status;
-// cp_fsm_post_new_event (ctx, bare, sta_status_changed);
- }
-}
-
-bool
-cp_sta_own_data_get_sc (cp_t *ctx)
-{
- dbg_assert (ctx);
-
- return ctx->sta_mgr.sta_own_data.sc;
-}
diff --git a/cesar/cp/eoc/sta/mgr/sta_mgr.h b/cesar/cp/eoc/sta/mgr/sta_mgr.h
index b28511dffe..574f8e1ebd 100644
--- a/cesar/cp/eoc/sta/mgr/sta_mgr.h
+++ b/cesar/cp/eoc/sta/mgr/sta_mgr.h
@@ -10,57 +10,66 @@
/**
* \file cp/eoc/sta/mgr/sta_mgr.h
* \brief Station Manager.
- * \ingroup cp_sta_mgr
+ * \ingroup cp_eoc_sta_mgr
*
* Station and AVLN manager.
*/
-#include "cp/sta/mgr/net.h"
-#include "cp/sta/mgr/sta_mgr.h"
-#include "cp/sta/mgr/inc/sta.h"
-
+#include "cp/cp.h"
+#include "config/cp/sta/mgr/cco/eoc.h"
BEGIN_DECLS
+/* Declared in VARIANT :
+ * - cp_sta_mgr_init
+ * - cp_sta_mgr_garbage
+ * - cp_sta_mgr_release_station
+ * - cp_sta_mgr_sta_add
+ * - cp_sta_mgr_sta_remove
+ * - cp_sta_mgr_commit_to_dataplane
+ */
+/**
+ * Add a station to the stas list.
+ * \param ctx the CP context.
+ * \param station the station.
+ */
void
-cp_sta_mgr_sta_add_to_assoc_or_unassoc (cp_t *ctx, cp_net_t *net, cp_tei_t tei,
- mac_t mac_address, cp_sta_private_t *sta);
-
-void
-cp_eoc_sta_mgr_sta_insert_into_stas_list(cp_t *ctx, cp_sta_private_t *station);
-
-bool
-cp_sta_mgr_sta_is_assoc (cp_t *ctx, cp_net_t *net, cp_tei_t tei);
+cp_eoc_sta_mgr_sta_insert_into_stas_list (
+ cp_t *ctx, cp_sta_private_t *station);
+/**
+ * TODO
+ */
bool
-cp_sta_mgr_sta_is_unassoc (cp_t *ctx, cp_net_t *net, mac_t mac);
-
-void
-cp_sta_mgr_elects_sta_partial_ack (cp_t *ctx);
+cp_eoc_sta_mgr_sta_is_assoc (cp_t *ctx, cp_net_t *net, cp_tei_t tei);
/**
- * Verify the net list status.
- * \param ctx the module context.
- * \return true if empty, false otherwise.
+ * TODO
*/
bool
-cp_sta_mgr_net_list_is_empty (cp_t *ctx);
+cp_eoc_sta_mgr_sta_is_unassoc (cp_t *ctx, cp_net_t *net, mac_t mac);
+
+#if CONFIG_CP_STA_MGR_CCO_EOC
/**
- * Get first AVLN from the net_list.
- * \param ctx the module context.
- * \return Get a reference on the AVLN.
+ * TODO
*/
-cp_net_t *
-cp_sta_mgr_get_first_avln (cp_t *ctx);
+void
+cp_eoc_sta_mgr_get_wl (
+ cp_t *ctx, uint *numStas, cp_tei_t *stas_teis, mac_t *stas_macs,
+ u8 *stas_authorizations, u8 *stas_output_levels, u32 *stas_start_times,
+ u32 *stas_end_times, cp_key_t *stas_daks, cp_dpw_t *stas_dpws,
+ u8 *stas_actions);
/**
- * Get next AVLN from the net_list.
- * \param ctx the module context.
- * \param prev previous one.
- * \return Get a reference on the AVLN.
+ * TODO
*/
-cp_net_t *
-cp_sta_mgr_get_next_avln (cp_t *ctx, cp_net_t *prev);
+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]);
+#endif /* CONFIG_CP_STA_MGR_CCO_EOC */
+
+END_DECLS
#endif /* cp_sta_eoc_mgr_h */
diff --git a/cesar/cp/eoc/sta/mgr/sta_own_data.h b/cesar/cp/eoc/sta/mgr/sta_own_data.h
new file mode 100644
index 0000000000..62c03a32f1
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/sta_own_data.h
@@ -0,0 +1,46 @@
+#ifndef cp_eoc_sta_mgr_sta_own_data_h
+#define cp_eoc_sta_mgr_sta_own_data_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2012 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eoc/sta/mgr/sta_own_data.h
+ * \brief « brief description »
+ * \ingroup cp_eoc_sta_mgr
+ *
+ * « long description »
+ */
+#include "cp/cp.h"
+
+BEGIN_DECLS
+
+/* Declared in VARIANT :
+ * - cp_sta_own_data_init
+ * - cp_sta_own_data_set_nmk
+ */
+
+/**
+ * Set the original DAK in the station.
+ * \param ctx the control plane context.
+ * \param dak the DAK of the station.
+ *
+ * TODO : this function is not called, could we erase it ?
+ */
+void
+cp_eoc_sta_own_data_set_original_dak (cp_t *ctx, cp_key_t dak);
+
+/**
+ * Get the original DAK of the station.
+ * \param ctx the control plane context.
+ * \return the DAK of the station.
+ */
+cp_key_t
+cp_eoc_sta_own_data_get_original_dak (cp_t *ctx);
+
+END_DECLS
+
+#endif /* cp_eoc_sta_mgr_sta_own_data_h */
diff --git a/cesar/cp/eoc/sta/mgr/stub/Module b/cesar/cp/eoc/sta/mgr/stub/Module
new file mode 100644
index 0000000000..ebb6bc655e
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/stub/Module
@@ -0,0 +1,3 @@
+SOURCES := sta_mgr.c sta_own_data.c
+
+MODULES := cp/sta/mgr/stub
diff --git a/cesar/cp/eoc/sta/mgr/stub/src/sta_mgr.c b/cesar/cp/eoc/sta/mgr/stub/src/sta_mgr.c
new file mode 100644
index 0000000000..f8eced0191
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/stub/src/sta_mgr.c
@@ -0,0 +1,101 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2012 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eoc/sta/mgr/stub/src/sta_mgr.h
+ * \brief « brief description »
+ * \ingroup cp_eoc_sta_mgr_stub
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+#include "cp/sta/mgr/sta.h"
+#include "cp/sta/mgr/net.h"
+#include "cp/sta/mgr/inc/sta.h"
+#include "config/cp/sta/mgr/cco/eoc.h"
+
+void
+cp_eoc_sta_mgr_init (cp_t *ctx) __attribute__((weak));
+void
+cp_eoc_sta_mgr_init (cp_t *ctx) {}
+
+void
+cp_eoc_sta_mgr_garbage (cp_t *ctx) __attribute__((weak));
+void
+cp_eoc_sta_mgr_garbage (cp_t *ctx) {}
+
+void
+cp_eoc_sta_mgr_release_station (cp_t *ctx, cp_tei_t tei)
+ __attribute__((weak));
+void
+cp_eoc_sta_mgr_release_station (cp_t *ctx, cp_tei_t tei) {}
+
+cp_sta_t *
+cp_eoc_sta_mgr_sta_add (
+ cp_t *ctx, cp_net_t *net, cp_tei_t tei, mac_t mac_address)
+ __attribute__((weak));
+cp_sta_t *
+cp_eoc_sta_mgr_sta_add (
+ cp_t *ctx, cp_net_t *net, cp_tei_t tei, mac_t mac_address)
+{ return NULL; }
+
+void
+cp_eoc_sta_mgr_sta_remove (cp_t *ctx, cp_sta_t * sta) __attribute__((weak));
+void
+cp_eoc_sta_mgr_sta_remove (cp_t *ctx, cp_sta_t * sta) {}
+
+void
+cp_eoc_sta_mgr_commit_to_dataplane (cp_t *ctx) __attribute__((weak));
+void
+cp_eoc_sta_mgr_commit_to_dataplane (cp_t *ctx) {}
+
+void
+cp_eoc_sta_mgr_sta_insert_into_stas_list (
+ cp_t *ctx, cp_sta_private_t *station) __attribute__((weak));
+void
+cp_eoc_sta_mgr_sta_insert_into_stas_list (
+ cp_t *ctx, cp_sta_private_t *station) {}
+
+bool
+cp_eoc_sta_mgr_sta_is_assoc (cp_t *ctx, cp_net_t *net, cp_tei_t tei)
+ __attribute__((weak));
+bool
+cp_eoc_sta_mgr_sta_is_assoc (cp_t *ctx, cp_net_t *net, cp_tei_t tei)
+{ return true; }
+
+bool
+cp_eoc_sta_mgr_sta_is_unassoc (cp_t *ctx, cp_net_t *net, mac_t mac)
+ __attribute__((weak));
+bool
+cp_eoc_sta_mgr_sta_is_unassoc (cp_t *ctx, cp_net_t *net, mac_t mac)
+{ return true; }
+
+#if CONFIG_CP_STA_MGR_CCO_EOC
+void
+cp_eoc_sta_mgr_get_wl (
+ cp_t *ctx, uint *numStas, cp_tei_t *stas_teis, mac_t *stas_macs,
+ u8 *stas_authorizations, u8 *stas_output_levels, u32 *stas_start_times,
+ u32 *stas_end_times, cp_key_t *stas_daks, cp_dpw_t *stas_dpws,
+ u8 *stas_actions) __attribute__((weak));
+void
+cp_eoc_sta_mgr_get_wl (
+ cp_t *ctx, uint *numStas, cp_tei_t *stas_teis, mac_t *stas_macs,
+ u8 *stas_authorizations, u8 *stas_output_levels, u32 *stas_start_times,
+ u32 *stas_end_times, cp_key_t *stas_daks, cp_dpw_t *stas_dpws,
+ u8 *stas_actions) {}
+
+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])
+ __attribute__((weak));
+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]) {}
+#endif /* CONFIG_CP_STA_MGR_CCO_EOC */
diff --git a/cesar/cp/eoc/sta/mgr/stub/src/sta_own_data.c b/cesar/cp/eoc/sta/mgr/stub/src/sta_own_data.c
new file mode 100644
index 0000000000..9f9be6972a
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/stub/src/sta_own_data.c
@@ -0,0 +1,48 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2012 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eoc/sta/mgr/stub/src/sta_own_data.c
+ * \brief « brief description »
+ * \ingroup cp_eoc_sta_mgr_stub
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+#include "cp/msg/inc/drv_sta_set_key.h"
+#include "string.h" /* For memset */
+
+void
+cp_eoc_sta_own_data_init (cp_t *ctx) __attribute__((weak));
+void
+cp_eoc_sta_own_data_init (cp_t *ctx) {}
+
+bool
+cp_eoc_sta_own_data_set_nmk (cp_t *ctx, const cp_key_t nmk,
+ cp_msg_drv_sta_set_key_type_t type)
+ __attribute__((weak));
+bool
+cp_eoc_sta_own_data_set_nmk (cp_t *ctx, const cp_key_t nmk,
+ cp_msg_drv_sta_set_key_type_t type)
+{ return true; }
+
+void
+cp_eoc_sta_own_data_set_original_dak (cp_t *ctx, cp_key_t dak)
+ __attribute__((weak));
+void
+cp_eoc_sta_own_data_set_original_dak (cp_t *ctx, cp_key_t dak) {}
+
+static cp_key_t stub_key;
+cp_key_t
+cp_eoc_sta_own_data_get_original_dak (cp_t *ctx) __attribute__((weak));
+cp_key_t
+cp_eoc_sta_own_data_get_original_dak (cp_t *ctx)
+{
+ memset (&stub_key, 0, sizeof (cp_key_t));
+ return stub_key;
+}
diff --git a/cesar/cp/eoc/sta/mgr/test/Makefile b/cesar/cp/eoc/sta/mgr/test/Makefile
deleted file mode 100644
index 0aa8295cd2..0000000000
--- a/cesar/cp/eoc/sta/mgr/test/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-BASE = ../../../../..
-
-INCLUDES = cp/sta/mgr/test/overide
-
-HOST_PROGRAMS = test_sta_mgr
-test_sta_mgr_SOURCES = core_stub.c net_test.c sar_stub.c sta_mgr.c \
- sta-test.c station_test.c test_sta_mgr.c
-test_sta_mgr_MODULES = lib cp/sta/mgr mac/common cp/fsm/stub \
- cp/cco/action/stub cl/stub bsu/stub cp/msg/stub
-
-test_sta_mgr_CONFIG_MODULES = cp cl mac/sar
-
-include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/eoc/sta/mgr/test/Config b/cesar/cp/eoc/sta/mgr/test/utest/Config
index 6bbff0b2f2..e670790c29 100644
--- a/cesar/cp/eoc/sta/mgr/test/Config
+++ b/cesar/cp/eoc/sta/mgr/test/utest/Config
@@ -1,3 +1,4 @@
+CONFIG_CP_EOC = y
CONFIG_DEBUG_FATAL_CATCH = y
CONFIG_RESTRACK = y
-CONFIG_AV_ONLY_MODE = y \ No newline at end of file
+CONFIG_AV_ONLY_MODE = y
diff --git a/cesar/cp/eoc/sta/mgr/test/utest/Makefile b/cesar/cp/eoc/sta/mgr/test/utest/Makefile
new file mode 100644
index 0000000000..cc7a4bcdb2
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/test/utest/Makefile
@@ -0,0 +1,14 @@
+BASE = ../../../../../..
+
+INCLUDES = cp/eoc/sta/mgr/test/utest/override
+
+HOST_PROGRAMS = test_sta_mgr
+
+test_sta_mgr_SOURCES = net_test.c sta_mgr.c \
+ sta-test.c station_test.c test_sta_mgr.c \
+ core_stub.c sar_stub.c
+test_sta_mgr_MODULES = lib cp/eoc/sta/mgr mac/common \
+ cp/eoc/fsm/stub cp/eoc/cco/action/stub cl/stub bsu/stub cp/msg/stub
+test_sta_mgr_CONFIG_MODULES = cp cp/eoc cl
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/eoc/sta/mgr/test/doc/Makefile b/cesar/cp/eoc/sta/mgr/test/utest/doc/Makefile
index 25c6b6b03d..25c6b6b03d 100644
--- a/cesar/cp/eoc/sta/mgr/test/doc/Makefile
+++ b/cesar/cp/eoc/sta/mgr/test/utest/doc/Makefile
diff --git a/cesar/cp/eoc/sta/mgr/test/doc/net.txt b/cesar/cp/eoc/sta/mgr/test/utest/doc/net.txt
index 3424c2ba52..3424c2ba52 100644
--- a/cesar/cp/eoc/sta/mgr/test/doc/net.txt
+++ b/cesar/cp/eoc/sta/mgr/test/utest/doc/net.txt
diff --git a/cesar/cp/eoc/sta/mgr/test/doc/net_list.txt b/cesar/cp/eoc/sta/mgr/test/utest/doc/net_list.txt
index 758b4754b5..758b4754b5 100644
--- a/cesar/cp/eoc/sta/mgr/test/doc/net_list.txt
+++ b/cesar/cp/eoc/sta/mgr/test/utest/doc/net_list.txt
diff --git a/cesar/cp/eoc/sta/mgr/test/doc/sta.txt b/cesar/cp/eoc/sta/mgr/test/utest/doc/sta.txt
index e711621277..e711621277 100644
--- a/cesar/cp/eoc/sta/mgr/test/doc/sta.txt
+++ b/cesar/cp/eoc/sta/mgr/test/utest/doc/sta.txt
diff --git a/cesar/cp/eoc/sta/mgr/test/doc/sta_mgr.txt b/cesar/cp/eoc/sta/mgr/test/utest/doc/sta_mgr.txt
index 6fcf407725..6fcf407725 100644
--- a/cesar/cp/eoc/sta/mgr/test/doc/sta_mgr.txt
+++ b/cesar/cp/eoc/sta/mgr/test/utest/doc/sta_mgr.txt
diff --git a/cesar/cp/eoc/sta/mgr/test/doc/sta_own_data.txt b/cesar/cp/eoc/sta/mgr/test/utest/doc/sta_own_data.txt
index ab302bcdd0..ab302bcdd0 100644
--- a/cesar/cp/eoc/sta/mgr/test/doc/sta_own_data.txt
+++ b/cesar/cp/eoc/sta/mgr/test/utest/doc/sta_own_data.txt
diff --git a/cesar/cp/eoc/sta/mgr/test/overide/cp/cco/action/inc/context.h b/cesar/cp/eoc/sta/mgr/test/utest/override/cp/cco/action/inc/context.h
index ca3da3cf61..ca3da3cf61 100644
--- a/cesar/cp/eoc/sta/mgr/test/overide/cp/cco/action/inc/context.h
+++ b/cesar/cp/eoc/sta/mgr/test/utest/override/cp/cco/action/inc/context.h
diff --git a/cesar/cp/eoc/sta/mgr/test/overide/cp/inc/context.h b/cesar/cp/eoc/sta/mgr/test/utest/override/cp/inc/context.h
index 5fc77af264..47d4eea571 100644
--- a/cesar/cp/eoc/sta/mgr/test/overide/cp/inc/context.h
+++ b/cesar/cp/eoc/sta/mgr/test/utest/override/cp/inc/context.h
@@ -17,7 +17,7 @@
/* Public interfaces. */
#include "cp/sta/mgr/sta_mgr.h"
-#include "cp/cco/action/cco_action.h"
+#include "cp/eoc/cco/action/cco_action.h"
#include "cl/cl.h"
#include "mac/common/config.h"
#include "mac/sar/sar.h"
@@ -26,7 +26,7 @@
#include "cp/sta/mgr/inc/sta_mgr.h"
/* Override ones. */
-#include "cp/cco/action/inc/context.h"
+#include "cp/eoc/cco/action/inc/cco_action.h"
struct cp_t
{
@@ -50,6 +50,8 @@ struct cp_t
/** Random context. */
lib_rnd_t rnd;
+
+ void *bsu;
};
#endif /* cp_inc_cp_h */
diff --git a/cesar/cp/eoc/sta/mgr/test/overide/cp/sta/core/core.h b/cesar/cp/eoc/sta/mgr/test/utest/override/cp/sta/core/core.h
index a00e59f744..a00e59f744 100644
--- a/cesar/cp/eoc/sta/mgr/test/overide/cp/sta/core/core.h
+++ b/cesar/cp/eoc/sta/mgr/test/utest/override/cp/sta/core/core.h
diff --git a/cesar/cp/eoc/sta/mgr/test/utest/override/cp/sta/core/defs.h b/cesar/cp/eoc/sta/mgr/test/utest/override/cp/sta/core/defs.h
new file mode 100644
index 0000000000..9698b44e93
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/test/utest/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/sta/mgr/test/overide/mac/sar/inc/context.h b/cesar/cp/eoc/sta/mgr/test/utest/override/mac/sar/inc/context.h
index 9e7c6f07ca..9e7c6f07ca 100644
--- a/cesar/cp/eoc/sta/mgr/test/overide/mac/sar/inc/context.h
+++ b/cesar/cp/eoc/sta/mgr/test/utest/override/mac/sar/inc/context.h
diff --git a/cesar/cp/eoc/sta/mgr/test/src/core_stub.c b/cesar/cp/eoc/sta/mgr/test/utest/src/core_stub.c
index c2dfaceccb..c2dfaceccb 100644
--- a/cesar/cp/eoc/sta/mgr/test/src/core_stub.c
+++ b/cesar/cp/eoc/sta/mgr/test/utest/src/core_stub.c
diff --git a/cesar/cp/eoc/sta/mgr/test/src/net_test.c b/cesar/cp/eoc/sta/mgr/test/utest/src/net_test.c
index e9590f0cfa..c4ef480f26 100644
--- a/cesar/cp/eoc/sta/mgr/test/src/net_test.c
+++ b/cesar/cp/eoc/sta/mgr/test/utest/src/net_test.c
@@ -12,7 +12,7 @@
*
*/
#include "common/std.h"
-#include "cp/sta/mgr/test/test_sta_mgr.h"
+#include "test_sta_mgr.h"
bool
cp_net_station_assoc_less (set_node_t *left, set_node_t *right);
@@ -125,14 +125,14 @@ test_case_cp_net_nm (test_t test)
memset (&cp, 0, sizeof (cp_t));
memset (&net, 0, sizeof (cp_net_t));
- cp_net_set_nm (&cp, &net, CP_NET_NM_COORDINATED);
- test_fail_if (cp_net_get_nm (&cp, &net) != CP_NET_NM_COORDINATED);
+ cp_net_set_nm (&cp, &net, MAC_NM_COORDINATED);
+ test_fail_if (cp_net_get_nm (&cp, &net) != MAC_NM_COORDINATED);
- cp_net_set_nm (&cp, &net, CP_NET_NM_CSMA_ONLY);
- test_fail_if (cp_net_get_nm (&cp, &net) != CP_NET_NM_CSMA_ONLY);
+ cp_net_set_nm (&cp, &net, MAC_NM_CSMA_ONLY);
+ test_fail_if (cp_net_get_nm (&cp, &net) != MAC_NM_CSMA_ONLY);
- cp_net_set_nm (&cp, &net, CP_NET_NM_UNCOORDINATED);
- test_fail_if (cp_net_get_nm (&cp, &net) != CP_NET_NM_UNCOORDINATED);
+ cp_net_set_nm (&cp, &net, MAC_NM_UNCOORDINATED);
+ test_fail_if (cp_net_get_nm (&cp, &net) != MAC_NM_UNCOORDINATED);
}
test_end;
}
diff --git a/cesar/cp/eoc/sta/mgr/test/src/sar_stub.c b/cesar/cp/eoc/sta/mgr/test/utest/src/sar_stub.c
index a9847bef57..a9847bef57 100644
--- a/cesar/cp/eoc/sta/mgr/test/src/sar_stub.c
+++ b/cesar/cp/eoc/sta/mgr/test/utest/src/sar_stub.c
diff --git a/cesar/cp/eoc/sta/mgr/test/src/sta-test.c b/cesar/cp/eoc/sta/mgr/test/utest/src/sta-test.c
index d8effc6c7d..1c798fd56d 100644
--- a/cesar/cp/eoc/sta/mgr/test/src/sta-test.c
+++ b/cesar/cp/eoc/sta/mgr/test/utest/src/sta-test.c
@@ -43,7 +43,7 @@ test_sta_own_init (cp_t *cp)
cp->sar = &sar;
cp->mac_store = sar.mac_store = mac_store_init ();
lib_rnd_init (&cp->rnd, 1234);
- cp_sta_mgr_init (cp);
+ cp_eoc_sta_mgr_init (cp);
}
static void
@@ -75,7 +75,7 @@ test_case_cp_sta_own_data_init (test_t test)
cmp.public.hybrid_mode = MAC_COEXISTENCE_HYBRID_DELIMITERS_MODE;
lib_rnd_init (&cp.rnd, 0x432);
- cp_sta_mgr_init (&cp);
+ cp_eoc_sta_mgr_init (&cp);
cmp.snid = cp_sta_own_data_get_snid (&cp);
real = (cp_sta_own_data_private_t*) cp_sta_mgr_get_sta_own_data(&cp);
@@ -135,7 +135,7 @@ test_case_cp_sta_own_data__mac_address (test_t test)
cp.mac_config = &mac_config;
lib_rnd_init (&cp.rnd, 0x432);
- cp_sta_mgr_init (&cp);
+ cp_eoc_sta_mgr_init (&cp);
cp_sta_own_data_set_mac_address (&cp, 0x123456789ABCull);
test_fail_if (cp_sta_own_data_get_mac_address (&cp) !=
@@ -156,7 +156,7 @@ test_case_cp_sta_own_data__npw (test_t test)
cp_t cp;
lib_rnd_init (&cp.rnd, 0x432);
- cp_sta_mgr_init (&cp);
+ cp_eoc_sta_mgr_init (&cp);
cp_sta_own_data_set_npw (&cp, "Hello world");
test_fail_if (
@@ -185,7 +185,7 @@ test_case_cp_sta_own_data__nmk (test_t test)
key.key[3] = 0xdef0;
lib_rnd_init (&cp.rnd, 0x432);
- cp_sta_mgr_init (&cp);
+ cp_eoc_sta_mgr_init (&cp);
changed = cp_sta_own_data_set_nmk (&cp, key, 0);
res = cp_sta_own_data_get_nmk (&cp);
@@ -211,7 +211,7 @@ test_case_cp_sta_own_data__dpw (test_t test)
cp_t cp;
lib_rnd_init (&cp.rnd, 0x432);
- cp_sta_mgr_init (&cp);
+ cp_eoc_sta_mgr_init (&cp);
cp_sta_own_data_set_dpw (&cp, "Hello world");
test_fail_if (
@@ -232,7 +232,7 @@ test_case_cp_sta_own_data__security_level (test_t test)
cp_t cp;
lib_rnd_init (&cp.rnd, 0x432);
- cp_sta_mgr_init (&cp);
+ cp_eoc_sta_mgr_init (&cp);
cp_sta_own_data_set_security_level (&cp, CP_SECURITY_LEVEL_SC);
test_fail_if (cp_sta_own_data_get_security_level (&cp) !=
@@ -258,7 +258,7 @@ test_case_cp_sta_own_data__was_cco (test_t test)
cp_t cp;
lib_rnd_init (&cp.rnd, 0x432);
- cp_sta_mgr_init (&cp);
+ cp_eoc_sta_mgr_init (&cp);
cp_sta_own_data_set_was_cco (&cp, true);
test_fail_if (cp_sta_own_data_get_was_cco(&cp) != true);
cp_sta_own_data_set_was_cco (&cp, false);
@@ -281,7 +281,7 @@ test_case_cp_sta_own_data__hfid_avln (test_t test)
cp_sta_own_data_t *sta;
lib_rnd_init (&cp.rnd, 0x432);
- cp_sta_mgr_init (&cp);
+ cp_eoc_sta_mgr_init (&cp);
sta = cp_sta_mgr_get_sta_own_data (&cp);
cp_sta_own_data_set_hfid_avln (&cp, "Hello world");
@@ -304,7 +304,7 @@ test_case_cp_sta_own_data__hfid_user (test_t test)
cp_sta_own_data_t *sta;
lib_rnd_init (&cp.rnd, 0x432);
- cp_sta_mgr_init (&cp);
+ cp_eoc_sta_mgr_init (&cp);
sta = cp_sta_mgr_get_sta_own_data (&cp);
cp_sta_own_data_set_hfid_user (&cp, "Hello world");
@@ -327,7 +327,7 @@ test_case_cp_sta_own_data__hfid_manufacturer (test_t test)
cp_sta_own_data_t *sta;
lib_rnd_init (&cp.rnd, 0x432);
- cp_sta_mgr_init (&cp);
+ cp_eoc_sta_mgr_init (&cp);
sta = cp_sta_mgr_get_sta_own_data (&cp);
cp_sta_own_data_set_hfid_manufacturer (&cp, "Hello world");
@@ -350,7 +350,7 @@ test_case_cp_sta_own_data__pco_glid (test_t test)
cp_sta_own_data_t *sta;
lib_rnd_init (&cp.rnd, 0x432);
- cp_sta_mgr_init (&cp);
+ cp_eoc_sta_mgr_init (&cp);
sta = cp_sta_mgr_get_sta_own_data (&cp);
cp_sta_own_data_set_pco_glid (&cp, 0x90);
test_fail_if (cp_sta_own_data_get_pco_glid (&cp) != 0x90);
@@ -372,7 +372,7 @@ test_case_cp_sta_own_data__pco_status (test_t test)
cp_sta_own_data_t *sta;
lib_rnd_init (&cp.rnd, 0x432);
- cp_sta_mgr_init (&cp);
+ cp_eoc_sta_mgr_init (&cp);
sta = cp_sta_mgr_get_sta_own_data (&cp);
fsm_posted = false;
@@ -400,7 +400,7 @@ test_case_cp_sta_own_data__pco_status (test_t test)
cp_sta_own_data_t *sta;
lib_rnd_init (&cp.rnd, 0x432);
- cp_sta_mgr_init (&cp);
+ cp_eoc_sta_mgr_init (&cp);
sta = cp_sta_mgr_get_sta_own_data (&cp);
cp_sta_own_data_set_pco_status (&cp, true);
cp_sta_own_data_set_pco_glid (&cp, 0x85);
@@ -435,7 +435,7 @@ test_case_cp_sta_own_data__cco_status (test_t test)
sar.mac_store = cp.mac_store;
lib_rnd_init (&cp.rnd, 0x432);
- cp_sta_mgr_init (&cp);
+ cp_eoc_sta_mgr_init (&cp);
net = cp_sta_mgr_add_avln (&cp, 1, 1);
cp_sta_mgr_set_our_avln (&cp, net);
@@ -485,7 +485,7 @@ test_case_cp_sta_own_data__authenticated_status (test_t test)
sar.mac_store = cp.mac_store;
lib_rnd_init (&cp.rnd, 0x432);
- cp_sta_mgr_init (&cp);
+ cp_eoc_sta_mgr_init (&cp);
net = cp_sta_mgr_add_avln (&cp, 1, 1);
cp_sta_mgr_set_our_avln (&cp, net);
@@ -523,7 +523,7 @@ test_case_cp_sta_own_data__nid (test_t test)
cp_t cp;
lib_rnd_init (&cp.rnd, 0x432);
- cp_sta_mgr_init (&cp);
+ cp_eoc_sta_mgr_init (&cp);
lib_rnd_t rnd;
lib_rnd_init (&rnd, 0x4224);
@@ -557,7 +557,7 @@ test_case_cp_sta_own_data__snid (test_t test)
cp_t cp;
lib_rnd_init (&cp.rnd, 0x432);
- cp_sta_mgr_init (&cp);
+ cp_eoc_sta_mgr_init (&cp);
cp_sta_own_data_set_snid (&cp, 0x2);
test_fail_if (cp_sta_own_data_get_snid (&cp) != 0x2);
@@ -581,7 +581,7 @@ test_case_cp_sta_own_data__tek (test_t test)
cp_key_t tek;
lib_rnd_init (&cp.rnd, 0x432);
- cp_sta_mgr_init (&cp);
+ cp_eoc_sta_mgr_init (&cp);
key.key[0] = 0x12345678;
key.key[1] = 0x12345678;
@@ -612,7 +612,7 @@ test_case_cp_sta_own_data__dak (test_t test)
memset (&cp, 0, sizeof (cp_t));
lib_rnd_init (&cp.rnd, 0x432);
- cp_sta_mgr_init (&cp);
+ cp_eoc_sta_mgr_init (&cp);
cp_sta_own_data_set_dak (&cp, dak);
own_dak = cp_sta_own_data_get_dak (&cp);
@@ -636,7 +636,7 @@ test_case_cp_sta_own_data__sc (test_t test)
memset (&cp, 0, sizeof (cp_t));
lib_rnd_init (&cp.rnd, 0x432);
- cp_sta_mgr_init (&cp);
+ cp_eoc_sta_mgr_init (&cp);
fsm_posted = false;
cp_sta_own_data_set_sc (&cp, true);
diff --git a/cesar/cp/eoc/sta/mgr/test/src/sta_mgr.c b/cesar/cp/eoc/sta/mgr/test/utest/src/sta_mgr.c
index e2b9db7458..a24ca25adf 100644
--- a/cesar/cp/eoc/sta/mgr/test/src/sta_mgr.c
+++ b/cesar/cp/eoc/sta/mgr/test/utest/src/sta_mgr.c
@@ -16,8 +16,8 @@
#include "lib/test.h"
#include "test_sta_mgr.h"
-void
-cp_sta_mgr_elects_sta_partial_ack (cp_t *ctx);
+#include "cp/eoc/sta/mgr/sta_mgr.h"
+#include "cp/sta/mgr/sta_mgr.h"
void
test_case__cp_sta_mgr_sta (test_t test)
@@ -27,17 +27,23 @@ test_case__cp_sta_mgr_sta (test_t test)
test_begin (test, "Station Unassociated")
{
cp_t cp;
+ cl_t cl;
+ mac_t mac_addr;
+ mac_config_t mac_config;
cp_net_t *net;
cp_sta_t *sta;
- mac_t mac_addr;
/* configuring the test. */
memset (&cp, 0, sizeof (cp_t));
- mac_config_t mac_config;
- cp.mac_config=&mac_config;
+ memset (&cl, 0, sizeof (cl_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
+ cp.mac_config= &mac_config;
+ cp.cl = &cl;
mac_addr = 0x12345678ABCull;
- cp_sta_mgr_init (&cp);
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
net = cp_sta_mgr_add_avln (&cp, 1, 1);
dbg_check (net);
@@ -59,6 +65,7 @@ test_case__cp_sta_mgr_sta (test_t test)
test_fail_if (sta != NULL);
cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
}
test_end;
@@ -69,15 +76,18 @@ test_case__cp_sta_mgr_sta (test_t test)
cp_sta_t *sta;
mac_t mac_addr;
cp_tei_t sta_tei;
+ mac_config_t mac_config;
/* configuring the test. */
memset (&cp, 0, sizeof (cp_t));
- mac_config_t mac_config;
- cp.mac_config=&mac_config;
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
+ cp.mac_config = &mac_config;
mac_addr = 0x12345678ABCull;
sta_tei = 0xB;
- cp_sta_mgr_init (&cp);
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
net = cp_sta_mgr_add_avln (&cp, 1, 1);
dbg_check (net);
@@ -101,6 +111,7 @@ test_case__cp_sta_mgr_sta (test_t test)
cp_sta_mgr_sta_remove_assoc (&cp, net, sta_tei);
cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
}
test_end;
@@ -111,16 +122,17 @@ test_case__cp_sta_mgr_sta (test_t test)
cp_sta_t *sta;
cp_sta_t *sta2;
mac_t mac_addr;
- cp_tei_t sta_tei;
+ mac_config_t mac_config;
/* configuring the test. */
memset (&cp, 0, sizeof (cp_t));
- mac_config_t mac_config;
- cp.mac_config=&mac_config;
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
+ cp.mac_config = &mac_config;
mac_addr = 0x12345678ABCull;
- sta_tei = 0xB;
- cp_sta_mgr_init (&cp);
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
net = cp_sta_mgr_add_avln (&cp, 1, 1);
dbg_check (net);
@@ -138,6 +150,7 @@ test_case__cp_sta_mgr_sta (test_t test)
slab_release (sta2);
cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
}
test_end;
@@ -149,15 +162,18 @@ test_case__cp_sta_mgr_sta (test_t test)
cp_sta_t *sta2;
mac_t mac_addr;
cp_tei_t sta_tei;
+ mac_config_t mac_config;
/* configuring the test. */
memset (&cp, 0, sizeof (cp_t));
- mac_config_t mac_config;
- cp.mac_config=&mac_config;
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
+ cp.mac_config = &mac_config;
mac_addr = 0x12345678ABCull;
sta_tei = 0xB;
- cp_sta_mgr_init (&cp);
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
net = cp_sta_mgr_add_avln (&cp, 1, 1);
dbg_check (net);
@@ -185,6 +201,7 @@ test_case__cp_sta_mgr_sta (test_t test)
slab_release (sta2);
cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
}
test_end;
@@ -197,16 +214,19 @@ test_case__cp_sta_mgr_sta (test_t test)
mac_t mac_addrA;
mac_t mac_addrB;
cp_tei_t sta_tei;
+ mac_config_t mac_config;
/* configuring the test. */
memset (&cp, 0, sizeof (cp_t));
- mac_config_t mac_config;
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
cp.mac_config=&mac_config;
mac_addrA = 0x12345678ABCull;
mac_addrB = 0x2345678ABCDull;
sta_tei = 0xB;
- cp_sta_mgr_init (&cp);
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
net = cp_sta_mgr_add_avln (&cp, 1, 1);
dbg_check (net);
@@ -234,6 +254,7 @@ test_case__cp_sta_mgr_sta (test_t test)
slab_release (sta2);
cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
}
test_end;
@@ -245,15 +266,18 @@ test_case__cp_sta_mgr_sta (test_t test)
cp_sta_t *sta2;
mac_t mac_addr;
cp_tei_t sta_tei;
+ mac_config_t mac_config;
/* configuring the test. */
memset (&cp, 0, sizeof (cp_t));
- mac_config_t mac_config;
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
cp.mac_config=&mac_config;
mac_addr = 0x12345678ABCull;
sta_tei = 0xB;
- cp_sta_mgr_init (&cp);
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
net = cp_sta_mgr_add_avln (&cp, 1, 1);
dbg_check (net);
@@ -284,6 +308,7 @@ test_case__cp_sta_mgr_sta (test_t test)
slab_release (sta2);
cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
}
test_end;
@@ -296,17 +321,19 @@ test_case__cp_sta_mgr_sta (test_t test)
mac_t mac_addr;
cp_tei_t sta_tei_A;
cp_tei_t sta_tei_B;
+ mac_config_t mac_config;
/* configuring the test. */
memset (&cp, 0, sizeof (cp_t));
- mac_config_t mac_config;
+ memset (&mac_config, 0, sizeof (mac_config_t));
cp.mac_config=&mac_config;
mac_addr = 0x12345678ABCull;
sta_tei_A = 0xB;
sta_tei_B = 0xF;
- cp_sta_mgr_init (&cp);
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
net = cp_sta_mgr_add_avln (&cp, 1, 1);
dbg_check (net);
@@ -337,6 +364,7 @@ test_case__cp_sta_mgr_sta (test_t test)
slab_release (sta2);
cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
}
test_end;
@@ -349,17 +377,19 @@ test_case__cp_sta_mgr_sta (test_t test)
mac_t mac_addr;
cp_tei_t sta_tei_A;
cp_tei_t sta_tei_B;
+ mac_config_t mac_config;
/* configuring the test. */
memset (&cp, 0, sizeof (cp_t));
- mac_config_t mac_config;
+ memset (&mac_config, 0, sizeof (mac_config_t));
cp.mac_config=&mac_config;
mac_addr = 0x12345678ABCull;
sta_tei_A = 0xB;
sta_tei_B = 0;
- cp_sta_mgr_init (&cp);
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
net = cp_sta_mgr_add_avln (&cp, 1, 1);
dbg_check (net);
@@ -390,6 +420,7 @@ test_case__cp_sta_mgr_sta (test_t test)
slab_release (sta2);
cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
}
test_end;
@@ -402,16 +433,18 @@ test_case__cp_sta_mgr_sta (test_t test)
cp_sta_t *sta2;
mac_t mac_addr;
cp_tei_t sta_tei;
+ mac_config_t mac_config;
/* configuring the test. */
memset (&cp, 0, sizeof (cp_t));
- mac_config_t mac_config;
+ memset (&mac_config, 0, sizeof (mac_config_t));
cp.mac_config=&mac_config;
mac_addr = 0x12345678ABCull;
sta_tei = 0xB;
- cp_sta_mgr_init (&cp);
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
net = cp_sta_mgr_add_avln (&cp, 1, 1);
dbg_check (net);
@@ -442,6 +475,7 @@ test_case__cp_sta_mgr_sta (test_t test)
slab_release (sta2);
cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
}
test_end;
@@ -454,16 +488,19 @@ test_case__cp_sta_mgr_sta (test_t test)
cp_sta_t *sta2;
mac_t mac_addr;
cp_tei_t sta_tei;
+ mac_config_t mac_config;
/* configuring the test. */
memset (&cp, 0, sizeof (cp_t));
- mac_config_t mac_config;
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
cp.mac_config=&mac_config;
mac_addr = 0x12345678ABCull;
sta_tei = 0xB;
- cp_sta_mgr_init (&cp);
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
net = cp_sta_mgr_add_avln (&cp, 1, 1);
dbg_check (net);
@@ -499,6 +536,7 @@ test_case__cp_sta_mgr_sta (test_t test)
slab_release (sta2);
cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
}
test_end;
@@ -509,6 +547,7 @@ test_case__cp_sta_mgr_sta (test_t test)
cp_t cp;
cp_net_t *net;
cp_sta_t *sta;
+
test_sta_mgr_init (&cp);
net = cp_sta_mgr_add_avln (&cp, 1, 1);
sta = cp_sta_mgr_sta_add (&cp, net, 0, 1);
@@ -603,13 +642,15 @@ test_case__cp_net_uninit (test_t test)
cp_t cp;
cp_net_t *net;
cp_sta_t *sta;
+ mac_config_t mac_config;
/* configuring the test. */
memset (&cp, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
- mac_config_t mac_config;
cp.mac_config=&mac_config;
- cp_sta_mgr_init (&cp);
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
/* Add an AVLN. */
net = cp_sta_mgr_add_avln (&cp, 1, 1);
@@ -636,6 +677,7 @@ test_case__cp_net_uninit (test_t test)
test_fail_if (set_empty(&net->unassociated_stas) != false);
cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
test_fail_if (set_empty(&net->associated_stas) != true);
test_fail_if (set_empty(&net->unassociated_stas) != true);
@@ -657,13 +699,16 @@ test_case__cp_sta_manager_garbage (test_t test)
cp_sta_t *sta;
cl_t cl;
uint i;
+ mac_config_t mac_config;
/* configuring the test. */
memset (&cp, 0, sizeof (cp_t));
+ memset (&cl, 0, sizeof (cl_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
- mac_config_t mac_config;
cp.mac_config=&mac_config;
- cp_sta_mgr_init (&cp);
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
cp.cl = &cl;
/* Add an AVLN. */
@@ -684,10 +729,11 @@ test_case__cp_sta_manager_garbage (test_t test)
}
/* Release the stations. */
- cp_sta_mgr_garbage (&cp);
+ cp_eoc_sta_mgr_garbage (&cp);
test_fail_unless (cp_sta_mgr_net_list_is_empty (&cp));
cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
}
test_end;
@@ -706,8 +752,9 @@ test_case__cp_sta_manager_garbage (test_t test)
memset (&sar, 0, sizeof (sar_t));
memset (&mac_config, 0, sizeof (mac_config_t));
- cp.mac_config=&mac_config;
- cp_sta_mgr_init (&cp);
+ cp.mac_config = &mac_config;
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
mac_ntb_init (&mac_config);
net = cp_sta_mgr_add_avln (&cp, 1, 1);
@@ -757,8 +804,9 @@ test_case__cp_sta_manager_garbage (test_t test)
/* Station manager uninitialise. */
cp_sta_mgr_sta_remove_from_mac (&cp, 123);
cp_sta_mgr_sta_remove_from_mac (&cp, 124);
- cp_sta_mgr_uninit (&cp);
mac_store_uninit (cp.mac_store);
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
}
test_end;
@@ -770,16 +818,19 @@ test_case__cp_sta_manager_garbage (test_t test)
sar_t sar;
cl_t cl;
mac_config_t mac_config;
+
memset (&cp, 0, sizeof (cp_t));
memset (&sar, 0, sizeof (sar_t));
memset (&cl, 0, sizeof (cl_t));
memset (&mac_config, 0, sizeof (mac_config_t));
+
cp.sar = &sar;
cp.cl = &cl;
cp.mac_config = &mac_config;
cp.mac_store = mac_store_init ();
sar.mac_store = cp.mac_store;
- cp_sta_mgr_init (&cp);
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
net = cp_sta_mgr_add_avln (&cp, 1, 1);
/* Add some stations in the first AVLN. */
sta = cp_sta_mgr_sta_add (&cp, net, 1, 1);
@@ -789,17 +840,18 @@ test_case__cp_sta_manager_garbage (test_t test)
/* Set our AVLN. */
cp_sta_mgr_set_our_avln (&cp, net);
/* Launch the test. */
- cp_sta_mgr_garbage (&cp);
+ cp_eoc_sta_mgr_garbage (&cp);
/* Its our AVLN and the station is not CCo. It should not remove the
* station. */
test_fail_unless (!cp_net_is_empty (&cp, net));
/* Now the net is no more our AVLN. */
cp_sta_mgr_set_our_avln (&cp, NULL);
test_fail_unless (!cp_net_is_empty (&cp, net));
- cp_sta_mgr_garbage (&cp);
+ cp_eoc_sta_mgr_garbage (&cp);
test_fail_unless (cp_net_is_empty (&cp, net));
test_fail_unless (!net->present);
cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
mac_store_uninit (sar.mac_store);
}
test_end;
@@ -815,13 +867,15 @@ test_case__cp_net_pco (test_t test)
cp_t cp;
cp_net_t *net;
cp_sta_t *sta;
+ mac_config_t mac_config;
/* configuring the test. */
memset (&cp, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
- mac_config_t mac_config;
cp.mac_config=&mac_config;
- cp_sta_mgr_init (&cp);
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
/* Add an AVLN. */
net = cp_sta_mgr_add_avln (&cp, 2, 2);
@@ -842,6 +896,7 @@ test_case__cp_net_pco (test_t test)
slab_release (sta);
cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
}
test_end;
@@ -858,13 +913,15 @@ test_case__cp_net_sta_get_first_next (test_t test)
cp_net_t *net;
cp_sta_t *sta1;
cp_sta_t *sta2;
+ mac_config_t mac_config;
/* configuring the test. */
memset (&cp, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
- mac_config_t mac_config;
cp.mac_config=&mac_config;
- cp_sta_mgr_init (&cp);
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
/* Add an AVLN. */
net = cp_sta_mgr_add_avln (&cp, 2, 2);
@@ -886,6 +943,7 @@ test_case__cp_net_sta_get_first_next (test_t test)
slab_release (sta2);
cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
}
test_end;
}
@@ -898,13 +956,13 @@ test_case__cp_sta_mgr_get_avln (test_t test)
test_begin (test, "Get an AVLN")
{
cp_t cp;
- cp_net_t *net;
uint i, j;
/* configuring the test. */
memset (&cp, 0, sizeof (cp_t));
- cp_sta_mgr_init (&cp);
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
for (i = 0; i < HPAV_AVLNS_NB_MAX; i++)
- net = cp_sta_mgr_add_avln (&cp, i, i);
+ cp_sta_mgr_add_avln (&cp, i, i);
for (i = 0; i < HPAV_AVLNS_NB_MAX; i++)
{
test_fail_unless (cp.sta_mgr.networks[i].present);
@@ -922,6 +980,7 @@ test_case__cp_sta_mgr_get_avln (test_t test)
}
}
cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
}
test_end;
}
@@ -940,7 +999,8 @@ test_case__cp_sta_mgr_get_first_next_avln (test_t test)
/* configuring the test. */
memset (&cp, 0, sizeof (cp_t));
- cp_sta_mgr_init (&cp);
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
/* Add AVLN. */
net_cmp[0] = cp_sta_mgr_add_avln (&cp, 2, 2);
@@ -958,6 +1018,7 @@ test_case__cp_sta_mgr_get_first_next_avln (test_t test)
test_fail_if (NULL != net);
cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
}
test_end;
}
@@ -975,16 +1036,21 @@ test_case__cp_net_is_empty (test_t test)
cp_net_t *net;
cp_sta_t *sta;
uint i;
+ mac_config_t mac_config;
+
/* configuring the test. */
memset (&cp, 0, sizeof (cp_t));
- mac_config_t mac_config;
+ memset (&cl, 0, sizeof (cl_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
cp.mac_config=&mac_config;
cp.sar = &sar;
cp.cl = &cl;
cl.mactotei = NULL;
sar.mac_store = mac_store_init ();
cp.mac_store = sar.mac_store;
- cp_sta_mgr_init (&cp);
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
test_fail_unless (cp_sta_mgr_net_list_is_empty (&cp) == true);
for (i = 0; i < HPAV_AVLNS_NB_MAX; i++)
{
@@ -1022,6 +1088,7 @@ test_case__cp_net_is_empty (test_t test)
net->present = true;
test_fail_unless (cp_sta_mgr_net_list_is_empty (&cp) == true);
cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
}
test_end;
}
@@ -1034,6 +1101,8 @@ test_case__cp_sta_mgr_set_our_avln__no_net (test_t test)
test_begin (test, "start")
{
cp_t cp;
+ memset (&cp, 0, sizeof (cp_t));
+
test_sta_mgr_init (&cp);
cp.cl->mactotei = NULL;
cp_net_t *net;
@@ -1088,6 +1157,9 @@ test_case__cp_sta_mgr_set_our_avln__with_net (test_t test)
sta_t *sta_store;
mfs_tx_t *mfs;
bool added;
+
+ memset (&cp, 0, sizeof (cp_t));
+
test_sta_mgr_init (&cp);
/* Store a broadcast MFS. */
mfs = mac_store_mfs_add_tx (cp.mac_store, true, false, 1,
@@ -1179,6 +1251,9 @@ test_case__cp_sta_mgr_set_our_avln__with_net_to_unassoc (test_t test)
sta_t *sta_store;
cp_net_t *net;
cp_t cp;
+
+ memset (&cp, 0, sizeof (cp_t));
+
test_sta_mgr_init (&cp);
net = cp_sta_mgr_add_avln (&cp, 1, 1);
@@ -1234,12 +1309,15 @@ test_case__cp_sta_mgr_set_our_avln__with_net_to_unassoc (test_t test)
}
void
-test_case__cp_sta_mgr_release_station (test_t test)
+test_case__cp_eoc_sta_mgr_release_station (test_t test)
{
cp_t cp;
cp_net_t *net;
cp_sta_t *sta;
sta_t *sta_store;
+
+ memset (&cp, 0, sizeof (cp_t));
+
test_case_begin (test, "Release station");
test_begin (test, "No AVLN")
{
@@ -1251,7 +1329,7 @@ test_case__cp_sta_mgr_release_station (test_t test)
dbg_fatal_try_begin
{
- cp_sta_mgr_release_station (&cp, 1);
+ cp_eoc_sta_mgr_release_station (&cp, 1);
}
dbg_fatal_try_catch (const char *fail)
{
@@ -1263,13 +1341,13 @@ test_case__cp_sta_mgr_release_station (test_t test)
// The same as CCo.
cp_sta_own_data_set_tei (&cp, 2);
cp_sta_own_data_set_cco_status (&cp, true);
- cp_sta_mgr_release_station (&cp, 1);
+ cp_eoc_sta_mgr_release_station (&cp, 1);
test_fail_if (sta->tei_lease_date_ms != CP_STA_MGR_STATION_RELEASE_MS +
cp_sta_core_get_date_ms (&cp));
/* Launch the garbage. */
- cp_sta_mgr_garbage (&cp);
+ cp_eoc_sta_mgr_garbage (&cp);
test_fail_if (list_empty (&cp.sta_mgr.release_sta_list) == true);
@@ -1277,7 +1355,7 @@ test_case__cp_sta_mgr_release_station (test_t test)
sta->tei_lease_date_ms = 0;
slab_release (sta);
- cp_sta_mgr_garbage (&cp);
+ cp_eoc_sta_mgr_garbage (&cp);
test_fail_if (list_empty (&cp.sta_mgr.release_sta_list) == false);
/* Verify the store. */
@@ -1298,7 +1376,7 @@ test_case__cp_sta_mgr_release_station (test_t test)
// The same as CCo.
cp_sta_own_data_set_tei (&cp, 2);
cp_sta_own_data_set_cco_status (&cp, true);
- cp_sta_mgr_release_station (&cp, 1);
+ cp_eoc_sta_mgr_release_station (&cp, 1);
test_fail_if (sta->tei_lease_date_ms != CP_STA_MGR_STATION_RELEASE_MS +
cp_sta_core_get_date_ms (&cp));
@@ -1326,7 +1404,7 @@ test_case__cp_sta_mgr_release_station (test_t test)
// The same as CCo.
cp_sta_own_data_set_tei (&cp, 2);
cp_sta_own_data_set_cco_status (&cp, true);
- cp_sta_mgr_release_station (&cp, 1);
+ cp_eoc_sta_mgr_release_station (&cp, 1);
net = cp_sta_mgr_add_avln (&cp, 2, 2);
cp_sta_mgr_set_our_avln (&cp, net);
@@ -1336,7 +1414,7 @@ test_case__cp_sta_mgr_release_station (test_t test)
// The same as CCo.
cp_sta_own_data_set_tei (&cp, 2);
cp_sta_own_data_set_cco_status (&cp, true);
- cp_sta_mgr_release_station (&cp, 1);
+ cp_eoc_sta_mgr_release_station (&cp, 1);
test_fail_if (sta->tei_lease_date_ms != CP_STA_MGR_STATION_RELEASE_MS +
cp_sta_core_get_date_ms (&cp));
@@ -1354,150 +1432,6 @@ test_case__cp_sta_mgr_release_station (test_t test)
}
void
-test_case__cp_sta_mgr_partial_ack (test_t test)
-{
- test_case_begin (test, "Partial acknowledge");
-
-// test_begin (test, "Partial ACK")
-// {
-// cp_t cp;
-// cl_t cl;
-// sar_t sar;
-// mac_config_t mac_config;
-// cp_net_t *net;
-// cp_sta_t *sta;
-// sta_t *sta_store;
-// uint i;
-// uint nbsta = 10;
-// lib_rnd_t rand;
-//
-// memset (&cl, 0, sizeof (cl_t));
-// memset (&sar, 0, sizeof (sar_t));
-// memset (&mac_config, 0, sizeof (mac_config_t));
-// cp_sta_mgr_init (&cp);
-// cp.mac_store = mac_store_init ();
-// cp.cl = (cl_t *) &cl;
-// cp.sar = &sar;
-// sar.mac_store = cp.mac_store;
-// cp.mac_config = &mac_config;
-//
-// lib_rnd_init (&rand, 0x123);
-// memset (&mac_config, 0, sizeof (mac_config));
-//
-// /* First test, elects a station when our station does not makes part
-// * of any AVLN. */
-// cp_sta_mgr_elects_sta_partial_ack (&cp);
-// test_fail_unless (mac_config.partial_ack_tei_default == 0);
-//
-// /* Add the AVLN and configure it as our AVLN. */
-// net = cp_sta_mgr_add_avln (&cp, 1, 1);
-// cp_sta_mgr_set_our_avln (&cp, net);
-//
-// /* Create some stations. */
-// for (i = 1; i < nbsta; i++)
-// {
-// /* Add the station in the station manager and at the same time in
-// * the mac store. */
-// sta = cp_sta_mgr_sta_add (&cp, net, i, i);
-//
-// /* Get the station from the mac store. */
-// sta_store = mac_store_sta_get (cp.mac_store, i);
-// dbg_assert (sta_store);
-//
-// /* Modify the default tone map to configure the BLE.*/
-// if (sta_store->tx_tonemaps)
-// {
-// /* Allocate the tone map. */
-// sta_store->tx_tonemaps->tm[4] = tonemap_alloc ();
-// sta_store->tx_tonemaps->default_tmi = 4;
-// sta_store->tx_tonemaps->tm[4]->ble = lib_rnd32 (&rand);
-// }
-//
-// blk_release (sta_store);
-// slab_release (sta);
-// }
-//
-// cp_sta_mgr_elects_sta_partial_ack (&cp);
-// test_fail_unless (mac_config.partial_ack_tei_default == 2);
-//
-// /* Modify the BLE for station 2. */
-// sta_store = mac_store_sta_get (cp.mac_store, 2);
-// dbg_assert (sta_store);
-// sta_store->tx_tonemaps->tm[0]->ble = 51;
-// blk_release (sta_store);
-//
-// cp_sta_mgr_elects_sta_partial_ack (&cp);
-// test_fail_unless (mac_config.partial_ack_tei_default == 3);
-//
-//
-// /* Removes the current acknowledge station from the network. */
-// cp_sta_mgr_sta_remove_assoc (&cp, net, 3);
-// test_fail_unless (mac_config.partial_ack_tei_default == 8);
-//
-// /* Ends the test. */
-// cp_sta_mgr_set_our_avln (&cp, NULL);
-//
-// mac_store_uninit (cp.mac_store);
-// cp_sta_mgr_uninit (&cp);
-// }
-// test_end;
-//
-// test_begin (test, "Partial ACK no Tone maps")
-// {
-// cp_t cp;
-// cl_t cl;
-// sar_t sar;
-// mac_config_t mac_config;
-// cp_net_t *net;
-// cp_sta_t *sta;
-// uint i;
-// uint nbsta = 10;
-// lib_rnd_t rand;
-//
-// memset (&cl, 0, sizeof (cl_t));
-// memset (&sar, 0, sizeof (sar_t));
-// memset (&mac_config, 0, sizeof (mac_config_t));
-// cp_sta_mgr_init (&cp);
-// cp.mac_store = mac_store_init ();
-// cp.cl = (cl_t *) &cl;
-// cp.sar = &sar;
-// sar.mac_store = cp.mac_store;
-// cp.mac_config = &mac_config;
-//
-// lib_rnd_init (&rand, 0x123);
-// memset (&mac_config, 0, sizeof (mac_config));
-//
-// /* First test, elects a station when our station does not makes part
-// * of any AVLN. */
-// cp_sta_mgr_elects_sta_partial_ack (&cp);
-// test_fail_unless (mac_config.partial_ack_tei_default == 0);
-//
-// /* Add the AVLN and configure it as our AVLN. */
-// net = cp_sta_mgr_add_avln (&cp, 1, 1);
-// cp_sta_mgr_set_our_avln (&cp, net);
-//
-// /* Create some stations. */
-// for (i = 1; i < nbsta; i++)
-// {
-// /* Add the station in the station manager and at the same time in
-// * the mac store. */
-// sta = cp_sta_mgr_sta_add (&cp, net, i, i);
-// slab_release (sta);
-// }
-//
-// cp_sta_mgr_elects_sta_partial_ack (&cp);
-// test_fail_unless (mac_config.partial_ack_tei_default == 0);
-//
-// /* Ends the test. */
-// cp_sta_mgr_set_our_avln (&cp, NULL);
-//
-// mac_store_uninit (cp.mac_store);
-// cp_sta_mgr_uninit (&cp);
-// }
-// test_end;
-}
-
-void
test_case__cp_sta_mgr_change_snid (test_t test)
{
test_case_begin (test, "Change snid");
@@ -1506,6 +1440,8 @@ test_case__cp_sta_mgr_change_snid (test_t test)
{
cp_t cp;
cp_net_t *net;
+ memset (&cp, 0, sizeof (cp_t));
+
test_sta_mgr_init (&cp);
net = cp_sta_mgr_add_avln (&cp, 1, 1);
cp_sta_mgr_set_our_avln (&cp, net);
@@ -1526,6 +1462,9 @@ test_case__cp_sta_mgr_change_snid (test_t test)
{
cp_t cp;
cp_net_t *net;
+
+ memset (&cp, 0, sizeof (cp_t));
+
test_sta_mgr_init (&cp);
net = cp_sta_mgr_add_avln (&cp, 1, 1);
@@ -1563,7 +1502,9 @@ test_case_snid_present (test_t test)
cp_t cp;
uint i;
u16 snidFlags, snidfcmp = 0;
+
memset (&cp, 0, sizeof (cp_t));
+
test_case_begin (test, "Getting present SNID");
cp_snid_t snid [] = {1, 5, 10};
for (i = 0; i < COUNT (snid); i++)
@@ -1600,8 +1541,11 @@ test_case_slot_usage (test_t test)
cp_t cp;
cp_net_t *net;
+ memset (&cp, 0, sizeof (cp_t));
+
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
lib_rnd_init (&cp.rnd, 0x3421);
- cp_sta_mgr_init (&cp);
test_case_begin (test, "Getting the slot usage");
@@ -1633,11 +1577,14 @@ test_case__cp_net_num_sta_associated (test_t test)
cp_t cp;
cp_net_t *net;
cp_sta_t *sta;
+ mac_config_t mac_config;
memset (&cp, 0, sizeof (cp_t));
- mac_config_t mac_config;
- cp.mac_config=&mac_config;
- cp_sta_mgr_init (&cp);
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
+ cp.mac_config = &mac_config;
net = cp_sta_mgr_add_avln (&cp, 1, 1);
@@ -1667,6 +1614,7 @@ test_case__cp_net_num_sta_associated (test_t test)
test_fail_unless (cp_net_num_sta_associated (&cp, net) == 0);
cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
}
test_end;
}
@@ -1686,8 +1634,7 @@ test_suite_sta_mgr (test_t test)
test_case__cp_sta_mgr_set_our_avln__no_net (test);
test_case__cp_sta_mgr_set_our_avln__with_net (test);
test_case__cp_sta_mgr_set_our_avln__with_net_to_unassoc (test);
- test_case__cp_sta_mgr_release_station (test);
- test_case__cp_sta_mgr_partial_ack (test);
+ test_case__cp_eoc_sta_mgr_release_station (test);
test_case__cp_sta_mgr_change_snid (test);
test_case_snid_present (test);
test_case_slot_usage (test);
diff --git a/cesar/cp/eoc/sta/mgr/test/src/station_test.c b/cesar/cp/eoc/sta/mgr/test/utest/src/station_test.c
index 9b90f6c01b..d97cf8a890 100644
--- a/cesar/cp/eoc/sta/mgr/test/src/station_test.c
+++ b/cesar/cp/eoc/sta/mgr/test/utest/src/station_test.c
@@ -12,7 +12,7 @@
*
*/
#include "common/std.h"
-#include "cp/sta/mgr/test/test_sta_mgr.h"
+#include "test_sta_mgr.h"
#include "cp/sta/mgr/inc/sta.h"
diff --git a/cesar/cp/eoc/sta/mgr/test/src/test_sta_mgr.c b/cesar/cp/eoc/sta/mgr/test/utest/src/test_sta_mgr.c
index a5a94c03c4..a3af644711 100644
--- a/cesar/cp/eoc/sta/mgr/test/src/test_sta_mgr.c
+++ b/cesar/cp/eoc/sta/mgr/test/utest/src/test_sta_mgr.c
@@ -11,7 +11,9 @@
* \ingroup cp_sta_mgr
*/
#include "common/std.h"
-#include "cp/sta/mgr/test/test_sta_mgr.h"
+#include "test_sta_mgr.h"
+
+#include "cl/cl_mactotei.h"
static cl_mactotei_t table[10];
static uint table_index;
@@ -20,24 +22,28 @@ void
test_sta_mgr_init (cp_t *cp)
{
static mac_config_t mac_config;
- static cl_t cl;
static sar_t sar;
+ static cl_t cl;
+
memset (&mac_config, 0, sizeof (mac_config));
- memset (&cl, 0, sizeof (cl_t));
memset (&sar, 0, sizeof (sar_t));
memset (cp, 0, sizeof (cp_t));
+ memset (&cl, 0, sizeof (cl_t));
+
cp->mac_config = &mac_config;
cp->cl = &cl;
cp->sar = &sar;
cp->mac_store = sar.mac_store = mac_store_init ();
lib_rnd_init (&cp->rnd, 1234);
- cp_sta_mgr_init (cp);
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (cp);
}
void
test_sta_mgr_uninit (cp_t *cp)
{
cp_sta_mgr_uninit (cp);
+ lib_stats_uninit ();
mac_store_uninit (cp->mac_store);
}
diff --git a/cesar/cp/eoc/sta/mgr/test/test_sta_mgr.h b/cesar/cp/eoc/sta/mgr/test/utest/test_sta_mgr.h
index fa00768521..7faa31ddf9 100644
--- a/cesar/cp/eoc/sta/mgr/test/test_sta_mgr.h
+++ b/cesar/cp/eoc/sta/mgr/test/utest/test_sta_mgr.h
@@ -8,26 +8,22 @@
*
* }}} */
/**
- * \file cp/sta/mgr/test/test_sta_mgr.h
+ * \file cp/eoc/sta/mgr/test/test_sta_mgr.h
* \brief Test environment.
- * \ingroup cp_sta_mgr
+ * \ingroup cp_eoc_sta_mgr_test
*/
#include "lib/test.h"
#include "cp/cp.h"
#include "cp/sta/mgr/sta_mgr.h"
-#include "cp/sta/core/core.h"
#include "mac/common/ntb.h"
#include "mac/common/timings.h"
-#include "mac/sar/sar.h"
-#include "cl/cl.h"
-
-/* Override includes. */
-#include "mac/sar/inc/context.h"
#include "cl/inc/context.h"
+
#include "cp/inc/context.h"
+#include "cp/sta/mgr/inc/net.h"
+#include "mac/sar/inc/context.h"
-#include "cl/cl_mactotei.h"
struct cl_mactotei_t
{