summaryrefslogtreecommitdiff
path: root/cesar/cp/eoc/sta
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/cp/eoc/sta')
-rw-r--r--cesar/cp/eoc/sta/action/Config1
-rw-r--r--cesar/cp/eoc/sta/action/Module8
-rw-r--r--cesar/cp/eoc/sta/action/action.h22
-rw-r--r--cesar/cp/eoc/sta/action/assoc_slave.h229
-rw-r--r--cesar/cp/eoc/sta/action/doc/Makefile48
-rw-r--r--cesar/cp/eoc/sta/action/doc/assoc.sdl41
-rw-r--r--cesar/cp/eoc/sta/action/doc/cp_eoc_sta_action.odtbin0 -> 249905 bytes
-rw-r--r--cesar/cp/eoc/sta/action/drv.h65
-rw-r--r--cesar/cp/eoc/sta/action/inc/assoc.h43
-rw-r--r--cesar/cp/eoc/sta/action/inc/vs.h35
-rw-r--r--cesar/cp/eoc/sta/action/src/action.c36
-rw-r--r--cesar/cp/eoc/sta/action/src/assoc.c35
-rw-r--r--cesar/cp/eoc/sta/action/src/assoc_slave.c683
-rw-r--r--cesar/cp/eoc/sta/action/src/drv.c164
-rw-r--r--cesar/cp/eoc/sta/action/src/poweron.c87
-rw-r--r--cesar/cp/eoc/sta/action/src/vs.c317
-rw-r--r--cesar/cp/eoc/sta/action/stub/Module7
-rw-r--r--cesar/cp/eoc/sta/action/stub/src/action.c19
-rw-r--r--cesar/cp/eoc/sta/action/stub/src/assoc.c21
-rw-r--r--cesar/cp/eoc/sta/action/stub/src/assoc_slave.c176
-rw-r--r--cesar/cp/eoc/sta/action/stub/src/drv.c49
-rw-r--r--cesar/cp/eoc/sta/action/stub/src/poweron.c26
-rw-r--r--cesar/cp/eoc/sta/action/stub/src/vs.c38
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/Makefile12
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/actions-Config13
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/actions-Makefile25
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/actions-override/cp/inc/context.h93
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/actions-override/cp/sta/core/core.h51
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/actions-override/cp/sta/core/defs.h57
-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-Config4
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/fsm-Makefile20
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/fsm-override/cp/inc/context.h35
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/fsm-override/cp/sta/core/core.h26
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/inc/scenario_defs.h283
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/inc/test_sta_action.h56
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/src/actions.c118
-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.c58
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/src/cyg_stub.c40
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/src/fsm_stub.c335
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/src/phy_stub.c26
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/src/test_actions.c1967
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/src/test_fsm.c743
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/Config8
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/Makefile24
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/assoc-Makefile20
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/inc/scenario_defs.h408
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/inc/test_sta_action.h70
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/override/cp/inc/context.h79
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/override/cp/sta/core/core.h38
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/scenario-Config9
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/scenario-Makefile22
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/src/assoc.c461
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/src/beacon_stub.c112
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/src/ce_stub.c24
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/src/core_stub.c42
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/src/cp_stub.c35
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/src/dataplane_stub.c84
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/src/drv.c688
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/src/fsm_stub.c50
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/src/key.c34
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/src/mac_sar_interface_stub.c35
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/src/misc.c2074
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/src/msg_stub.c421
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/src/scenario_actions.c171
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/src/secu.c52
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/src/test_sta_action.c123
-rw-r--r--cesar/cp/eoc/sta/action/vs.h38
-rw-r--r--cesar/cp/eoc/sta/mgr/Config1
-rw-r--r--cesar/cp/eoc/sta/mgr/Module3
-rw-r--r--cesar/cp/eoc/sta/mgr/doc/sta_manager.odtbin0 -> 292047 bytes
-rw-r--r--cesar/cp/eoc/sta/mgr/doc/sta_mgr.xmi1832
-rw-r--r--cesar/cp/eoc/sta/mgr/src/sta_mgr.c572
-rw-r--r--cesar/cp/eoc/sta/mgr/src/sta_own_data.c89
-rw-r--r--cesar/cp/eoc/sta/mgr/sta_mgr.h75
-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/utest/Config5
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/Makefile14
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/doc/Makefile20
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/doc/net.txt190
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/doc/net_list.txt114
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/doc/sta.txt44
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/doc/sta_mgr.txt14
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/doc/sta_own_data.txt111
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/override/cp/cco/action/inc/context.h26
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/override/cp/inc/context.h57
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/override/cp/sta/core/core.h21
-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.h23
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/src/core_stub.c23
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/src/net_test.c225
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/src/sar_stub.c50
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/src/sta-test.c689
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/src/sta_mgr.c1584
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/src/station_test.c431
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/src/test_sta_mgr.c142
-rw-r--r--cesar/cp/eoc/sta/mgr/test/utest/test_sta_mgr.h50
101 files changed, 17975 insertions, 0 deletions
diff --git a/cesar/cp/eoc/sta/action/Config b/cesar/cp/eoc/sta/action/Config
new file mode 100644
index 0000000000..28cb71ccf5
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/Config
@@ -0,0 +1 @@
+CONFIG_CP_EOC_STA_CON_ALLOWED = n \ No newline at end of file
diff --git a/cesar/cp/eoc/sta/action/Module b/cesar/cp/eoc/sta/action/Module
new file mode 100644
index 0000000000..a3c17077dc
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/Module
@@ -0,0 +1,8 @@
+# Common sources
+SOURCES := action.c poweron.c drv.c vs.c assoc.c
+# Slave Sources
+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
new file mode 100644
index 0000000000..ae90ccb28f
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/action.h
@@ -0,0 +1,22 @@
+#ifndef cp_eoc_sta_action_action_h
+#define cp_eoc_sta_action_action_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2009 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eoc/sta/action/action.h
+ * \brief EoC STA public functions.
+ * \ingroup cp_eoc_sta_action
+ *
+ */
+#include "cp/sta/action/action.h"
+
+#include "cp/eoc/sta/action/assoc_slave.h"
+#include "cp/eoc/sta/action/drv.h"
+#include "cp/eoc/sta/action/vs.h"
+
+#endif /* cp_eoc_sta_action_action_h */
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..6c54ed488a
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/assoc_slave.h
@@ -0,0 +1,229 @@
+#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);
+
+/**
+ * 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/doc/Makefile b/cesar/cp/eoc/sta/action/doc/Makefile
new file mode 100644
index 0000000000..053351b0de
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/doc/Makefile
@@ -0,0 +1,48 @@
+PAGES = assoc
+GRAPHS = assoc
+
+DOTFLAGS =
+CONVERTFLAGS = -border 1 -bordercolor '\#d7d7d7'
+
+TOOLS_DIR = ../../../../../common/tools
+DOC_DIR = ../../../../../common/doc
+SDL2DOT = $(TOOLS_DIR)/sdl2dot
+SDLPS = $(TOOLS_DIR)/sdl.ps
+#EXTRACT_DOC = $(DOC_DIR)/extractdoc
+DOX2RST = $(DOC_DIR)/dox2rst
+
+#all: png rst
+all: png
+
+png: $(GRAPHS:%=%.png)
+ps: $(GRAPHS:%=%.ps)
+
+%.png: %.ps
+ convert $(CONVERTFLAGS) $< $@
+
+%.ps: %.dot Makefile
+ dot $(DOTFLAGS) -Tps -l $(SDLPS) -o $@ $<
+
+%.dot: %.sdl
+ $(SDL2DOT) $< > $@
+
+rst: top.rst
+html: png top.html
+odt: top.odt
+
+top.rst: $(PAGES:%=%.rst)
+ cat $^ > $@
+
+%.rst: ../%.h
+ $(EXTRACT_DOC) $< | $(DOX2RST) -s 50 > $@
+
+%.html: %.rst
+ rst2html $< $@
+
+%.odt: %.rst
+ rst2odt.py $< $@
+
+clean:
+ rm -f $(GRAPHS:%=%.ps) $(GRAPHS:%=%.png)
+ rm -f $(PAGES:%=%.rst) $(PAGES:%=%.html)
+ rm -f top.rst top.html top.odt
diff --git a/cesar/cp/eoc/sta/action/doc/assoc.sdl b/cesar/cp/eoc/sta/action/doc/assoc.sdl
new file mode 100644
index 0000000000..681e1b6672
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/doc/assoc.sdl
@@ -0,0 +1,41 @@
+((start)) -> (detecting_beacon)
+
+detecting_beacon:
+(detecting_beacon) -nd beacon -> (associating)
+(detecting_beacon) -nd beacon\n timeout -> (unassociated)
+
+associating:
+(associating) -associating\ntime out -> <:retry?> -y -> (detecting_beacon)
+ <:retry?> -n -> (unassociated)
+(associating) -CC_ASSOC.CNF -> <:result?> -success -> (associated)
+ <:result?> -unsuccess -> (unassociated)
+ <:result?> -unrelated -> (unassociated)
+(associating) -no beacons -> (unassociated)
+
+unassociated:
+(unassociated) -enter sleep_unassociated -> (sleep_unassociated)
+(unassociated) -retry -> (detecting_beacon)
+
+sleep_unassociated:
+(sleep_unassociated) -exit sleep -> (unassociated)
+
+associated:
+(associated) -CC_GET_KEY.CNF -> <:result=key granted> -y -> <:all keys granted?> -y -> (authenticated)
+ <:all keys granted?> -n -> (associated)
+ <:result=key granted> -n -> (unassociated)
+ <:result=key granted> -unrelated -> (unassociated)
+
+(associated) -CM_ENCRYPT_PAYLOAD.RSP -> (unassociated)
+(associated) -authenticating\ntimeout -> (unassociated)
+(associated) -no beacons -> (unassociated)
+(associated) -CC_LEAVE.IND -> (detecting_beacon)
+
+authenticated:
+(authenticated) -CC_SLEEP_ENTER.CNF -> (sleep_authenticated)
+(authenticated) -no beacons -> (unassociated)
+(authenticated) -CC_LEAVE.IND -> (detecting_beacon)
+
+sleep_authenticated:
+(sleep_authenticated) -CC_SLEEP_EXIT.RSP -> (authenticated)
+(sleep_authenticated) -no beacons -> (unassociated)
+
diff --git a/cesar/cp/eoc/sta/action/doc/cp_eoc_sta_action.odt b/cesar/cp/eoc/sta/action/doc/cp_eoc_sta_action.odt
new file mode 100644
index 0000000000..0a85ee703b
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/doc/cp_eoc_sta_action.odt
Binary files differ
diff --git a/cesar/cp/eoc/sta/action/drv.h b/cesar/cp/eoc/sta/action/drv.h
new file mode 100644
index 0000000000..4b5165ad0b
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/drv.h
@@ -0,0 +1,65 @@
+#ifndef cp_eoc_sta_action_drv_h
+#define cp_eoc_sta_action_drv_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2009 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eoc/sta/action/drv.h
+ * \brief Driver messages
+ * \ingroup cp_eoc_sta_action
+ *
+ * Entering and exiting sleep states
+ * ==========================
+ *
+ * This part relates to entering and exiting STA sleep states
+ *
+ * \image html
+ *
+ */
+#include "cp/cp.h"
+#include "cp/mme.h"
+
+BEGIN_DECLS
+
+/**
+ * TODO
+ */
+void
+cp_eoc_sta_action_drv__stopped__drv_sta_set_tonemask_req (
+ cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * TODO
+ */
+void
+cp_eoc_sta_action_drv__stopped__drv_sta_set_key_req (
+ cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * TODO
+ */
+void
+cp_eoc_sta_action_drv__drv_sta_set_slave_config_req (
+ cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * TODO
+ */
+void
+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_eoc_sta_action_drv__drv_sta_get_status_ind (cp_t *ctx);
+
+END_DECLS
+
+#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..f54dd7bd24
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/inc/assoc.h
@@ -0,0 +1,43 @@
+#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 30*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_STA_ASSOC_REQ_OFFSET \
+ ((ctx->mac_config->sta_mac_address >> 40) & 0x1F)
+#define UNASSOC_FAST_RETRY_TIMEOUT_MS 15*1000
+
+#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/src/action.c b/cesar/cp/eoc/sta/action/src/action.c
new file mode 100644
index 0000000000..0f7ccebe8f
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/src/action.c
@@ -0,0 +1,36 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eoc/sta/action/src/action.c
+ * \brief EoC STA action.
+ * \ingroup cp_eoc_sta_action
+ */
+#include "common/std.h"
+
+/* Public headers. */
+#include "ce/tx/tx.h"
+#include "cp/inc/context.h" // cp_t
+#include "cl/cl_eoc_mactotei.h"
+#include "cp/eoc/sta/action/action.h"
+#include "cp/sta/action/action.h"
+
+void
+cp_eoc_sta_action_init (cp_t *ctx)
+{
+ /* Initialize the STA action bridge module. */
+ cp_sta_action_bridge_init (ctx);
+}
+
+void
+cp_eoc_sta_action_garbage (cp_t *ctx)
+{
+ cl_eoc_mactotei_periodic_action (ctx->cl);
+
+ /* Update tone map list for CE in TX. */
+ ce_tx_update_tone_map (ctx);
+}
diff --git a/cesar/cp/eoc/sta/action/src/assoc.c b/cesar/cp/eoc/sta/action/src/assoc.c
new file mode 100644
index 0000000000..cd42c8660c
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/src/assoc.c
@@ -0,0 +1,35 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eoc/sta/action/src/assoc.c
+ * \brief EoC STA action, association related definitions.
+ * \ingroup cp_eoc_sta_action
+ */
+#include "common/std.h"
+
+/* Private headers. */
+#include "cp/inc/context.h"
+#include "cp/eoc/sta/action/inc/assoc.h"
+
+/* Public headers. */
+#include "cp/eoc/sta/action/action.h"
+#include "cp/sta/action/action.h"
+#include "cp/fsm/fsm.h"
+
+#if !CONFIG_CP_EOC_IS_MASTER
+void
+cp_eoc_sta_action_assoc__start_retry_timer (cp_t *ctx)
+{
+ /* only Slave compilation */
+ 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);
+}
+#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..7d91c9d879
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/src/assoc_slave.c
@@ -0,0 +1,683 @@
+/* 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 "mac/common/defs.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);
+ 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);
+ bool send_mme = false;
+
+ /* If sta has been associated set UNASSOCIATED state and remove master. */
+ if (MAC_TEI_IS_EOC_STA (cp_sta_own_data_get_tei (ctx)))
+ {
+ cp_sta_t * sta = NULL;
+ cp_net_t * net = cp_sta_mgr_get_our_avln (ctx);
+ sta = cp_sta_mgr_sta_get_assoc (ctx, net, own_data->tei_track);
+ if (sta)
+ {
+ send_mme = true;
+
+ cp_sta_set_authenticated (ctx, sta, false);
+ cp_sta_mgr_sta_remove (ctx, sta);
+ slab_release (sta);
+ }
+ }
+ cp_sta_own_data_set_authenticated_status (ctx, false);
+ cp_sta_own_data_set_tei (ctx, MAC_TEI_UNASSOCIATED);
+ if (send_mme)
+ cp_eoc_sta_action_drv__drv_sta_get_status_ind (ctx);
+ cp_beacon_process_untracked_avln (ctx);
+ cp_eoc_cco_bw_sta_allocations (ctx);
+}
+
+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);
+}
+
+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_snid_t our_snid = cp_sta_own_data_get_snid (ctx);
+ cp_nid_t our_nid = cp_sta_own_data_get_nid (ctx);
+ cp_snid_t its_snid = cp_net_get_snid (ctx, net);
+ cp_nid_t its_nid = cp_net_get_nid (ctx, net);
+ cp_sta_own_data_t *own_data = cp_sta_mgr_get_sta_own_data (ctx);
+ ctx->sta_action.assoc.beacon_loss = 0;
+
+ if (our_nid == its_nid)
+ {
+ /* Synchronised and tracking the beacon. */
+ if (our_snid == its_snid
+ && own_data->tei_track == beacon->vf.stei
+ && beacon->bmis.mac_address.present
+ && own_data->cco_mac_addr_track
+ == beacon->bmis.mac_address.mac_address
+ && cp_beacon_synchronised (ctx))
+ {
+ if (ctx->sta_action.assoc.init_count > 0)
+ ctx->sta_action.assoc.init_count--;
+ else
+ {
+ cp_sta_get_peer (sta, &ctx->sta_action.assoc.peer);
+ cp_fsm_post_new_event (ctx, bare, nd_beacon);
+ }
+ }
+ /* No tracking track it.. */
+ else if (own_data->tei_track == MAC_TEI_UNASSOCIATED
+ || (our_snid != its_snid
+ && beacon->bmis.mac_address.present
+ && own_data->cco_mac_addr_track
+ == beacon->bmis.mac_address.mac_address))
+ {
+ cp_sta_mgr_set_tracking (ctx, its_snid, its_nid);
+ 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 snid=%d blk=%d"
+ " sar[%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d] pb[%d]\n",
+ auth_time, cp_sta_own_data_get_snid (ctx), blk_free_nb (),
+ SUB_STAT (rx_jobs_nb),
+ ctx->sar->stats.rx_jobs_waiting_nb,
+ SUB_STAT (rx_pb_count),
+ SUB_STAT (pb_data_before_ssn_min),
+ SUB_STAT (pb_data_duplicated),
+ SUB_STAT (pb_mme_before_ssn_min),
+ SUB_STAT (pb_mme_duplicated),
+ SUB_STAT (rx_pb_crc_error_count),
+ SUB_STAT (mfs_tx_data_pb_expired_nb),
+ SUB_STAT (mfs_rx_data_pb_expired_nb),
+ SUB_STAT (mfs_tx_mme_pb_expired_nb),
+ SUB_STAT (mfs_rx_mme_pb_expired_nb),
+ 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)
+{
+ cp_sta_own_data_t *own = cp_sta_mgr_get_sta_own_data (ctx);
+ own->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);
+ cp_sta_own_data_t *own = cp_sta_mgr_get_sta_own_data (ctx);
+ if (!cp_msg_cc_assoc_cnf_receive (ctx, mme, &cnf)
+ || !cp_mme_peer_cmp (&ctx->sta_action.assoc.peer, &mme->peer)
+ || (cp_sta_own_data_get_nid (ctx) != cnf.nid))
+ {
+ /* Unrelated message, drop it. */
+ cp_fsm_branch (ctx, ASSOCIATING, CC_ASSOC_CNF, unrelated);
+ }
+ else if ((cnf.result != CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS)
+ &&
+ (cnf.result != CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS_WL_ACCEPT_ALL))
+ {
+ /* Negative result, station not associated */
+ ctx->sta_action.assoc.fast_retry =
+ cnf.result ==
+ CP_MSG_CC_ASSOC_CNF_RESULT_FAILURE_TEMPORARY_RESSOURCE_EXHAUSTION;
+ own->num_bad_assoc_failure ++;
+ cp_fsm_branch (ctx, ASSOCIATING, CC_ASSOC_CNF, unsuccess);
+ }
+ else
+ {
+ /* change dak and result */
+ if (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 (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));
+
+ ctx->sta_action.assoc.fast_retry = false;
+ /* Update state. */
+ cp_sta_own_data_set_tei (ctx, cnf.sta_tei);
+ /* Change our AVLN. */
+ cp_sta_t *sta =
+ cp_sta_mgr_sta_get_from_mac (
+ ctx, ctx->sta_action.assoc.peer.mac);
+ dbg_assert (sta);
+ cp_sta_mgr_set_our_avln (ctx, cp_sta_get_net (sta));
+ slab_release (sta);
+
+ /* 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 */
+ uint i;
+ for (i = 0; i < MAC_CAP_NB; i++)
+ {
+ mfs = mac_store_mfs_add_tx (ctx->mac_store, false, false,
+ MAC_LLID_MIN + i,
+ mme->peer.tei, &added);
+ if (added)
+ sar_mfs_add (ctx->sar, (mfs_t *)mfs);
+ if (mfs)
+ {
+ mfs->cap = i;
+ 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");
+ 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_beacon_change_nek (ctx, cnf.eks, cnf.key, true);
+ /*STA is authenticated data can be transferred */
+ uint i;
+ for (i = 0; i < MAC_CAP_NB; i++)
+ {
+ mfs = mac_store_mfs_add_tx (ctx->mac_store, false, false,
+ MAC_LLID_MIN + i,
+ mme->peer.tei, &added);
+ if (added)
+ sar_mfs_add (ctx->sar, (mfs_t *)mfs);
+ if (mfs)
+ {
+ mfs->cap = i;
+ blk_release (mfs);
+ }
+ }
+ /* Signal joined state.
+ * TODO: cp_fsm_trigger_new_event (ctx, bare, joined); */
+ /* Reset beacon loss counter. */
+ cp_sta_own_data_t *own = cp_sta_mgr_get_sta_own_data (ctx);
+ ctx->sta_action.assoc.beacon_loss = 0;
+ cp_fsm_branch (ctx, ASSOCIATED, CM_GET_KEY_CNF, all_keys_granted);
+ own->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);
+ cp_sta_own_data_set_authenticated_status (ctx, true);
+ 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)
+{
+ cp_sta_own_data_t *own = cp_sta_mgr_get_sta_own_data (ctx);
+ own->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;
+
+ cp_sta_own_data_t *own = cp_sta_mgr_get_sta_own_data (ctx);
+ own->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;
+
+ cp_sta_own_data_t *own = cp_sta_mgr_get_sta_own_data (ctx);
+ own->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,
+ (ctx->sta_action.assoc.fast_retry) ?
+ UNASSOC_FAST_RETRY_TIMEOUT_MS :
+ 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)
+ {
+ cp_sta_own_data_set_output_level (ctx, output_level);
+ cp_mme_peer_t peer;
+ peer.tei = MAC_TEI_FOREIGN;
+ peer.mac = cp_sta_own_data_get_mac_address (ctx);
+ peer.eth_type = HPAV_MTYPE_MME;
+ peer.vlan_tci = 0;
+ /* Get the output level stored. */
+ output_level = cp_sta_own_data_get_output_level (ctx);
+ cp_msg_vs_eoc_cco_set_out_lev_ind_send (ctx, &peer, output_level);
+ DBG_PRINT_2 ("out_lev = %d", 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/drv.c b/cesar/cp/eoc/sta/action/src/drv.c
new file mode 100644
index 0000000000..33f024faa5
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/src/drv.c
@@ -0,0 +1,164 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eoc/sta/action/src/drv.c
+ * \brief EoC STA action, driver related definitions.
+ * \ingroup cp_eoc_sta_action
+ */
+#include "common/std.h"
+
+/* Private headers. */
+#include "cp/inc/context.h"
+
+/* Public headers. */
+#include "cp/sta/action/action.h"
+#include "cp/msg/msg.h"
+#include "cp/eoc/cco/bw/bw.h"
+#include "ce/rx/rx.h"
+
+/* Config headers. */
+#include "config/cp/msg/eoc.h"
+
+
+void
+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));
+#else
+ /* TODO. */
+#endif
+ 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 will be programmed once the PBProc is activated. */
+ tonemask_update (&ctx->mac_config->tonemask_info);
+ ce_rx_init_tonemask (ctx->ce_rx);
+ }
+ 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);
+}
+
+void
+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;
+ cp_nid_t nid;
+ cp_security_level_t sl;
+
+ 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)
+ {
+ /* Build NID from SL and NMK. */
+ cp_sta_own_data_set_security_level (ctx, sl);
+ nid = cp_secu_nmk2nid (ctx, nmk, sl);
+ }
+ /* Always setup NID. */
+ cp_sta_own_data_set_nid (ctx, nid);
+ dbg_do (
+ if (type == CP_MSG_DRV_STA_SET_KEY_TYPE_CHANGE_SECURITY_LEVEL)
+ dbg_assert (sl == cp_sta_own_data_get_security_level (ctx));
+ );
+
+ /* Reply with success. */
+ cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_KEY_CNF,
+ CP_MSG_DRV_RESULT_SUCCESS);
+ }
+ else
+ {
+ /* Error in decoding, let's reply with an error. */
+ cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_KEY_CNF,
+ CP_MSG_DRV_RESULT_FAILURE);
+ }
+}
+
+void
+cp_eoc_sta_action_drv__drv_sta_set_slave_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_slave_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_EOC_STA_SET_SLAVE_CONFIG_CNF,
+ result);
+}
+
+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;
+ dbg_assert (ctx);
+ dbg_assert (mme);
+
+ if (cp_msg_drv_sta_set_eoc_req_receive (ctx, mme, &exp, &value))
+ {
+ result = CP_MSG_DRV_RESULT_SUCCESS;
+ phy_tx_scale_adapt_exp_set (ctx->phy, exp);
+ 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);
+}
+
+void
+cp_eoc_sta_action_drv__drv_sta_get_status_ind (cp_t *ctx)
+{
+ dbg_assert(ctx);
+ cp_msg_drv_sta_status_status_t state =
+ CP_MSG_DRV_STA_STATUS_STATUS_UNASSOC;
+
+ 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;
+ if (cp_sta_own_data_get_tei (ctx))
+ state = CP_MSG_DRV_STA_STATUS_STATUS_ASSOC;
+ if (cp_sta_own_data_get_authenticated_status (ctx))
+ state = CP_MSG_DRV_STA_STATUS_STATUS_AUTH;
+ cp_msg_drv_get_status_ind_send (ctx, &peer, DRV_STA_STATUS_IND, state);
+}
diff --git a/cesar/cp/eoc/sta/action/src/poweron.c b/cesar/cp/eoc/sta/action/src/poweron.c
new file mode 100644
index 0000000000..3a8926927d
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/src/poweron.c
@@ -0,0 +1,87 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \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"
+
+/* Private headers. */
+#include "cp/inc/context.h"
+
+/* Public headers. */
+#include "cp/defs.h"
+#include "cp/eoc/cco/bw/bw.h"
+#include "cp/sta/action/action.h"
+#include "cp/sta/mgr/sta_mgr.h"
+#include "cp/beacon/beacon.h"
+
+/*
+ * Initial settings for all Master and slave
+ * \param ctx the module context.
+ */
+PRIVATE void
+cp_eoc_sta_action__power_on_no_beacons (cp_t *ctx)
+{
+ cp_net_t *net;
+ cp_nid_t nid;
+ cp_snid_t snid;
+ cp_sta_own_data_t *own;
+ dbg_assert (ctx);
+
+ cp_sta_own_data_set_tei (ctx, MAC_TEI_UNASSOCIATED);
+ cp_sta_own_data_set_authenticated_status (ctx, false);
+
+ /* Set our AVLN. */
+ snid = cp_sta_own_data_get_snid (ctx);
+ nid = cp_sta_own_data_get_nid (ctx);
+
+ net = cp_sta_mgr_add_avln (ctx, snid, nid);
+ cp_sta_mgr_set_our_avln (ctx, net);
+
+ /* Set the CCo status in the station own data. */
+ own = cp_sta_mgr_get_sta_own_data (ctx);
+ own->nid_track = cp_sta_own_data_get_nid (ctx);
+ cp_sta_own_data_set_cco_status (ctx, false);
+ own->tei_track = MAC_TEI_UNASSOCIATED;
+ /* set start values */
+ ctx->sta_action.assoc.retry = 0;
+ ctx->sta_action.assoc.beacon_loss = 0;
+}
+
+void
+cp_eoc_sta_action_poweron__many__to_idle (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ /* Cleanup. */
+ pbproc_activate (ctx->pbproc, false);
+ sar_activate (ctx->sar, false);
+ sar_cleanup (ctx->sar);
+ cp_beacon_deactivate (ctx);
+ /* Signal station is stopped. */
+ cp_fsm_trigger_new_event (ctx, bare, stopped);
+}
+
+void
+cp_eoc_sta_action_poweron__idle__to_poweron (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ cp_eoc_sta_action__power_on_no_beacons (ctx);
+ cp_eoc_cco_bw_sta_allocations (ctx);
+ cp_beacon_poweron_init (ctx);
+ bsu_power_on (ctx->bsu, cp_sta_own_data_get_snid (ctx));
+ bsu_activate (ctx->bsu, true);
+ /* force beacon tracking on startup */
+ cp_beacon_process_untracked_avln (ctx);
+ cp_beacon_reconfigure_timer (ctx, false);
+ sar_activate (ctx->sar, true);
+ pbproc_activate (ctx->pbproc, true);
+ ctx->sta_action.assoc.peer = CP_MME_PEER (MAC_BROADCAST,
+ MAC_TEI_UNASSOCIATED);
+}
diff --git a/cesar/cp/eoc/sta/action/src/vs.c b/cesar/cp/eoc/sta/action/src/vs.c
new file mode 100644
index 0000000000..f34d1d6228
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/src/vs.c
@@ -0,0 +1,317 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eoc/sta/action/src/vs.c
+ * \brief Vendor Specific EoC definitions.
+ * \ingroup cp_eoc_sta_action
+ */
+#include "common/std.h"
+
+/* Private headers. */
+#include "cp/eoc/sta/action/inc/vs.h"
+#include "cp/inc/context.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"
+
+/* 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__vs_eoc_get_info_req (
+ cp_t *ctx, cp_mme_rx_t *mme)
+{
+ dbg_assert(ctx);
+ dbg_assert(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;
+ u8 internal_eoc_index;
+ u8 control;
+ u16 tei = 0;
+ s8 attenuation = 0;
+ u8 snr = 0;
+ u8 snr_sum = 0;
+ u16 phy_uplink_speed = 0;
+ u16 phy_downlink_speed = 0;
+ u8 output_power = 0;
+ u32 tx_success_counter = 0;
+ u32 tx_crc_error_counter = 0;
+ u32 tx_other_error_counter = 0;
+ u32 rx_success_counter = 0;
+ u32 rx_crc_error_counter = 0;
+ u32 rx_other_error_counter = 0;
+
+ 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);
+ if (sta)
+ {
+ if (sta->authenticated)
+ {
+ snr_sum = ce_rx_bl_nsr_compute_total_mean (
+ &sta->ce_rx_bt);
+ snr = 10 * log (snr_sum);
+ attenuation = sta->agc_gain;
+ }
+ 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;
+ }
+
+ output_power = ctx->sta_mgr.sta_own_data.output_level;
+ if (control == 1)
+ {
+ ctx->pbproc->stats.tx_data = 0;
+ ctx->pbproc->stats.tx_data_cancel = 0;
+ ctx->pbproc->stats.tx_data_wack_noack = 0;
+ ctx->pbproc->stats.rx_data = 0;
+ 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;
+ /* 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;
+ }
+ else
+ {
+ 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);
+}
+
+void
+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;
+ u8 internal_eoc_index;
+ u8 control;
+ u8 assoc_stat = 0;
+ u64 nid = 0;
+ u8 num_slots = 0;
+ mac_t he_mac_address = 0;
+ u16 est_avg_phy_rate = 0;
+ u8 num_good_assoc_auth = 0;
+ u16 num_bad_could_not_assoc = 0;
+ u32 num_bad_assoc_failure = 0;
+ u32 num_bad_could_not_auth = 0;
+ u32 num_leave = 0;
+ cp_sta_own_data_t *own = cp_sta_mgr_get_sta_own_data (ctx);
+
+ 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)
+ {
+ assoc_stat = 0;
+ }
+ else if (!ctx->mac_config->authenticated)
+ {
+ assoc_stat = 1;
+ }
+ else
+ {
+ assoc_stat = 2;
+ }
+
+ nid = ctx->sta_mgr.our_avln->nid;
+ num_slots = 1;
+ he_mac_address = ctx->sta_action.assoc.peer.mac;
+ est_avg_phy_rate = 0;
+
+ if (control == 1)
+ {
+ own->num_good_assoc_auth = 0;
+ own->num_bad_could_not_assoc = 0;
+ own->num_bad_assoc_failure = 0;
+ own->num_bad_could_not_auth = 0;
+ own->num_leave = 0;
+ }
+ num_good_assoc_auth = own->num_good_assoc_auth;
+ num_bad_could_not_assoc = own->num_bad_could_not_assoc;
+ num_bad_assoc_failure = own->num_bad_assoc_failure;
+ num_bad_could_not_auth = own->num_bad_could_not_auth;
+ num_leave = own->num_leave;
+ }
+ else
+ {
+ 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);
+}
+
+void
+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;
+ u8 clear = 0;
+ static bool init = false;
+ real_time_stats_t rt_stats;
+ static real_time_stats_t rt_stats_offset;
+ static uint rx_pb_count_offset = 0;
+ if (!init)
+ {
+ memset (&rt_stats, 0x0, sizeof (real_time_stats_t));
+ memset (&rt_stats_offset, 0x0, sizeof (real_time_stats_t));
+ init = true;
+ }
+ uint num;
+ uint div;
+
+ dbg_assert(ctx);
+ dbg_assert(mme);
+
+ ok = cp_msg_vs_eoc_cco_get_real_time_stats_req_receive (ctx, mme, &clear);
+
+ if (ok)
+ {
+ if (clear == 1)
+ {
+ memset (&rt_stats, 0x0, sizeof (real_time_stats_t));
+
+ rt_stats_offset.nb_unicast_packets_rx =
+ ctx->pbproc->stats.rx_data;
+ rt_stats_offset.nb_unicast_packets_tx =
+ ctx->pbproc->stats.tx_data_wack;
+ rt_stats_offset.nb_broadcast_packets_rx =
+ ctx->pbproc->stats.rx_data_woack
+ + ctx->pbproc->stats.rx_beacon;
+ rt_stats_offset.nb_broadcast_packets_tx =
+ ctx->pbproc->stats.tx_data_woack
+ + ctx->pbproc->stats.tx_data_beacon;
+ rt_stats_offset.nb_packets_rx_discarded =
+ ctx->pbproc->stats.rx_data_error;
+ rt_stats_offset.total_nb_bytes_rx =
+ ctx->cl->stats.rx_data_bytes;
+ rt_stats_offset.total_nb_bytes_tx =
+ ctx->cl->stats.tx_data_bytes;
+ rt_stats_offset.nb_packets_rx_short =
+ ctx->pbproc->stats.rx_data_empty;
+ rt_stats_offset.nb_packets_tx_short =
+ ctx->pbproc->stats.tx_data_empty;
+ rt_stats_offset.nb_packets_tx_dropped =
+ ctx->pbproc->stats.tx_data_cancel
+ + ctx->pbproc->stats.tx_late;
+ rt_stats_offset.nb_multicast_packets_rx =
+ 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;
+ rt_stats_offset.nb_packets_rx_crc =
+ ctx->sar->stats.rx_pb_crc_error_count;
+ rx_pb_count_offset = ctx->sar->stats.rx_pb_count;
+#else /* CONFIG_STATS */
+ rt_stats_offset.avg_pre_fec_bit_error_rate = 0;
+ rt_stats_offset.nb_packets_rx_crc = 0;
+ rx_pb_count_offset = 0;
+#endif /* CONFIG_STATS */
+ }
+ RT_STATS_OFFSET (nb_unicast_packets_rx,
+ ctx->pbproc->stats.rx_data);
+ RT_STATS_OFFSET (nb_unicast_packets_tx,
+ ctx->pbproc->stats.tx_data_wack);
+ RT_STATS_OFFSET (total_nb_bytes_rx,
+ ctx->cl->stats.rx_data_bytes);
+ RT_STATS_OFFSET (total_nb_bytes_tx,
+ ctx->cl->stats.tx_data_bytes);
+ RT_STATS_OFFSET (nb_broadcast_packets_rx,
+ ctx->pbproc->stats.rx_data_woack
+ + ctx->pbproc->stats.rx_beacon);
+ RT_STATS_OFFSET (nb_broadcast_packets_tx,
+ ctx->pbproc->stats.tx_data_woack
+ + ctx->pbproc->stats.tx_data_beacon);
+ RT_STATS_OFFSET (nb_multicast_packets_rx,
+ ctx->cl->stats.rx_data_multicast);
+ RT_STATS_OFFSET (nb_multicast_packets_tx,
+ ctx->cl->stats.tx_data_multicast);
+ RT_STATS_OFFSET (nb_packets_rx_short,
+ ctx->pbproc->stats.rx_data_empty);
+ RT_STATS_OFFSET (nb_packets_tx_short,
+ ctx->pbproc->stats.tx_data_empty);
+ RT_STATS_OFFSET (nb_packets_tx_dropped,
+ ctx->pbproc->stats.tx_data_cancel
+ + ctx->pbproc->stats.tx_late);
+ RT_STATS_OFFSET (nb_packets_rx_discarded,
+ ctx->pbproc->stats.rx_data_error);
+#if CONFIG_STATS
+ RT_STATS_OFFSET (nb_packets_rx_crc,
+ ctx->sar->stats.rx_pb_crc_error_count);
+ num = (ctx->sar->stats.ber_sum
+ - rt_stats_offset.avg_pre_fec_bit_error_rate);
+ div = ((ctx->sar->stats.rx_pb_count - rx_pb_count_offset)
+ - rt_stats.nb_packets_rx_crc) * MAC_PB520_BYTES * 8;
+ if (div != 0)
+ rt_stats.avg_pre_fec_bit_error_rate = (num * 10000) / div;
+ else
+ rt_stats.avg_pre_fec_bit_error_rate = 0;
+#else /* CONFIG_STATS */
+ rt_stats.nb_packets_rx_crc = 0;
+ rt_stats.avg_pre_fec_bit_error_rate = 0;
+#endif /* CONFIG_STATS */
+ }
+ else
+ {
+ status = CP_MSG_VS_EOC_GET_REAL_TIME_STATISTICS_REQ_RESULT_FAILURE;
+ }
+ cp_msg_vs_eoc_cco_get_real_time_stats_cnf_send (ctx, &mme->peer, status,
+ &rt_stats);
+}
diff --git a/cesar/cp/eoc/sta/action/stub/Module b/cesar/cp/eoc/sta/action/stub/Module
new file mode 100644
index 0000000000..3220ccf47b
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/stub/Module
@@ -0,0 +1,7 @@
+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
new file mode 100644
index 0000000000..eecda50828
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/stub/src/action.c
@@ -0,0 +1,19 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2011 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eoc/sta/action/stub/src/action.c
+ * \brief Station action stubs.
+ * \ingroup cp_eoc_sta_action_stub
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+
+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..34c1b5ef5a
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/stub/src/assoc.c
@@ -0,0 +1,21 @@
+/* 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__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..1421b55ae7
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/stub/src/assoc_slave.c
@@ -0,0 +1,176 @@
+/* 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_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/drv.c b/cesar/cp/eoc/sta/action/stub/src/drv.c
new file mode 100644
index 0000000000..07ba901b0a
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/stub/src/drv.c
@@ -0,0 +1,49 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eoc/sta/action/stub/src/drv.c
+ * \brief STA action, driver related definitions.
+ * \ingroup cp_eoc_sta_action_stub
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+#include "cp/mme.h"
+
+void
+cp_eoc_sta_action_drv__stopped__drv_sta_set_tonemask_req (
+ cp_t *ctx, cp_mme_rx_t *mme) __attribute__((weak));
+void
+cp_eoc_sta_action_drv__stopped__drv_sta_set_tonemask_req (
+ cp_t *ctx, cp_mme_rx_t *mme) {}
+
+void
+cp_eoc_sta_action_drv__stopped__drv_sta_set_key_req (
+ cp_t *ctx, cp_mme_rx_t *mme) __attribute__((weak));
+void
+cp_eoc_sta_action_drv__stopped__drv_sta_set_key_req (
+ cp_t *ctx, cp_mme_rx_t *mme) {}
+
+void
+cp_eoc_sta_action_drv__drv_sta_set_slave_config_req (
+ cp_t *ctx, cp_mme_rx_t *mme) __attribute__((weak));
+void
+cp_eoc_sta_action_drv__drv_sta_set_slave_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) __attribute__((weak));
+void
+cp_eoc_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_get_status_ind (cp_t *ctx)
+ __attribute__((weak));
+void
+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
new file mode 100644
index 0000000000..29ec7b6b2a
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/stub/src/poweron.c
@@ -0,0 +1,26 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2009 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eoc/sta/action/stub/src/poweron.c
+ * \brief STA action, poweron related definitions.
+ * \ingroup cp_eoc_sta_action_stub
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+
+void
+cp_eoc_sta_action_poweron__many__to_idle (cp_t *ctx)
+ __attribute__((weak));
+void
+cp_eoc_sta_action_poweron__many__to_idle (cp_t *ctx) {}
+
+void
+cp_eoc_sta_action_poweron__idle__to_poweron (cp_t *ctx)
+ __attribute__((weak));
+void
+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/Makefile b/cesar/cp/eoc/sta/action/test/utest/Makefile
new file mode 100644
index 0000000000..b238673cdd
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest/Makefile
@@ -0,0 +1,12 @@
+all: fsm actions
+
+fsm: fsm-Makefile
+ make -f fsm-Makefile
+
+actions: actions-Makefile
+ make -f actions-Makefile
+
+clean: fsm-Makefile actions-Makefile
+ make -f fsm-Makefile clean
+ make -f actions-Makefile clean
+ rmdir obj
diff --git a/cesar/cp/eoc/sta/action/test/utest/actions-Config b/cesar/cp/eoc/sta/action/test/utest/actions-Config
new file mode 100644
index 0000000000..64ad77436f
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest/actions-Config
@@ -0,0 +1,13 @@
+CONFIG_CP_EOC = y
+CONFIG_CP_MSG_EOC_DRV_MME = y
+CONFIG_DEBUG_FATAL_CATCH = y
+CONFIG_CP_FSM_DEF = "cp/eoc/fsm/src/fsm/cp_eoc_sta.fsm"
+CONFIG_GPIO_LED_TRAFFIC = y
+CONFIG_MAC_PBPROC_EOC_FC = y
+CONFIG_MAC_COMMON_EOC_TONEMASK = y
+CONFIG_CP_EOC_STA_CON_ALLOWED = n
+CONFIG_MAC_COMMON_EOC_SCHED = y
+CONFIG_MAC_COMMON_EOC_TEI = y
+CONFIG_RESTRACK = y
+CONFIG_MAC_COMMON_EOC_MFS = y
+CONFIG_CL_EOC_ROUTE = y
diff --git a/cesar/cp/eoc/sta/action/test/utest/actions-Makefile b/cesar/cp/eoc/sta/action/test/utest/actions-Makefile
new file mode 100644
index 0000000000..5a537081c6
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest/actions-Makefile
@@ -0,0 +1,25 @@
+BASE = ../../../../../..
+
+DEFS = -DNO_PRIVATE
+
+VARIANT = actions
+
+INCLUDES = cp/eoc/sta/action/test/utest/actions-override
+
+HOST_PROGRAMS = test_actions
+
+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/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
new file mode 100644
index 0000000000..20ec0c03c5
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest/actions-override/cp/inc/context.h
@@ -0,0 +1,93 @@
+#ifndef override_cp_inc_context_h
+#define override_cp_inc_context_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file override/cp/inc/context.h
+ * \brief Control plane context override.
+ * \ingroup test
+ */
+
+#include "cp/fsm/fsm.h"
+#include "cp/fsm/inc/tables.h"
+#include "cp/fsm/inc/context.h"
+#include "cp/inc/trace.h"
+#include "cp/sta/mgr/sta_mgr.h"
+#include "cp/sta/mgr/inc/sta_mgr.h"
+#include "mac/common/config.h"
+#include "mac/common/store.h"
+#include "cp/sta/core/defs.h"
+#include "cp/sta/action/inc/context.h"
+#include "cp/msg/inc/context.h"
+#include "lib/rnd.h"
+#include "interface/interface.h"
+#include "mac/sar/sar.h"
+#include "mac/sar/inc/context.h"
+#include "cl/cl.h"
+#include "cl/inc/context.h"
+#include "cp/cl_interf/cl_interf.h"
+#include "cp/cl_interf/inc/context.h"
+#include "hal/phy/phy.h"
+#include "cp/eoc/beacon/inc/beacon.h"
+#include "cp/eoc/beacon/beacon.h"
+#include "ce/tx/inc/tx.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
+
+struct cp_t
+{
+#if CONFIG_TRACE
+ /** Trace context. */
+ trace_buffer_t trace;
+#endif /* CONFIG_TRACE */
+
+ /** FSM context. */
+ cp_fsm_t fsm;
+ /** STA core flag. */
+ bool sta_core_flag;
+ /** STA core urgent flag. */
+ bool sta_core_urgent_flag;
+ /** station manager context*/
+ cp_sta_mgr_t sta_mgr;
+ /** MAC config contest*/
+ mac_config_t *mac_config;
+ cp_sta_action_t sta_action;
+ cp_msg_t msg;
+ lib_rnd_t rnd;
+ interface_t *interface;
+ /** Mac store /dataplane */
+ mac_store_t *mac_store;
+ /** Convergence Layer context */
+ cl_t *cl;
+ /** Segmentation and reassembly context */
+ sar_t *sar;
+ /** PBProc. */
+ pbproc_t *pbproc;
+ 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;
+ ce_rx_t *ce_rx;
+
+ bsu_t *bsu;
+ cp_cco_action_t cco_action;
+
+
+ /** Buffer manager. */
+ bufmgr_t *bufmgr;
+};
+
+
+#endif /* override_cp_inc_context_h */
diff --git a/cesar/cp/eoc/sta/action/test/utest/actions-override/cp/sta/core/core.h b/cesar/cp/eoc/sta/action/test/utest/actions-override/cp/sta/core/core.h
new file mode 100644
index 0000000000..a4d6eda352
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest/actions-override/cp/sta/core/core.h
@@ -0,0 +1,51 @@
+#ifndef override_cp_sta_core_core_h
+#define override_cp_sta_core_core_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file override/cp/sta/core/core.h
+ * \brief STA Core override.
+ * \ingroup test
+ */
+
+#include "cp/inc/context.h"
+
+BEGIN_DECLS
+
+void
+cp_sta_core_signal_fsm_event (cp_t *ctx);
+
+void
+cp_sta_core_signal_fsm_urgent_event (cp_t *ctx);
+
+u32
+cp_sta_core_get_date_ms (cp_t *ctx);
+
+void
+cp_sta_core_signal_recv_mme_event (cp_t *cp_ctx);
+
+void
+cp_sta_core_checkpoint (cp_t *ctx);
+
+void
+cp_sta_core_gen_timed_event (
+ cp_t *cp_ctx, cp_sta_core_timed_event_def_t *sta_core_timed_event,
+ cp_fsm_event_t *fsm_event, uint event_delay_ms);
+
+void
+cp_sta_core_stop_timed_or_cyclic_event(
+ cp_t *cp_ctx, cp_sta_core_timed_event_def_t *sta_core_timed_event);
+
+int
+cp_sta_core_ms_to_cyg_tick (cp_t *ctx, const uint ms);
+
+u32
+cp_sta_core_tck_per_rtc (cp_t *ctx);
+END_DECLS
+
+#endif /* override_cp_sta_core_core_h */
diff --git a/cesar/cp/eoc/sta/action/test/utest/actions-override/cp/sta/core/defs.h b/cesar/cp/eoc/sta/action/test/utest/actions-override/cp/sta/core/defs.h
new file mode 100644
index 0000000000..9698b44e93
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest/actions-override/cp/sta/core/defs.h
@@ -0,0 +1,57 @@
+#ifndef cp_sta_core_defs_h
+#define cp_sta_core_defs_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/core/defs.h
+ * \brief Sta core defs.
+ * \ingroup cp/sta/core
+ *
+ */
+#include "cp/fsm/forward.h"
+
+/** Forward declaration. */
+typedef struct cp_sta_core_t cp_sta_core_t;
+
+/*
+ * the sta core event flags
+ * these are some flags, so take care to give a value with all bits set to 0 but one.
+ */
+enum cp_sta_core_event_flag_t
+{
+ CP_STA_CORE_EVENT_FLAG_RECV_BEACON = 0x1,
+ CP_STA_CORE_EVENT_FLAG_RECV_MME = 0x2,
+ CP_STA_CORE_EVENT_FLAG_FSM = 0x4,
+ CP_STA_CORE_EVENT_FLAG_GARBAGE = 0x8,
+ CP_STA_CORE_EVENT_FLAG_TERMINATE = 0x10
+};
+typedef enum cp_sta_core_event_flag_t cp_sta_core_event_flag_t;
+
+/** Definition of alarm info structure
+ * (applications should not use it directly but use "alias" defined just below) */
+struct cp_sta_core_timed_event_def_t
+{
+ /* eCos alarm. */
+ uint alarm;
+ /* eCos alarm handle. */
+ uint alarm_handle;
+ /* the sta core event flag to set
+ * (auto or user-specified when creating/launching timer alarm). */
+ cp_sta_core_event_flag_t event_flag;
+ /* FSM event specified when creating/launching timer alarm
+ * (set if the previous flag is CP_STA_CORE_EVENT_FLAG_FSM). */
+ cp_fsm_event_t *fsm_event;
+ /* flag indicating a periodic alarm (if set to true)
+ * or one-shot alarm (if set to false). */
+ bool cyclic_alarm;
+ /* pointer to CP context. */
+ cp_t *cp_ctx;
+};
+typedef struct cp_sta_core_timed_event_def_t cp_sta_core_timed_event_def_t;
+
+#endif /* cp_sta_core_defs_h */
diff --git a/cesar/cp/eoc/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
new file mode 100644
index 0000000000..8e23e37b10
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest/fsm-Config
@@ -0,0 +1,4 @@
+CONFIG_CP_EOC = y
+CONFIG_CP_MSG_EOC_DRV_MME = y
+CONFIG_DEBUG_FATAL_CATCH = y
+CONFIG_CP_FSM_DEF = "cp/eoc/fsm/src/fsm/cp_eoc_sta.fsm"
diff --git a/cesar/cp/eoc/sta/action/test/utest/fsm-Makefile b/cesar/cp/eoc/sta/action/test/utest/fsm-Makefile
new file mode 100644
index 0000000000..25ea0aa7ba
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest/fsm-Makefile
@@ -0,0 +1,20 @@
+BASE = ../../../../../..
+
+DEFS = -DNO_PRIVATE
+
+VARIANT = fsm
+
+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 actions.c fsm_stub.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/eoc mac/common cl mac/sar
+
+include $(BASE)/common/make/top.mk
+
diff --git a/cesar/cp/eoc/sta/action/test/utest/fsm-override/cp/inc/context.h b/cesar/cp/eoc/sta/action/test/utest/fsm-override/cp/inc/context.h
new file mode 100644
index 0000000000..edc1fde804
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest/fsm-override/cp/inc/context.h
@@ -0,0 +1,35 @@
+#ifndef override_cp_inc_context_h
+#define override_cp_inc_context_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file override/cp/inc/context.h
+ * \brief Control plane context override.
+ * \ingroup test
+ */
+
+#include "cp/fsm/fsm.h"
+#include "cp/fsm/inc/context.h"
+#include "cp/inc/trace.h"
+
+struct cp_t
+{
+#if CONFIG_TRACE
+ /** Trace context. */
+ trace_buffer_t trace;
+#endif /* CONFIG_TRACE */
+
+ /** FSM context. */
+ cp_fsm_t fsm;
+ /** STA core flag. */
+ bool sta_core_flag;
+ /** STA core urgent flag. */
+ bool sta_core_urgent_flag;
+};
+
+#endif /* override_cp_inc_context_h */
diff --git a/cesar/cp/eoc/sta/action/test/utest/fsm-override/cp/sta/core/core.h b/cesar/cp/eoc/sta/action/test/utest/fsm-override/cp/sta/core/core.h
new file mode 100644
index 0000000000..352368b45b
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest/fsm-override/cp/sta/core/core.h
@@ -0,0 +1,26 @@
+#ifndef override_cp_sta_core_core_h
+#define override_cp_sta_core_core_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file override/cp/sta/core/core.h
+ * \brief STA Core override.
+ * \ingroup test
+ */
+
+BEGIN_DECLS
+
+void
+cp_sta_core_signal_fsm_event (cp_t *ctx);
+
+void
+cp_sta_core_signal_fsm_urgent_event (cp_t *ctx);
+
+END_DECLS
+
+#endif /* override_cp_sta_core_core_h */
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
new file mode 100644
index 0000000000..aa3a8d1e5e
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest/inc/scenario_defs.h
@@ -0,0 +1,283 @@
+#ifndef inc_scenario_defs_h
+#define inc_scenario_defs_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file inc/scenario_defs.h
+ * \brief Scenario definitions.
+ * \ingroup test
+ */
+
+#include "cp/types.h"
+#include "cp/mme.h"
+#include "cp/fsm/fsm.h"
+
+#include "cp/msg/msg.h"
+#include "cp/sta/mgr/sta.h"
+#include "cp/sta/mgr/net.h"
+#include "cp/fsm/fsm.h"
+#include "cl/cl_mactotei.h"
+#include "mac/common/tonemap.h"
+
+/* Scenario globals. */
+#define SCENARIO_DEFS_GLOBALS \
+ cp_t *cp;\
+ u16 prn; \
+ u32 my_nonce; \
+ u32 your_nonce; \
+ cp_mme_tx_t *mme;
+
+/* Scenario actions. */
+#define SCENARIO_DEFS_ACTIONS \
+ post_and_process, \
+ post, \
+ trigger, \
+ post_urgent, \
+ process, \
+ process_urgent
+/*
+ vs__started__vs_get_tonemap_req*/
+
+
+/* Actions with MME and parameters. */
+#define __m(action, param...) \
+typedef struct \
+{ \
+ cp_mme_peer_t peer; \
+ PREPROC_FOR_EACH (__m_, param) \
+} scenario_action_ ## action ## _t; \
+void \
+scenario_action_ ## action ## _cb ( \
+ scenario_globals_t *globals, scenario_params_t *params);
+#define __m_(param) param;
+
+
+__m (vs__started__vs_get_tonemap_req)
+
+#undef __m
+#undef __m_
+
+typedef struct
+{
+ cp_fsm_event_type_t type;
+ cp_mme_rx_t *mme;
+ bsu_beacon_t *beacon;
+ cp_net_t *net;
+ cp_sta_t *sta;
+} scenario_action_event_param_t;
+
+typedef scenario_action_event_param_t scenario_action_post_and_process_t;
+typedef scenario_action_event_param_t scenario_action_post_t;
+typedef scenario_action_event_param_t scenario_action_trigger_t;
+typedef scenario_action_event_param_t scenario_action_post_urgent_t;
+typedef scenario_empty_t scenario_action_process_t;
+typedef scenario_empty_t scenario_action_process_urgent_t;
+
+void
+scenario_action_post_and_process_cb (scenario_globals_t *globals,
+ scenario_params_t *params);
+
+void
+scenario_action_post_cb (scenario_globals_t *globals,
+ scenario_params_t *params);
+
+void
+scenario_action_trigger_cb (scenario_globals_t *globals,
+ scenario_params_t *params);
+
+void
+scenario_action_post_urgent_cb (scenario_globals_t *globals,
+ scenario_params_t *params);
+
+void
+scenario_action_process_cb (scenario_globals_t *globals,
+ scenario_params_t *params);
+
+void
+scenario_action_process_urgent_cb (scenario_globals_t *globals,
+ scenario_params_t *params);
+
+/* Scenario events. */
+
+#define SCENARIO_DEFS_EVENTS \
+ cp_fsm__STOPPED__drv_sta_set_mac_addr_req, \
+ cp_fsm__STOPPED__drv_sta_set_cco_pref_req, \
+ cp_fsm__STOPPED__drv_sta_set_was_cco_req, \
+ cp_fsm__STOPPED__drv_sta_set_dpw_req, \
+ cp_fsm__STOPPED__drv_sta_set_nid_req, \
+ cp_fsm__STOPPED__drv_sta_set_tonemask_req, \
+ cp_fsm__STOPPED__drv_sta_set_key_req, \
+ cp_fsm__STOPPED__drv_sta_set_dak_req, \
+ cp_fsm__STOPPED__drv_sta_mac_start_req, \
+ cp_fsm__STOPPED__drv_sta_set_npw_req, \
+ cp_fsm__STOPPED__drv_sta_set_sl_req, \
+ cp_fsm__STOPPED__drv_sta_set_m_sta_hfid_req, \
+ cp_fsm__STOPPED__drv_sta_set_u_sta_hfid_req, \
+ cp_fsm__STOPPED__drv_sta_set_avln_hfid_req, \
+ cp_sta_action_drv__drv_sta_set_config_req, \
+ cp_fsm__STARTED__poweron__idle__to_poweron, \
+ cp_fsm__STOPPING__poweron__many__to_idle,\
+ cp_fsm__STOPPING__drv__stopping__stopped,\
+ cp_fsm__DETECTING_BEACON__sta_clear_status, \
+ cp_fsm__DETECTING_BEACON__BEACON, \
+ cp_fsm__DETECTING_BEACON__BEACON_NOT_RECEIVED, \
+ cp_fsm__DETECTING_BEACON__nd_beacon, \
+ cp_fsm__ASSOCIATING__start_retry_timer, \
+ cp_fsm__ASSOCIATING__timeout_associating, \
+ cp_fsm__ASSOCIATING__CC_ASSOC_CNF, \
+ cp_fsm__ASSOCIATING__no_beacons, \
+ cp_fsm__ASSOCIATING__beacon_not_received, \
+ cp_fsm__ASSOCIATING__stop_retry_timer, \
+ cp_fsm__UNASSOCIATED__start_retry_timer, \
+ cp_fsm__UNASSOCIATED__enter_sleep_unassociated, \
+ cp_fsm__UNASSOCIATED__retry_unassociated, \
+ cp_fsm__UNASSOCIATED__timeout_unassociating, \
+ cp_fsm__UNASSOCIATED__no_beacons, \
+ cp_fsm__UNASSOCIATED__BEACON, \
+ cp_fsm__UNASSOCIATED__stop_retry_timer, \
+ cp_fsm__SLEEP_UNASSOCIATED__exit_sleep_unassociated, \
+ cp_fsm__ASSOCIATED__no_beacons, \
+ cp_fsm__ASSOCIATED__CC_LEAVE_IND, \
+ cp_fsm__ASSOCIATED__CM_GET_KEY_CNF, \
+ cp_fsm__ASSOCIATED__timeout_associating, \
+ cp_fsm__ASSOCIATED__encrypt_payload_rsp, \
+ cp_fsm__ASSOCIATED__cm_chan_est_ind, \
+ cp_fsm__ASSOCIATED__cm_update_tm_ind, \
+ cp_fsm__AUTHENTICATED__no_beacons, \
+ cp_fsm__AUTHENTICATED__BEACON, \
+ cp_fsm__AUTHENTICATED__CC_LEAVE_IND, \
+ cp_fsm__AUTHENTICATED__drv__started__drv_sta_mac_stop_req,\
+ cp_fsm__AUTHENTICATED__process_cm_brg_info_req,\
+ cp_fsm__AUTHENTICATED__process_cm_brg_info_cnf,\
+ cp_fsm__AUTHENTICATED__CM_SET_KEY_REQ,\
+ cp_fsm__AUTHENTICATED__CM_NW_STATS_REQ,\
+ cp_fsm__AUTHENTICATED__set_out_lev_ind,\
+ cp_fsm__CCO__bridge_first_com,\
+ cp_msg_vs_get_tonemap_req_receive, \
+ cp_msg_vs_get_tonemap_cnf_send, \
+ cp_beacon_synchronised
+
+
+/* MME send event. */
+#define __ms(event, param...) \
+typedef struct \
+{ \
+ cp_mme_peer_t peer; \
+ PREPROC_FOR_EACH (__p_, ## param) \
+} scenario_event_ ## event ## _t;
+
+/* MME receive event. */
+#define __mr(event, param...) \
+typedef struct \
+{ \
+ bool ok; \
+ PREPROC_FOR_EACH (__p_, ## param) \
+} scenario_event_ ## event ## _t;
+
+#define __p_(param) param;
+
+
+__mr (cp_msg_vs_get_tonemap_req_receive,
+ mac_t mac_addr,
+ cp_msg_vs_get_tonemap_tmi_t tmi,
+ u8 int_id,
+ cp_msg_vs_get_tonemap_req_dir_t dir)
+__ms (cp_msg_vs_get_tonemap_cnf_send,
+ cp_msg_vs_get_tonemap_cnf_result_t result,
+ uint beacon_delta,
+ u8 int_id,
+ tonemaps_t *tms,
+ cp_msg_vs_get_tonemap_tmi_t tmi)
+
+/* Event with return. */
+#define __er(event, param...) \
+typedef struct \
+{ \
+ bool ok; \
+ PREPROC_FOR_EACH (__p_, ## param) \
+} scenario_event_ ## event ## _t;
+
+__er (cp_beacon_synchronised)
+
+#undef __er
+#undef __ms
+#undef __mr
+
+typedef struct
+{
+ cp_fsm_branch_t branch;
+} scenario_event_transition_with_branch_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__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/inc/test_sta_action.h b/cesar/cp/eoc/sta/action/test/utest/inc/test_sta_action.h
new file mode 100644
index 0000000000..48172abd46
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest/inc/test_sta_action.h
@@ -0,0 +1,56 @@
+#ifndef inc_test_sta_action_h
+#define inc_test_sta_action_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file inc/test_sta_action.h
+ * \brief Test sta/action.
+ * \ingroup test
+ */
+#include "cp/inc/context.h"
+
+/** Contexts used in tests. */
+struct test_sta_action_t
+{
+ cp_t cp;
+ mac_config_t mac_config;
+};
+typedef struct test_sta_action_t test_sta_action_t;
+
+/**
+ * Initialise test contexts.
+ * \param ctx test context
+ */
+void
+test_sta_action_init (test_sta_action_t *ctx);
+
+/**
+ * Uninitialise test contexts.
+ * \param ctx test context
+ */
+void
+test_sta_action_uninit (test_sta_action_t *ctx);
+
+/**
+ * Reset test contexts.
+ * \param ctx test context
+ */
+void
+test_sta_action_reset (test_sta_action_t *ctx);
+
+/**
+ * Create our AVLN as if the STA was associated.
+ * \param ctx test context
+ * \param nid our NID
+ * \param snid our SNID
+ */
+void
+test_sta_action_create_our_net (test_sta_action_t *ctx, cp_nid_t nid,
+ cp_snid_t snid);
+
+#endif /* inc_test_sta_action_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
new file mode 100644
index 0000000000..09258d2361
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest/src/actions.c
@@ -0,0 +1,118 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/actions.c
+ * \brief Scenario actions.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "lib/scenario/scenario.h"
+
+#include "cp/inc/context.h"
+
+#include "cp/eoc/sta/action/action.h"
+
+
+void
+cp_sta_action_vs__started__vs_get_tonemap_req (cp_t *ctx, cp_mme_rx_t *mme_rx);
+
+
+cp_fsm_event_t *
+scenario_action_make_event (cp_t *cp, scenario_action_event_param_t *ep)
+{
+ cp_fsm_event_t *event;
+ if (ep->mme)
+ event = cp_fsm_event_mme_new (cp, ep->type, ep->mme);
+ else if (ep->beacon)
+ event = cp_fsm_event_beacon_new (cp, ep->type, ep->beacon, ep->net,
+ ep->sta);
+ else if (ep->sta)
+ event = cp_fsm_event_sta_new (cp, ep->type, ep->net, ep->sta);
+ else
+ event = cp_fsm_event_bare_new (cp, ep->type);
+ return event;
+}
+
+void
+scenario_action_post_and_process_cb (scenario_globals_t *globals,
+ scenario_params_t *params)
+{
+ test_within (scenario.t);
+ scenario_action_post_and_process_t *p = &params->action_post_and_process;
+ cp_fsm_post (globals->cp, scenario_action_make_event (globals->cp, p));
+ test_fail_unless (globals->cp->sta_core_flag);
+ globals->cp->sta_core_flag = false;
+ cp_fsm_process (globals->cp);
+}
+
+void
+scenario_action_post_cb (scenario_globals_t *globals,
+ scenario_params_t *params)
+{
+ test_within (scenario.t);
+ scenario_action_post_t *p = &params->action_post;
+ cp_fsm_post (globals->cp, scenario_action_make_event (globals->cp, p));
+ test_fail_unless (globals->cp->sta_core_flag);
+}
+
+void
+scenario_action_trigger_cb (scenario_globals_t *globals,
+ scenario_params_t *params)
+{
+ test_within (scenario.t);
+ scenario_action_trigger_t *p = &params->action_trigger;
+ cp_fsm_trigger (globals->cp, scenario_action_make_event (globals->cp, p));
+ test_fail_unless (globals->cp->sta_core_flag);
+}
+
+void
+scenario_action_post_urgent_cb (scenario_globals_t *globals,
+ scenario_params_t *params)
+{
+ test_within (scenario.t);
+ scenario_action_post_urgent_t *p = &params->action_post_urgent;
+ cp_fsm_post_urgent (globals->cp,
+ scenario_action_make_event (globals->cp, p));
+ test_fail_unless (globals->cp->sta_core_urgent_flag);
+}
+
+void
+scenario_action_process_cb (scenario_globals_t *globals,
+ scenario_params_t *params)
+{
+ test_within (scenario.t);
+ test_fail_unless (globals->cp->sta_core_flag);
+ globals->cp->sta_core_flag = false;
+ cp_fsm_process (globals->cp);
+}
+
+void
+scenario_action_process_urgent_cb (scenario_globals_t *globals,
+ scenario_params_t *params)
+{
+ test_within (scenario.t);
+ test_fail_unless (globals->cp->sta_core_urgent_flag);
+ globals->cp->sta_core_urgent_flag = false;
+ cp_fsm_process_urgent (globals->cp);
+}
+
+#define __m(ACTION) \
+void \
+scenario_action_ ## ACTION ## _cb (scenario_globals_t *globals, \
+ scenario_params_t *params) \
+{ \
+ static cp_mme_rx_t mme; \
+ mme.peer = params->action_ ## ACTION.peer; \
+ mme.peks = CP_MME_PEKS_SPC_NOT_EMBEDDED; \
+ cp_sta_action_ ## ACTION (globals->cp, &mme); \
+}
+
+
+
+
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..910786a8a5
--- /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];
+
+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
new file mode 100644
index 0000000000..00f335e35a
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest/src/cp_stub.c
@@ -0,0 +1,58 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2009 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file eoc/sta/action/test/utest/src/cp_stub.c
+ * \brief cp/cp.c stub
+ * \ingroup test
+ *
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+#include "cp/mme.h"
+#include "cp/inc/context.h"
+#include "cp/sta/core/core.h"
+#include "cp/sta/core/defs.h"
+
+/**
+ * Compute the NID and the NMK from the network password.
+ * \param ctx the CP context.
+ * \param npw the network password.
+ * \param sl the security level of the station.
+ *
+ * This function will generate the NID and the NMK from the NPW and store it
+ * in the station own data.
+ */
+void
+cp_compute_nmk_and_nid_from_npw (cp_t *ctx, const char *npw,
+ cp_security_level_t sl)
+{
+ u64 nid;
+ cp_key_t nmk;
+ uint length;
+
+ dbg_assert (ctx);
+ dbg_assert (npw);
+
+ length = strlen (npw);
+
+ nmk = cp_secu_npw2nmk (ctx, (const u8*) npw, length);
+ nid = cp_secu_nmk2nid (ctx, nmk, sl);
+
+ /* Store the nid and the nmk to the station own data. */
+ cp_sta_own_data_set_nmk (ctx, nmk, 0);
+ cp_sta_own_data_set_nid (ctx, nid);
+}
+
+void
+cp_sta_core_gen_timed_event(cp_t *cp_ctx,
+ cp_sta_core_timed_event_def_t *sta_core_timed_event,
+ cp_fsm_event_t *fsm_event,
+ uint event_delay_ms)
+{
+ slab_release (fsm_event);
+}
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..f9f9784e0e
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest/src/cyg_stub.c
@@ -0,0 +1,40 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2012 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/cyg_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+#include "bsu/aclf/aclf.h"
+#include <cyg/kernel/kapi.h>
+
+#define BSU_ACLF_BP_CABLE_TCK 2500000
+#define TCK_PER_RTC 250000
+
+u32
+cp_sta_core_tck_per_rtc (cp_t *ctx)
+{
+ return TCK_PER_RTC;
+}
+
+u32
+bsu_aclf_beacon_period_tck (bsu_aclf_t *ctx)
+{
+ return BSU_ACLF_BP_CABLE_TCK;
+}
+
+cyg_tick_count_t
+cyg_current_time (void)
+{
+ /* For tests purpose we can simulate 1000 beacon periods */
+ return (u32)((BSU_ACLF_BP_CABLE_TCK * 1000ull) / TCK_PER_RTC);
+}
diff --git a/cesar/cp/eoc/sta/action/test/utest/src/fsm_stub.c b/cesar/cp/eoc/sta/action/test/utest/src/fsm_stub.c
new file mode 100644
index 0000000000..4bee0e8346
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest/src/fsm_stub.c
@@ -0,0 +1,335 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/fsm_stub.c
+ * \brief Override FSM tables.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "lib/scenario/scenario.h"
+#include "cp/eoc/sta/action/assoc_slave.h"
+#include "cp/eoc/sta/action/drv.h"
+#include "cp/eoc/sta/action/vs.h"
+
+#include "cp/fsm/fsm.h"
+#include "cp/fsm/inc/tables.h"
+
+void
+cp_sta_action_drv__drv_sta_set_config_req (cp_t *ctx, cp_mme_rx_t *mme_rx)
+{
+ scenario_event (cp_sta_action_drv__drv_sta_set_config_req);
+}
+
+void
+cp_eoc_sta_action_auth__authenticated_set_out_lev(cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__AUTHENTICATED__set_out_lev_ind);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_mac_addr_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__STOPPED__drv_sta_set_mac_addr_req);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_cco_pref_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__STOPPED__drv_sta_set_cco_pref_req);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_was_cco_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__STOPPED__drv_sta_set_was_cco_req);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_dpw_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__STOPPED__drv_sta_set_dpw_req);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_nid_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__STOPPED__drv_sta_set_nid_req);
+}
+
+void
+cp_eoc_sta_action_drv__stopped__drv_sta_set_tonemask_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__STOPPED__drv_sta_set_tonemask_req);
+}
+
+void
+cp_eoc_sta_action_drv__stopped__drv_sta_set_key_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__STOPPED__drv_sta_set_key_req);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_dak_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__STOPPED__drv_sta_set_dak_req);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_mac_start_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__STOPPED__drv_sta_mac_start_req);
+}
+
+void
+cp_beacon_beacon_not_received (cp_t *ctx)
+{
+ scenario_event (cp_fsm__ASSOCIATING__beacon_not_received);
+}
+
+void
+cp_eoc_sta_action_assoc__detecting_detected (cp_t *ctx)
+{
+ scenario_event (cp_fsm__DETECTING_BEACON__nd_beacon);
+}
+
+void
+cp_eoc_sta_action_assoc__associating_timeout (cp_t *ctx)
+{
+ scenario_event (cp_fsm__ASSOCIATING__timeout_associating, param);
+ cp_fsm_branch_ (ctx, param->branch);
+}
+
+void
+cp_eoc_sta_action_assoc__associating_cnf (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__ASSOCIATING__CC_ASSOC_CNF, param);
+ cp_fsm_branch_ (ctx, param->branch);
+}
+
+void
+cp_eoc_sta_action_assoc__associating_no_beacons (cp_t *ctx)
+{
+ scenario_event (cp_fsm__ASSOCIATING__no_beacons);
+}
+
+void
+cp_eoc_sta_action_assoc__unassociated_retry (cp_t *ctx)
+{
+ scenario_event (cp_fsm__UNASSOCIATED__retry_unassociated);
+}
+
+void
+cp_eoc_sta_action_assoc__associated_key_cnf (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__ASSOCIATED__CM_GET_KEY_CNF, param);
+ cp_fsm_branch_ (ctx, param->branch);
+}
+
+void
+cp_eoc_sta_action_assoc__associated_encrypt_payload_rsp (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__ASSOCIATED__encrypt_payload_rsp);
+}
+
+void
+cp_eoc_sta_action_assoc__associated_no_beacons (cp_t *ctx)
+{
+ scenario_event (cp_fsm__ASSOCIATED__no_beacons);
+}
+
+void
+cp_eoc_sta_action_assoc__associated_timeout (cp_t *ctx)
+{
+ scenario_event (cp_fsm__ASSOCIATED__timeout_associating);
+}
+
+void
+cp_eoc_sta_action_assoc__associated_leave (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__ASSOCIATED__CC_LEAVE_IND, param);
+ cp_fsm_branch_ (ctx, param->branch);
+}
+
+void
+cp_eoc_sta_action_assoc__authenticated_no_beacons (cp_t *ctx)
+{
+ scenario_event (cp_fsm__AUTHENTICATED__no_beacons);
+}
+
+void
+cp_eoc_sta_action_assoc__authenticated_leave (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__AUTHENTICATED__CC_LEAVE_IND, param);
+ cp_fsm_branch_ (ctx, param->branch);
+}
+
+void
+cp_eoc_sta_action_assoc__beacon_not_received (cp_t *ctx)
+{
+ scenario_event (cp_fsm__DETECTING_BEACON__BEACON_NOT_RECEIVED);
+}
+
+void
+ce_tx_process__cm_chan_est_ind (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__ASSOCIATED__cm_chan_est_ind);
+}
+
+void
+ce_tx_process__cm_update_tm_ind (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__ASSOCIATED__cm_update_tm_ind);
+}
+
+void
+cp_eoc_sta_action_unassoc__start_retry_timer (cp_t *ctx)
+{
+ scenario_event (cp_fsm__UNASSOCIATED__start_retry_timer);
+}
+
+void
+cp_eoc_sta_action_assoc__start_retry_timer (cp_t *ctx)
+{
+ scenario_event (cp_fsm__ASSOCIATING__start_retry_timer);
+}
+
+void
+cp_eoc_sta_action_unassoc__stop_retry_timer (cp_t *ctx)
+{
+ scenario_event (cp_fsm__UNASSOCIATED__stop_retry_timer);
+}
+
+void
+cp_sta_action_assoc__stop_retry_timer (cp_t *ctx)
+{
+ scenario_event (cp_fsm__ASSOCIATING__stop_retry_timer);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_npw_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__STOPPED__drv_sta_set_npw_req);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_sl_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__STOPPED__drv_sta_set_sl_req);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_m_sta_hfid_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__STOPPED__drv_sta_set_m_sta_hfid_req);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_u_sta_hfid_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__STOPPED__drv_sta_set_u_sta_hfid_req);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_avln_hfid_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__STOPPED__drv_sta_set_avln_hfid_req);
+}
+
+void
+cp_sta_action_bridge_first_com (cp_t *ctx, cp_net_t *net, cp_sta_t *sta)
+{
+ scenario_event (cp_fsm__CCO__bridge_first_com);
+}
+
+void
+cp_eoc_sta_action_poweron__many__to_idle (cp_t *ctx)
+{
+ scenario_event (cp_fsm__STOPPING__poweron__many__to_idle);
+}
+
+void
+cp_eoc_sta_action_poweron__idle__to_poweron (cp_t *ctx)
+{
+ scenario_event (cp_fsm__STARTED__poweron__idle__to_poweron);
+}
+
+void
+cp_sta_action_drv__stopping__stopped (cp_t *ctx)
+{
+ scenario_event (cp_fsm__STOPPING__drv__stopping__stopped);
+}
+
+void
+cp_sta_action_drv__started__drv_sta_mac_stop_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ scenario_event
+ (cp_fsm__AUTHENTICATED__drv__started__drv_sta_mac_stop_req);
+}
+
+void
+cp_sta_action_process_cm_brg_info_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__AUTHENTICATED__process_cm_brg_info_req);
+}
+
+void
+cp_sta_action_process_cm_brg_info_cnf (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__AUTHENTICATED__process_cm_brg_info_cnf);
+}
+
+void
+cp_eoc_sta_action_auth__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
+ cp_net_t *net, cp_sta_t *sta)
+{
+ scenario_event (cp_fsm__AUTHENTICATED__BEACON);
+}
+
+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);
+}
+
+void
+cp_eoc_sta_action_auth__authenticated_set_key_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__AUTHENTICATED__CM_SET_KEY_REQ);
+}
+
+void
+cp_sta_action_process_cm_nw_stats_req (cp_t *ctx, cp_mme_rx_t *rx_mme)
+{
+ scenario_event (cp_fsm__AUTHENTICATED__CM_NW_STATS_REQ);
+}
+
+void
+cp_eoc_sta_action_detect__beacon_received (cp_t *ctx, bsu_beacon_t *beacon,
+ cp_net_t *net, cp_sta_t *sta)
+{
+ scenario_event (cp_fsm__DETECTING_BEACON__BEACON);
+}
diff --git a/cesar/cp/eoc/sta/action/test/utest/src/phy_stub.c b/cesar/cp/eoc/sta/action/test/utest/src/phy_stub.c
new file mode 100644
index 0000000000..ba991fe957
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest/src/phy_stub.c
@@ -0,0 +1,26 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2011 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file
+ * \brief
+ * \ingroup
+ */
+
+#include "common/std.h"
+#include "cp/inc/context.h"
+
+
+void
+phy_tx_scale_adapt_exp_set (phy_t *ctx, u8 exp)
+{
+}
+
+void
+phy_tx_scale_adapt_set (phy_t *ctx, u16 value)
+{
+}
diff --git a/cesar/cp/eoc/sta/action/test/utest/src/test_actions.c b/cesar/cp/eoc/sta/action/test/utest/src/test_actions.c
new file mode 100644
index 0000000000..e0836d0875
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest/src/test_actions.c
@@ -0,0 +1,1967 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/test_actions.c
+ * \brief Test FSM module.
+ * \ingroup test
+ */
+
+#include "stdio.h"
+#include "common/std.h"
+#include "lib/blk.h"
+#include "cp/inc/context.h"
+#include "cp/msg/msg.h"
+#include "lib/test.h"
+#include "lib/utils.h"
+#include "lib/swap.h"
+#include "lib/slab.h"
+#include "cp/eoc/sta/action/drv.h"
+#include "cp/fsm/fsm.h"
+#include "cp/inc/context.h"
+#include "cp/fsm/inc/tables.h"
+#include "cp/sta/core/core.h"
+#include "inc/test_sta_action.h"
+#include "cp/sta/mgr/inc/sta.h"
+#include "mac/pbproc/inc/context.h"
+#include "cp/eoc/sta/action/action.h"
+#include "cp/sta/action/assoc.h"
+
+void
+cp_eoc_sta_action__power_on_no_beacons (cp_t *ctx);
+
+void
+cp_test_init (cp_t * ctx)
+{
+ static pbproc_t pbproc;
+ static mac_config_t mac_config;
+ static cl_t cl;
+ static sar_t sar;
+
+ memset (ctx, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+ memset (&sar, 0, sizeof (sar));
+ memset (&pbproc, 0, sizeof (pbproc));
+
+ ctx->mac_config = &mac_config;
+ ctx->sar = &sar;
+ ctx->cl = &cl;
+ ctx->pbproc = &pbproc;
+
+ ctx->mac_store = mac_store_init ();
+ mac_config_init (ctx->mac_config);
+ lib_stats_init ();
+ cp_msg_init(ctx);
+ cp_cl_interf_init (ctx);
+ lib_rnd_init (&ctx->rnd, 1234);
+ cp_eoc_sta_mgr_init (ctx);
+ cp_fsm_init (ctx);
+}
+
+void
+cp_test_uninit (cp_t * ctx)
+{
+ ctx->fsm.handled_event = NULL;
+ mac_store_uninit (ctx->mac_store);
+ cp_msg_uninit (ctx);
+ cp_fsm_uninit (ctx);
+ lib_stats_uninit ();
+}
+
+void
+cp_eoc_cco_action_test_release_mac_store (cp_t *ctx)
+{
+ uint tei, i;
+ for (tei = MAC_TEI_STA_MIN_EOC; tei < MAC_TEI_STA_MAX; tei++)
+ {
+ mfs_t *mfs;
+ for (i = 0; i < MAC_CAP_NB; i++)
+ {
+ mfs = mac_store_mfs_get (ctx->mac_store, true, false, false,
+ MAC_LLID_MIN + i, tei);
+ if (mfs)
+ {
+ mac_store_mfs_remove (ctx->mac_store, mfs);
+ blk_release (mfs);
+ }
+ }
+ mfs = mac_store_mfs_get (ctx->mac_store, true, false, true,
+ MAC_LID_NONE, tei);
+ if (mfs)
+ {
+ mac_store_mfs_remove (ctx->mac_store, mfs);
+ blk_release (mfs);
+ }
+ }
+}
+
+void
+test_case_association_and_authentication_action (test_t test)
+{
+ test_case_begin (test, "Asssociation and authentication");
+
+ test_begin (test, "Receiving and processing DRV_STA_SET_MAC_ADDR_REQ")
+ {
+ cp_t ctx;
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+
+ bitstream_t bitstream;
+ u64 data;
+ u8 buffer[1024];
+
+ cp_test_init (&ctx);
+ memset (mme, 0, sizeof (*mme));
+ mme->mmtype = DRV_STA_SET_MAC_ADDR_REQ;
+ cp_secu_protocol_run_new (&mme->prun, 0, &ctx.rnd);
+ bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+ //Mac address
+ data = 0x3;
+ bitstream_access (&bitstream, &data, 48);
+
+ bitstream_finalise (&bitstream);
+
+ mme->length = 6;
+
+ mme->peer.mac = 0x3;
+
+ cp_sta_action_drv__stopped__drv_sta_set_mac_addr_req (&ctx, mme);
+
+ test_fail_unless (ctx.sta_mgr.sta_own_data.mac_addr == mme->peer.mac);
+
+ test_fail_unless (ctx.mac_config->sta_mac_address == mme->peer.mac);
+
+ cp_test_uninit (&ctx);
+ }
+ test_end;
+
+ test_begin (test, "Receiving and processing DRV_STA_SET_CCO_PREF_REQ")
+ {
+ cp_t ctx;
+
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+
+ bitstream_t bitstream;
+ u8 cco_pref;
+ u8 buffer[1024];
+
+ cp_test_init (&ctx);
+ memset (mme, 0, sizeof (*mme));
+ mme->mmtype = DRV_STA_SET_CCO_PREF_REQ;
+ cp_secu_protocol_run_new (&mme->prun, 0, &ctx.rnd);
+ bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+
+ /* 0x01 means that the staion is prefered as CCO
+ * 0x00 means that the station is not prefered as CCO. */
+ cco_pref = 0x1;
+ bitstream_access(&bitstream, &cco_pref, 8);
+
+ bitstream_finalise (&bitstream);
+
+ mme->length = 1;
+
+ cp_sta_action_drv__stopped__drv_sta_set_cco_pref_req (&ctx, mme);
+ cp_sta_own_data_t *own = cp_sta_mgr_get_sta_own_data (&ctx);
+
+ test_fail_unless (own->cco_prefered == cco_pref);
+ cp_test_uninit (&ctx);
+ }
+ test_end;
+
+ test_begin (test, "Receiving and processing DRV_STA_SET_WAS_CCO_REQ")
+ {
+ cp_t ctx;
+
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+
+ bitstream_t bitstream;
+ u8 was_cco;
+ u8 buffer[1024];
+
+ cp_test_init (&ctx);
+ memset (mme, 0, sizeof (*mme));
+ mme->mmtype = DRV_STA_SET_WAS_CCO_REQ;
+ cp_secu_protocol_run_new (&mme->prun, 0, &ctx.rnd);
+ bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+
+ /* 0x01 means that the staion was a CCO prviously
+ * 0x00 means that the station was not a CCO previously. */
+ was_cco = 0x1;
+ bitstream_access(&bitstream, &was_cco, 8);
+
+ bitstream_finalise (&bitstream);
+
+ mme->length = 1;
+
+ cp_sta_action_drv__stopped__drv_sta_set_was_cco_req (&ctx, mme);
+
+ test_fail_unless (ctx.sta_mgr.sta_own_data.was_cco == was_cco);
+ cp_test_uninit (&ctx);
+ }
+ test_end;
+
+ test_begin (test, "Receiving and processing DRV_STA_SET_NPW_REQ")
+ {
+ cp_t ctx;
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+ uint i;
+ bitstream_t bitstream;
+ u8 buffer[1024];
+ char npw[CP_NPW_MAX_SIZE + 1];
+
+ cp_test_init (&ctx);
+ memset (mme, 0, sizeof (*mme));
+ /* Sample network password: SPC-300_EoC_200MBps. */
+ memset (npw, 0, sizeof (npw));
+ strcpy(npw, "SPC-300_EoC_200MBps");
+
+ ctx.sta_mgr.sta_own_data.security_level = CP_SECURITY_LEVEL_SC;
+ ctx.sta_mgr.sta_own_data.nmk.key[0] = 0;
+ ctx.sta_mgr.sta_own_data.nmk.key[1] = 0;
+ ctx.sta_mgr.sta_own_data.nmk.key[2] = 0;
+ ctx.sta_mgr.sta_own_data.nmk.key[3] = 0;
+ ctx.sta_mgr.our_avln = NULL;
+
+ mme->mmtype = DRV_STA_SET_NPW_REQ;
+ cp_secu_protocol_run_new (&mme->prun, 0, &ctx.rnd);
+ bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+
+ for(i = 0; i < CP_NPW_MAX_SIZE; i++)
+ bitstream_access(&bitstream, &npw[i], 8);
+
+ bitstream_finalise(&bitstream);
+
+ cp_sta_action_drv__stopped__drv_sta_set_npw_req (&ctx, mme);
+
+ test_fail_unless (!(strcmp(ctx.sta_mgr.sta_own_data.npw, npw)));
+ cp_test_uninit (&ctx);
+ }
+ test_end;
+
+ test_begin (test, "Receiving and processing DRV_STA_SET_DPW_REQ")
+ {
+ cp_t ctx;
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+ uint i;
+ bitstream_t bitstream;
+ u8 buffer[1024];
+ char dpw[CP_NPW_MAX_SIZE + 1];
+
+ cp_test_init (&ctx);
+ memset (mme, 0, sizeof (*mme));
+ /* Sample device password: Spidcom_Eoc_Modem_user_121. */
+ memset (dpw, 0, sizeof (dpw));
+ strcpy(dpw, "SPC-300_EoC_200MBps");
+
+ mme->mmtype = DRV_STA_SET_DPW_REQ;
+ cp_secu_protocol_run_new (&mme->prun, 0, &ctx.rnd);
+ bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+
+ for(i = 0; i < CP_NPW_MAX_SIZE; i++)
+ bitstream_access(&bitstream, &dpw[i], 8);
+
+ bitstream_finalise(&bitstream);
+
+ cp_sta_action_drv__stopped__drv_sta_set_dpw_req (&ctx, mme);
+
+ test_fail_unless (!(strcmp(ctx.sta_mgr.sta_own_data.dpw, dpw)));
+ cp_test_uninit (&ctx);
+ }
+ test_end;
+
+ test_begin (test, "Receiving and processing DRV_STA_SET_SL_REQ")
+ {
+ cp_t ctx;
+
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+
+ bitstream_t bitstream;
+ cp_security_level_t sl;
+ u8 buffer[1024];
+ char npw[CP_NPW_MAX_SIZE + 1];
+
+ cp_test_init (&ctx);
+ memset (mme, 0, sizeof (*mme));
+ memset (npw, 0, sizeof (npw));
+ strcpy(npw, "SPC-300_EoC_200MBps");
+ cp_sta_own_data_set_npw (&ctx, npw);
+
+ mme->mmtype = DRV_STA_SET_SL_REQ;
+ cp_secu_protocol_run_new (&mme->prun, 0, &ctx.rnd);
+ bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+ /* Possible security level values:
+ * CP_SECURITY_LEVEL_SC, CP_SECURITY_LEVEL_HS */
+ sl = CP_SECURITY_LEVEL_HS;
+ bitstream_access(&bitstream, &sl, 8);
+
+ bitstream_finalise (&bitstream);
+
+ cp_sta_action_drv__stopped__drv_sta_set_sl_req (&ctx, mme);
+
+ test_fail_unless (ctx.sta_mgr.sta_own_data.security_level == sl);
+ cp_test_uninit (&ctx);
+ }
+ test_end;
+
+ test_begin (test, "Receiving and processing DRV_STA_SET_NID_REQ")
+ {
+ cp_t ctx;
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+ bitstream_t bitstream;
+ u8 buffer[1024];
+ cp_nid_t nid;
+ cp_net_t *net;
+
+ cp_test_init (&ctx);
+ memset (mme, 0, sizeof (*mme));
+
+ /* Sample network id: 0x11223344556677. */
+ nid = 0x11223344556677ull;
+
+ /* Set our avln. */
+ net = cp_sta_mgr_add_avln (&ctx, 1, 1);
+ cp_sta_mgr_set_our_avln (&ctx, net);
+
+ mme->mmtype = DRV_STA_SET_NID_REQ;
+ cp_secu_protocol_run_new (&mme->prun, 0, &ctx.rnd);
+ bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+
+ bitstream_access(&bitstream, &nid, 56);
+ bitstream_finalise (&bitstream);
+
+ mme->length = 7;
+
+ cp_sta_action_drv__stopped__drv_sta_set_nid_req (&ctx, mme);
+
+ test_fail_unless (ctx.sta_mgr.sta_own_data.nid == nid);
+
+ test_fail_unless (ctx.sta_mgr.our_avln->nid == nid);
+ cp_test_uninit (&ctx);
+ }
+ test_end;
+
+ test_begin (test, "Receiving and processing DRV_STA_SET_M_STA_HFID_REQ")
+ {
+ cp_t ctx;
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+ uint i;
+ bitstream_t bitstream;
+ u8 buffer[1024];
+ char m_sta_hfid[CP_HFID_SIZE + 1];
+
+ cp_test_init (&ctx);
+ memset (mme, 0, sizeof (*mme));
+
+ /* Sample manufacturer human friendly identifier:
+ * Spidcom_SPC_300_EoC_m_HFID_123. */
+ memset(m_sta_hfid, 0, sizeof (m_sta_hfid));
+ strcpy(m_sta_hfid, "Spidcom_SPC_300_EoC_m_HFID_123");
+
+ mme->mmtype = DRV_STA_SET_M_STA_HFID_REQ;
+ cp_secu_protocol_run_new (&mme->prun, 0, &ctx.rnd);
+ bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+
+ for(i = 0; i < CP_HFID_SIZE; i++)
+ bitstream_access(&bitstream, &m_sta_hfid[i], 8);
+
+ bitstream_finalise(&bitstream);
+
+ cp_sta_action_drv__stopped__drv_sta_set_m_sta_hfid_req (&ctx, mme);
+
+ cp_sta_own_data_t *own = cp_sta_mgr_get_sta_own_data (&ctx);
+
+ test_fail_unless (!(strcmp(own->hfid_manufacturer, m_sta_hfid)));
+ cp_test_uninit (&ctx);
+ }
+ test_end;
+
+ test_begin (test, "Receiving and processing DRV_STA_SET_U_STA_HFID_REQ")
+ {
+ cp_t ctx;
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+ uint i;
+ bitstream_t bitstream;
+ u8 buffer[1024];
+ char u_sta_hfid[CP_HFID_SIZE + 1];
+
+ cp_test_init (&ctx);
+ memset (mme, 0, sizeof (*mme));
+
+ /* Sample manufacturer human friendly identifier:
+ * Spidcom_SPC_300_EoC_m_HFID_123. */
+ memset(u_sta_hfid, 0, sizeof (u_sta_hfid));
+ strcpy(u_sta_hfid, "Spidcom_SPC_300_EoC_u_HFID_123");
+
+ mme->mmtype = DRV_STA_SET_M_STA_HFID_REQ;
+ cp_secu_protocol_run_new (&mme->prun, 0, &ctx.rnd);
+ bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+
+ for(i = 0; i < CP_HFID_SIZE; i++)
+ bitstream_access(&bitstream, &u_sta_hfid[i], 8);
+
+ bitstream_finalise(&bitstream);
+
+ cp_sta_action_drv__stopped__drv_sta_set_u_sta_hfid_req (&ctx, mme);
+
+ cp_sta_own_data_t *own = cp_sta_mgr_get_sta_own_data (&ctx);
+
+ test_fail_unless (!(strcmp(own->hfid_user, u_sta_hfid)));
+ cp_test_uninit (&ctx);
+ }
+ test_end;
+
+ test_begin (test, "Receiving and processing DRV_STA_SET_AVLN_HFID_REQ")
+ {
+ cp_t ctx;
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+ uint i;
+ bitstream_t bitstream;
+ u8 buffer[1024];
+ char avln_hfid[CP_HFID_SIZE + 1];
+
+ cp_test_init (&ctx);
+ memset (mme, 0, sizeof (*mme));
+
+ /* sample avln human friendly identifier:
+ * Spidcom_SPC_300_EoC_avln_HFID_123. */
+ memset(avln_hfid, 0, sizeof (avln_hfid));
+ strcpy(avln_hfid, "Spidcom_SPC_300_EoC_avln_HFID_123");
+
+ mme->mmtype = DRV_STA_SET_M_STA_HFID_REQ;
+ cp_secu_protocol_run_new (&mme->prun, 0, &ctx.rnd);
+ bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+
+ for(i = 0; i < CP_HFID_SIZE; i++)
+ bitstream_access(&bitstream, &avln_hfid[i], 8);
+
+ bitstream_finalise(&bitstream);
+
+ cp_sta_action_drv__stopped__drv_sta_set_avln_hfid_req (&ctx, mme);
+
+ cp_sta_own_data_t *own = cp_sta_mgr_get_sta_own_data (&ctx);
+
+ test_fail_unless (!(strcmp(own->hfid_avln, avln_hfid)));
+ cp_test_uninit (&ctx);
+ }
+ test_end;
+
+ test_begin (test, "Receiving and processing DRV_STA_SET_KEY_REQ change NID")
+ {
+ cp_t ctx;
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+ uint i;
+ bitstream_t bitstream;
+ u8 buffer[1024];
+ cp_nid_t nid;
+ cp_net_t *net;
+ cp_key_t nmk;
+ enum cp_msg_drv_sta_set_key_type_t type;
+ cp_security_level_t sl;
+
+ cp_test_init (&ctx);
+ memset (mme, 0, sizeof (*mme));
+
+ /* Sample network id: 0x11223344556677. */
+ nid = 0x11223344556677ull;
+
+ /* Possible security level values:
+ * CP_SECURITY_LEVEL_SC, CP_SECURITY_LEVEL_HS. */
+ sl = CP_SECURITY_LEVEL_HS;
+
+ /* Possible type values:
+ * CP_MSG_DRV_STA_SET_KEY_TYPE_CHANGE_NID,
+ * CP_MSG_DRV_STA_SET_KEY_TYPE_CHANGE_SECURITY_LEVEL,
+ * CP_MSG_DRV_STA_SET_KEY_TYPE_NB */
+ type = CP_MSG_DRV_STA_SET_KEY_TYPE_CHANGE_NID;
+
+ /* Sample network membership key. */
+ nmk.key[0] = 0x11111111;
+ nmk.key[1] = 0x22222222;
+ nmk.key[2] = 0x33333333;
+ nmk.key[3] = 0x44444444;
+
+ net = cp_sta_mgr_add_avln (&ctx, 1, 1);
+ cp_sta_mgr_set_our_avln (&ctx, net);
+ cp_sta_own_data_set_security_level (&ctx, sl);
+
+ mme->mmtype = DRV_STA_SET_KEY_REQ;
+ cp_secu_protocol_run_new (&mme->prun, 0, &ctx.rnd);
+ bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+
+ for (i = 0; i < COUNT (nmk.key); i++)
+ bitstream_access(&bitstream, &nmk.key[i], 32);
+
+ bitstream_access(&bitstream, &type, 8);
+ bitstream_access(&bitstream, &nid, 56);
+ bitstream_access(&bitstream, &sl, 8);
+ bitstream_finalise(&bitstream);
+
+ mme->length = 25;
+
+ cp_eoc_sta_action_drv__stopped__drv_sta_set_key_req (&ctx, mme);
+
+ for (i = 0; i < COUNT (nmk.key); i++)
+ test_fail_unless (ctx.sta_mgr.sta_own_data.nmk.key[i] == nmk.key[i]);
+
+ test_fail_unless (ctx.sta_mgr.sta_own_data.nid == nid);
+
+ test_fail_unless (ctx.sta_mgr.our_avln->nid == nid);
+
+ //When NID is changed, SL should stay the same
+ test_fail_unless (ctx.sta_mgr.sta_own_data.security_level == sl);
+ cp_test_uninit (&ctx);
+ }
+ test_end
+
+ test_begin (test, "Receiving and processing DRV_STA_SET_KEY_REQ change sl")
+ {
+ cp_t ctx;
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+ uint i;
+ bitstream_t bitstream;
+ u8 buffer[1024];
+ cp_nid_t nid;
+ cp_net_t *net;
+ cp_key_t nmk;
+ enum cp_msg_drv_sta_set_key_type_t type;
+ cp_security_level_t sl;
+
+ cp_test_init (&ctx);
+ memset (mme, 0, sizeof (*mme));
+
+ nid = 0x11223344556677ull;
+
+ /* Possible security level values:
+ * CP_SECURITY_LEVEL_SC, CP_SECURITY_LEVEL_HS. */
+ sl = CP_SECURITY_LEVEL_SC;
+
+ /* Possible type values:
+ * CP_MSG_DRV_STA_SET_KEY_TYPE_CHANGE_NID,
+ * CP_MSG_DRV_STA_SET_KEY_TYPE_CHANGE_SECURITY_LEVEL,
+ * CP_MSG_DRV_STA_SET_KEY_TYPE_NB */
+ type = CP_MSG_DRV_STA_SET_KEY_TYPE_CHANGE_SECURITY_LEVEL;
+
+ nmk.key[0] = 0x11111111;
+ nmk.key[1] = 0x22222222;
+ nmk.key[2] = 0x33333333;
+ nmk.key[3] = 0x44444444;
+
+ net = cp_sta_mgr_add_avln (&ctx, 1, 1);
+ cp_sta_mgr_set_our_avln (&ctx, net);
+ cp_sta_own_data_set_security_level (&ctx, sl);
+
+ mme->mmtype = DRV_STA_SET_KEY_REQ;
+ cp_secu_protocol_run_new (&mme->prun, 0, &ctx.rnd);
+ bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+
+ for (i = 0; i < COUNT (nmk.key); i++)
+ bitstream_access(&bitstream, &nmk.key[i], 32);
+
+ bitstream_access(&bitstream, &type, 8);
+ bitstream_access(&bitstream, &nid, 56);
+ bitstream_access(&bitstream, &sl, 8);
+ bitstream_finalise(&bitstream);
+
+ mme->length = 25;
+
+ cp_sta_action_drv__stopped__drv_sta_set_key_req (&ctx, mme);
+
+ test_fail_unless (ctx.sta_mgr.sta_own_data.security_level == sl);
+
+ for (i = 0; i < COUNT (nmk.key); i++)
+ test_fail_unless (ctx.sta_mgr.sta_own_data.nmk.key[i] == nmk.key[i]);
+
+ /* STA that changes Security Level shall discard the previous NMK. */
+ test_fail_unless (ctx.sta_mgr.sta_own_data.nid != nid);
+
+ test_fail_unless (ctx.sta_mgr.our_avln->nid != nid);
+ cp_test_uninit (&ctx);
+ }
+ test_end
+
+ test_begin (test, "Receiving and processing DRV_STA_SET_DAK_REQ")
+ {
+ cp_t ctx;
+
+ cp_test_init (&ctx);
+
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+ uint i;
+ bitstream_t bitstream;
+ cp_key_t dak;
+ u8 buffer[1024];
+
+ dak.key[0] = 0x11111111;
+ dak.key[1] = 0x22222222;
+ dak.key[2] = 0x33333333;
+ dak.key[3] = 0x44444444;
+
+ memset (mme, 0, sizeof (*mme));
+ mme->mmtype = DRV_STA_SET_DAK_REQ;
+ cp_secu_protocol_run_new (&mme->prun, 0, &ctx.rnd);
+
+ bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+
+ for (i = 0; i < COUNT (dak.key); i++)
+ bitstream_access(&bitstream, &dak.key[i], 32);
+
+ bitstream_finalise (&bitstream);
+
+ mme->length = 16;
+
+ cp_sta_action_drv__stopped__drv_sta_set_dak_req (&ctx, mme);
+
+ for (i = 0; i < COUNT (dak.key); i++)
+ test_fail_unless (ctx.sta_mgr.sta_own_data.dak.key[i] == dak.key[i]);
+ cp_test_uninit (&ctx);
+ }
+ test_end;
+
+ test_begin (test, "Receiving and processing DRV_STA_SET_TONEMASK_REQ")
+ {
+ cp_t ctx;
+
+ cp_test_init (&ctx);
+
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+ uint i;
+ bitstream_t bitstream;
+ tonemask_info_t ti;
+ u8 buffer[2048];
+ u32 ff32, ff10;
+
+ ff32 = 0xffffffff;
+ ff10 = 0x3ff;
+
+ memset (mme, 0, sizeof (*mme));
+ mme->mmtype = DRV_STA_SET_TONEMASK_REQ;
+ cp_secu_protocol_run_new (&mme->prun, 0, &ctx.rnd);
+
+ bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+
+ ti.carrier_nb = tonemask_default (ti.tonemask);
+ tonemask_update(&ti);
+
+ /* ti.tonemask[2] = 0x3FFFFFFC by default,
+ * MSB coresponds to carrier 169 (0-enable,
+ * 1-disable), by default it is enabled (MSB = 0) */
+
+ /* disable carrier number 169
+ * (set MSB to 1, i.e. ti.tonemask[2] = 0xBFFFFFFC */
+ ti.tonemask[2] = 0xBFFFFFFC;
+ tonemask_update(&ti);
+
+ for (i = 0; i < PHY_CARRIER_OFFSET / 32; i++)
+ bitstream_access(&bitstream, &ff32, 32);
+
+ bitstream_access(&bitstream, &ff10, 10);
+
+ for (i = 0; i < PHY_TONEMASK_WORDS; i++)
+ {
+ bitstream_access(&bitstream, &ti.tonemask[i], 32);
+ }
+
+ for (i = 0; i <= (PHY_ALL_CARRIER_NB - PHY_TONEMASK_WORDS * 32 -
+ PHY_CARRIER_OFFSET) / 32; i++)
+ bitstream_access(&bitstream, &ff32, 32);
+
+ bitstream_finalise (&bitstream);
+
+ mme->length = PHY_TONEMASK_WORDS * 32 + PHY_CARRIER_OFFSET +
+ (PHY_ALL_CARRIER_NB - PHY_TONEMASK_WORDS * 32 -
+ PHY_CARRIER_OFFSET) ;
+
+ cp_sta_action_drv__stopped__drv_sta_set_tonemask_req (&ctx, mme);
+
+ test_fail_unless (ctx.mac_config->tonemask_info.carrier_nb ==
+ ti.carrier_nb);
+
+ for (i = 0; i < PHY_TONEMASK_WORDS; i++)
+ test_fail_unless (ctx.mac_config->tonemask_info.tonemask[i] ==
+ ti.tonemask[i]);
+ cp_test_uninit (&ctx);
+ }
+ test_end;
+
+ test_begin (test, "Receiving and processing DRV_STA_SET_CONFIG_REQ")
+ {
+ cp_t ctx;
+
+ cp_test_init (&ctx);
+
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+ uint i;
+ bitstream_t bitstream;
+ u8 buffer[1024];
+
+ char test_config[6] = "tei:1";
+
+ memset (mme, 0, sizeof (*mme));
+ mme->mmtype = DRV_STA_SET_CONFIG_REQ;
+ cp_secu_protocol_run_new (&mme->prun, 0, &ctx.rnd);
+
+ bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+
+ for(i = 0; i < 6; i++)
+ bitstream_access(&bitstream, &test_config[i], 8);
+
+ bitstream_finalise (&bitstream);
+
+ mme->length = 6;
+
+ cp_sta_action_drv__drv_sta_set_config_req (&ctx, mme);
+ cp_test_uninit (&ctx);
+ }
+ test_end;
+
+ test_begin (test, "Receiving and processing DRV_STA_GET_KEY_REQ")
+ {
+ cp_t ctx;
+
+ cp_test_init (&ctx);
+
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+ bitstream_t bitstream;
+ u8 buffer[1024];
+ cp_nid_t nid;
+ cp_net_t *net;
+ cp_key_t nmk;
+ cp_security_level_t sl;
+ u8 i;
+
+ memset (mme, 0, sizeof (*mme));
+ nmk.key[0] = 0x11111111;
+ nmk.key[1] = 0x22222222;
+ nmk.key[2] = 0x33333333;
+ nmk.key[3] = 0x44444444;
+
+ net = cp_sta_mgr_add_avln (&ctx, 1, 1);
+ cp_sta_mgr_set_our_avln (&ctx, net);
+
+ sl = CP_SECURITY_LEVEL_SC;
+ cp_sta_own_data_set_nmk (&ctx, nmk, 0);
+ nid = cp_secu_nmk2nid (&ctx, nmk, sl);
+ cp_sta_own_data_set_nid (&ctx, nid);
+
+ mme->mmtype = DRV_STA_GET_KEY_REQ;
+ cp_secu_protocol_run_new (&mme->prun, 0, &ctx.rnd);
+
+ bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+
+ bitstream_finalise (&bitstream);
+
+ cp_sta_action_drv__drv_sta_get_key_req (&ctx, mme);
+
+ test_fail_unless (ctx.sta_mgr.sta_own_data.nid == nid);
+
+ for (i = 0; i < COUNT (nmk.key); i++)
+ test_fail_unless (ctx.sta_mgr.sta_own_data.nmk.key[i] == nmk.key[i]);
+
+ test_fail_unless (ctx.sta_mgr.sta_own_data.security_level == sl);
+ cp_test_uninit (&ctx);
+ }
+ test_end;
+
+ test_begin (test, "Receiving and processing DRV_STA_MAC_START_REQ")
+ {
+ cp_t ctx;
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+ bitstream_t bitstream;
+ u8 buffer[1024];
+
+ cp_test_init (&ctx);
+
+ memset (mme, 0, sizeof (*mme));
+ mme->mmtype = DRV_STA_MAC_START_REQ;
+ cp_secu_protocol_run_new (&mme->prun, 0, &ctx.rnd);
+
+ bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+
+ bitstream_finalise (&bitstream);
+
+ cp_sta_action_drv__stopped__drv_sta_mac_start_req (&ctx, mme);
+ cp_test_uninit (&ctx);
+ }
+ test_end;
+
+ test_begin (test, "Receiving and processing DRV_STA_MAC_STOP_REQ")
+ {
+ cp_t ctx;
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+ bitstream_t bitstream;
+ u8 buffer[1024];
+
+ cp_test_init (&ctx);
+
+ memset (mme, 0, sizeof (*mme));
+ mme->peer.mac = 2;
+ mme->peer.tei = 5;
+ mme->peer.eth_type = ETH_TYPE_VLAN;
+ mme->peer.vlan_tci = 6;
+ mme->mmtype = DRV_STA_MAC_STOP_REQ;
+ cp_secu_protocol_run_new (&mme->prun, 0, &ctx.rnd);
+
+ bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+
+ bitstream_finalise (&bitstream);
+
+ cp_sta_action_drv__started__drv_sta_mac_stop_req (&ctx, mme);
+
+ test_fail_unless (ctx.sta_action.drv_peer.tei == mme->peer.tei);
+ test_fail_unless (ctx.sta_action.drv_peer.mac == mme->peer.mac);
+ test_fail_unless (ctx.sta_action.drv_peer.eth_type ==
+ mme->peer.eth_type);
+ test_fail_unless (ctx.sta_action.drv_peer.vlan_tci ==
+ mme->peer.vlan_tci);
+ cp_test_uninit (&ctx);
+ }
+ test_end;
+
+ test_begin (test, "cp_eoc_sta_action_sta_clear_status")
+ {
+ cp_t ctx;
+
+ cp_test_init (&ctx);
+
+ cp_net_t *net;
+
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+
+ net = cp_sta_mgr_add_avln (&ctx, 1, 1);
+ cp_sta_mgr_set_our_avln (&ctx, net);
+
+ memset (mme, 0, sizeof (*mme));
+ mme->peer.mac = 2;
+ mme->peer.tei = 5;
+ cp_sta_t *sta = cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei,
+ mme->peer.mac);
+
+ cp_eoc_sta_action_sta_clear_status(&ctx);
+
+ cp_sta_own_data_t *own_data = cp_sta_mgr_get_sta_own_data (&ctx);
+ test_fail_unless (own_data->tei_track == MAC_TEI_UNASSOCIATED);
+ test_fail_unless (cp_sta_own_data_get_tei (&ctx) ==
+ MAC_TEI_UNASSOCIATED);
+ test_fail_unless (cp_sta_own_data_get_authenticated_status (&ctx) ==
+ false);
+ test_fail_unless (ctx.sta_action.assoc.retry == 0);
+ test_fail_unless (ctx.sta_action.assoc.beacon_loss == 0);
+ cp_eoc_sta_mgr_sta_remove (&ctx, sta);
+ slab_release (sta);
+ test_fail_unless (mac_store_sta_remove (ctx.mac_store, mme->peer.tei));
+ cp_test_uninit (&ctx);
+ }
+ test_end
+
+ test_begin (test, "Call to cp_eoc_sta_action_assoc__detecting_detected")
+ {
+ cp_t ctx;
+ cp_test_init (&ctx);
+ cp_eoc_sta_action_assoc__detecting_detected (&ctx);
+ cp_test_uninit (&ctx);
+ }
+ test_end
+
+ test_begin (test, "Call cp_eoc_sta_action_assoc__beacon_received")
+ {
+ cp_t ctx;
+ cp_test_init (&ctx);
+
+ cp_net_t *net;
+ cp_sta_t *sta;
+ bsu_beacon_t beacon;
+ bsu_beacon_t *pbeacon = &beacon;
+
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+
+ net = cp_sta_mgr_add_avln (&ctx, 1, 1);
+ cp_sta_mgr_set_our_avln (&ctx, net);
+
+ memset (mme, 0, sizeof (*mme));
+ mme->peer.mac = 2;
+ mme->peer.tei = 5;
+ sta = cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei, mme->peer.mac);
+
+ cp_eoc_sta_action_assoc__beacon_received (&ctx, pbeacon, net, sta);
+
+ test_fail_unless (ctx.sta_action.assoc.beacon_loss == 0);
+ cp_eoc_sta_mgr_sta_remove (&ctx, sta);
+ slab_release (sta);
+ test_fail_unless (mac_store_sta_remove (ctx.mac_store, mme->peer.tei));
+ cp_test_uninit (&ctx);
+ }
+ test_end
+
+ test_begin (test, "Call cp_eoc_sta_action_auth__beacon_received")
+ {
+ cp_t ctx;
+
+ cp_test_init (&ctx);
+
+ cp_net_t *net;
+ cp_sta_t *sta;
+ bsu_beacon_t beacon;
+ bsu_beacon_t *pbeacon = &beacon;
+
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+
+ net = cp_sta_mgr_add_avln (&ctx, 1, 1);
+ cp_sta_mgr_set_our_avln (&ctx, net);
+
+ memset (mme, 0, sizeof (*mme));
+ mme->peer.mac = 2;
+ mme->peer.tei = 5;
+ sta = cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei, mme->peer.mac);
+
+ ctx.pbproc->polled = true;
+ ((cp_sta_private_t *)sta)->is_cco = true;
+
+ ctx.fsm.active_states[0] = CP_FSM_STATE_AUTHENTICATED;
+
+ cp_eoc_sta_action_auth__beacon_received (&ctx, pbeacon, net, sta);
+ test_fail_unless(ctx.fsm.active_states[0] == CP_FSM_STATE_AUTHENTICATED);
+ cp_eoc_sta_mgr_sta_remove (&ctx, sta);
+ slab_release (sta);
+ test_fail_unless (mac_store_sta_remove (ctx.mac_store, mme->peer.tei));
+ cp_test_uninit (&ctx);
+ }
+ test_end
+
+ test_begin (test, "Call cp_eoc_sta_action_assoc__associating_cnf"
+ " - success")
+ {
+ cp_t ctx;
+
+ cp_test_init (&ctx);
+ cp_net_t *net;
+ bitstream_t bitstream;
+ u8 result;
+ cp_nid_t nid;
+ cp_snid_t snid;
+ cp_tei_t tei;
+ u16 lease_time;
+ u8 buffer[1024];
+
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+
+ ctx.fsm.handled_active_state = 0;
+
+ result = CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS;
+ lease_time = 2;
+ nid = 0x11223344556677ull;
+ snid = 5;
+
+ memset (mme, 0, sizeof (*mme));
+ mme->peer.tei = tei = ctx.sta_action.assoc.peer.tei = 5;
+ mme->peer.mac = ctx.sta_action.assoc.peer.mac = 0x2;
+
+ net = cp_sta_mgr_add_avln (&ctx, snid, nid);
+ cp_sta_mgr_set_our_avln (&ctx, net);
+
+ cp_sta_t *sta = 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);
+ bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+ /* Mac address. */
+ bitstream_access (&bitstream, &result, 8);
+ bitstream_access (&bitstream, &nid, 56);
+ bitstream_access (&bitstream, &snid, 8);
+ bitstream_access (&bitstream, &tei, 8);
+ bitstream_access (&bitstream, &lease_time, 16);
+
+ bitstream_finalise (&bitstream);
+
+ mme->length = 60;
+
+ cp_fsm_event_t event;
+ ctx.fsm.handled_event = &event;
+ ctx.fsm.handled_event->type = CP_FSM_EVENT_TYPE_CC_ASSOC_CNF;
+ ctx.fsm.active_states[0] = CP_FSM_STATE_ASSOCIATING;
+
+ cp_eoc_sta_action_assoc__associating_cnf (&ctx, mme);
+
+ test_fail_unless(ctx.fsm.active_states[0] == CP_FSM_STATE_ASSOCIATED);
+ cp_eoc_sta_mgr_sta_remove (&ctx, sta);
+ slab_release (sta);
+ cp_eoc_cco_action_test_release_mac_store (&ctx);
+ test_fail_unless (
+ mac_store_sta_remove (ctx.mac_store, mme->peer.tei));
+ cp_test_uninit (&ctx);
+ }
+ test_end
+
+ test_begin (test, "Call cp_eoc_sta_action_assoc__associating_cnf"
+ " - temporary ressource exhaustion")
+ {
+ cp_t ctx;
+
+ cp_test_init (&ctx);
+ cp_net_t *net;
+ bitstream_t bitstream;
+ u8 result;
+ cp_nid_t nid;
+ cp_snid_t snid;
+ cp_tei_t tei;
+ u16 lease_time;
+ u8 buffer[1024];
+
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+
+ ctx.fsm.handled_active_state = 0;
+
+ result =
+ CP_MSG_CC_ASSOC_CNF_RESULT_FAILURE_TEMPORARY_RESSOURCE_EXHAUSTION;
+ lease_time = 2;
+ nid = 0x11223344556677ull;
+ snid = 5;
+
+ memset (mme, 0, sizeof (*mme));
+ mme->peer.tei = tei = ctx.sta_action.assoc.peer.tei = 5;
+ mme->peer.mac = ctx.sta_action.assoc.peer.mac = 0x2;
+
+ net = cp_sta_mgr_add_avln (&ctx, snid, nid);
+ cp_sta_mgr_set_our_avln (&ctx, net);
+
+ cp_sta_t *sta = 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);
+ bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+ /* Mac address. */
+ bitstream_access (&bitstream, &result, 8);
+ bitstream_access (&bitstream, &nid, 56);
+ bitstream_access (&bitstream, &snid, 8);
+ bitstream_access (&bitstream, &tei, 8);
+ bitstream_access (&bitstream, &lease_time, 16);
+
+ bitstream_finalise (&bitstream);
+
+ mme->length = 60;
+
+ cp_fsm_event_t event;
+ ctx.fsm.handled_event = &event;
+ ctx.fsm.handled_event->type = CP_FSM_EVENT_TYPE_CC_ASSOC_CNF;
+ ctx.fsm.active_states[0] = CP_FSM_STATE_ASSOCIATING;
+
+ cp_eoc_sta_action_assoc__associating_cnf (&ctx, mme);
+
+ test_fail_unless(ctx.fsm.active_states[0]
+ == CP_FSM_STATE_UNASSOCIATED);
+ test_fail_unless (ctx.sta_action.assoc.fast_retry == 1);
+
+ cp_eoc_sta_mgr_sta_remove (&ctx, sta);
+ slab_release (sta);
+ cp_eoc_cco_action_test_release_mac_store (&ctx);
+ test_fail_unless (
+ mac_store_sta_remove (ctx.mac_store, mme->peer.tei));
+ cp_test_uninit (&ctx);
+ }
+ test_end
+
+ test_begin (test, "Call cp_eoc_sta_action_assoc__associating_cnf"
+ " - permanent ressource exhaustion")
+ {
+ cp_t ctx;
+
+ cp_test_init (&ctx);
+ cp_net_t *net;
+ bitstream_t bitstream;
+ u8 result;
+ cp_nid_t nid;
+ cp_snid_t snid;
+ cp_tei_t tei;
+ u16 lease_time;
+ u8 buffer[1024];
+
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+
+ ctx.fsm.handled_active_state = 0;
+
+ result =
+ CP_MSG_CC_ASSOC_CNF_RESULT_FAILURE_PERMANANT_RESSOURCE_EXHAUSTION;
+ lease_time = 2;
+ nid = 0x11223344556677ull;
+ snid = 5;
+
+ memset (mme, 0, sizeof (*mme));
+ mme->peer.tei = tei = ctx.sta_action.assoc.peer.tei = 5;
+ mme->peer.mac = ctx.sta_action.assoc.peer.mac = 0x2;
+
+ net = cp_sta_mgr_add_avln (&ctx, snid, nid);
+ cp_sta_mgr_set_our_avln (&ctx, net);
+
+ cp_sta_t *sta = 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);
+ bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+ /* Mac address. */
+ bitstream_access (&bitstream, &result, 8);
+ bitstream_access (&bitstream, &nid, 56);
+ bitstream_access (&bitstream, &snid, 8);
+ bitstream_access (&bitstream, &tei, 8);
+ bitstream_access (&bitstream, &lease_time, 16);
+
+ bitstream_finalise (&bitstream);
+
+ mme->length = 60;
+
+ cp_fsm_event_t event;
+ ctx.fsm.handled_event = &event;
+ ctx.fsm.handled_event->type = CP_FSM_EVENT_TYPE_CC_ASSOC_CNF;
+ ctx.fsm.active_states[0] = CP_FSM_STATE_ASSOCIATING;
+
+ cp_eoc_sta_action_assoc__associating_cnf (&ctx, mme);
+
+ test_fail_unless(ctx.fsm.active_states[0]
+ == CP_FSM_STATE_UNASSOCIATED);
+ test_fail_unless (ctx.sta_action.assoc.fast_retry == 0);
+
+ cp_eoc_sta_mgr_sta_remove (&ctx, sta);
+ slab_release (sta);
+ cp_eoc_cco_action_test_release_mac_store (&ctx);
+ test_fail_unless (
+ mac_store_sta_remove (ctx.mac_store, mme->peer.tei));
+ cp_test_uninit (&ctx);
+ }
+ test_end
+
+ test_begin (test, "cp_eoc_sta_action_assoc__associating_no_beacons")
+ {
+ cp_t ctx;
+
+ cp_test_init (&ctx);
+
+ cp_net_t *net;
+
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+
+ net = cp_sta_mgr_add_avln (&ctx, 1, 1);
+ cp_sta_mgr_set_our_avln (&ctx, net);
+
+ memset (mme, 0, sizeof (*mme));
+ mme->peer.mac = 2;
+ mme->peer.tei = 5;
+ cp_sta_t *sta = cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei,
+ mme->peer.mac);
+
+ cp_eoc_sta_action_assoc__associating_no_beacons(&ctx);
+
+ cp_sta_own_data_t *own_data = cp_sta_mgr_get_sta_own_data (&ctx);
+ test_fail_unless (own_data->tei_track == MAC_TEI_UNASSOCIATED);
+ test_fail_unless (cp_sta_own_data_get_tei (&ctx) ==
+ MAC_TEI_UNASSOCIATED);
+ test_fail_unless (cp_sta_own_data_get_authenticated_status (&ctx) ==
+ false);
+ test_fail_unless (ctx.sta_action.assoc.retry == 0);
+ test_fail_unless (ctx.sta_action.assoc.beacon_loss == 0);
+ cp_eoc_sta_mgr_sta_remove (&ctx, sta);
+ slab_release (sta);
+ cp_eoc_cco_action_test_release_mac_store (&ctx);
+ test_fail_unless (mac_store_sta_remove (ctx.mac_store, mme->peer.tei));
+ cp_test_uninit (&ctx);
+ }
+ test_end
+
+ test_begin (test, "cp_eoc_sta_action_assoc__unassociated_retry")
+ {
+ cp_t ctx;
+ cp_eoc_sta_action_assoc__unassociated_retry(&ctx);
+ }
+ test_end
+
+ test_begin (test, "Call cp_eoc_sta_action_assoc__associated_key_cnf")
+ {
+ cp_t ctx;
+
+ cp_test_init (&ctx);
+
+ cp_net_t *net;
+ bitstream_t bitstream;
+ u8 result, eks, req_key_type;
+ cp_nid_t nid;
+ cp_snid_t snid=0;
+ cp_tei_t tei;
+ u8 buffer[1024];
+ cp_key_t nmk;
+
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+
+ memset (mme, 0, sizeof (*mme));
+ 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);
+
+ result = CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED;
+ req_key_type = CP_MSG_KEY_NEK;
+ mme->prun.prn = ctx.sta_action.assoc.prun.prn = 1;
+ nid = 0x11223344556677ull;
+ eks = 0;
+ mme->prun.pid = ctx.sta_action.assoc.prun.pid = 2;
+ ctx.sta_action.assoc.prun.pmn = 1;
+ mme->prun.pmn = ctx.sta_action.assoc.prun.pmn + 1;
+ mme->peks = CP_MME_PEKS_DAK;
+
+ nmk.key[0] = 0x11111111;
+ nmk.key[1] = 0x22222222;
+ nmk.key[2] = 0x33333333;
+ nmk.key[3] = 0x44444444;
+
+ mme->peer.tei = tei = ctx.sta_action.assoc.peer.tei = 5;
+ mme->peer.mac = ctx.sta_action.assoc.peer.mac = 0x2;
+
+ net = cp_sta_mgr_add_avln (&ctx, snid, nid);
+ cp_sta_mgr_set_our_avln (&ctx, net);
+
+ cp_sta_t *sta = 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);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+
+ bitstream_access (&bitstream, &result, 8);
+ bitstream_access (&bitstream, &req_key_type, 8);
+ /* Reverse nonce order (simulate other side). */
+ bitstream_access (&bitstream, &mme->prun.your_nonce, 32);
+ bitstream_access (&bitstream, &mme->prun.my_nonce, 32);
+ bitstream_access (&bitstream, &nid, 56);
+ bitstream_access (&bitstream, &eks, 8);
+ bitstream_access (&bitstream, &mme->prun.pid, 8);
+ bitstream_access (&bitstream, &mme->prun.prn, 16);
+ bitstream_access (&bitstream, &mme->prun.pmn, 8);
+ bitstream_access (&bitstream, &nmk.key[0], 32);
+ bitstream_access (&bitstream, &nmk.key[1], 32);
+ bitstream_access (&bitstream, &nmk.key[2], 32);
+ bitstream_access (&bitstream, &nmk.key[3], 32);
+
+ bitstream_finalise (&bitstream);
+
+ mme->length = 38;
+
+ cp_fsm_event_t event;
+ ctx.fsm.handled_event = &event;
+ ctx.fsm.active_states[0] = CP_FSM_STATE_ASSOCIATED;
+ ctx.fsm.handled_event->type = CP_FSM_EVENT_TYPE_CM_GET_KEY_CNF;
+
+ cp_eoc_sta_action_assoc__associated_key_cnf (&ctx, mme);
+
+ test_fail_unless(ctx.fsm.active_states[0] == CP_FSM_STATE_AUTHENTICATED);
+ cp_eoc_sta_mgr_sta_remove (&ctx, sta);
+ slab_release (sta);
+ cp_eoc_cco_action_test_release_mac_store (&ctx);
+ test_fail_unless (mac_store_sta_remove (ctx.mac_store, mme->peer.tei));
+ cp_test_uninit (&ctx);
+ }
+ test_end
+
+ test_begin (test, "Call cp_eoc_sta_action_auth__authenticated_key_cnf")
+ {
+ cp_t ctx;
+
+ cp_test_init (&ctx);
+
+ cp_net_t *net;
+ cp_sta_t *sta;
+ bitstream_t bitstream;
+ u8 result, eks, req_key_type;
+ cp_nid_t nid;
+ cp_snid_t snid=0;
+ cp_tei_t tei;
+ u8 buffer[1024];
+ cp_key_t nmk;
+
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+
+ memset (mme, 0, sizeof (*mme));
+ 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);
+
+ result = CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED;
+ req_key_type = CP_MSG_KEY_TEK;
+ mme->prun.prn = ctx.sta_action.assoc.prun.prn = 1;
+ nid = 0x11223344556677ull;
+ eks = 0;
+ mme->prun.pid = ctx.sta_action.assoc.prun.pid = 2;
+ ctx.sta_action.assoc.prun.pmn = 1;
+ mme->prun.pmn = 0xFF;
+ mme->peks = CP_MME_PEKS_DAK;
+
+ nmk.key[0] = 0x11111111;
+ nmk.key[1] = 0x22222222;
+ nmk.key[2] = 0x33333333;
+ nmk.key[3] = 0x44444444;
+
+ mme->peer.tei = tei = ctx.sta_action.assoc.peer.tei = 5;
+ mme->peer.mac = ctx.sta_action.assoc.peer.mac = 0x2;
+
+ //set our avln
+ 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);
+
+ mme->mmtype = CM_GET_KEY_CNF;
+ bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+
+ bitstream_access (&bitstream, &result, 8);
+ bitstream_access (&bitstream, &req_key_type, 8);
+ /* Reverse nonce order (simulate other side). */
+ bitstream_access (&bitstream, &mme->prun.your_nonce, 32);
+ bitstream_access (&bitstream, &mme->prun.my_nonce, 32);
+ bitstream_access (&bitstream, &nid, 56);
+ bitstream_access (&bitstream, &eks, 8);
+ bitstream_access (&bitstream, &mme->prun.pid, 8);
+ bitstream_access (&bitstream, &mme->prun.prn, 16);
+ bitstream_access (&bitstream, &mme->prun.pmn, 8);
+ bitstream_access (&bitstream, &nmk.key[0], 32);
+ bitstream_access (&bitstream, &nmk.key[1], 32);
+ bitstream_access (&bitstream, &nmk.key[2], 32);
+ bitstream_access (&bitstream, &nmk.key[3], 32);
+
+ bitstream_finalise (&bitstream);
+
+ mme->length = 38;
+
+ cp_fsm_event_t event;
+ ctx.fsm.handled_event = &event;
+ ctx.fsm.active_states[0] = CP_FSM_STATE_AUTHENTICATED;
+ ctx.fsm.handled_event->type = CP_FSM_EVENT_TYPE_CM_GET_KEY_CNF;
+
+ cp_eoc_sta_action_auth__authenticated_key_cnf (&ctx, mme);
+
+ test_fail_unless(ctx.fsm.active_states[0] == CP_FSM_STATE_AUTHENTICATED);
+ test_fail_unless(cp_sta_get_authenticated (&ctx, sta));
+ cp_eoc_sta_mgr_sta_remove (&ctx, sta);
+ slab_release (sta);
+ cp_eoc_cco_action_test_release_mac_store (&ctx);
+ test_fail_unless (mac_store_sta_remove (ctx.mac_store, mme->peer.tei));
+ cp_test_uninit (&ctx);
+ }
+ test_end
+
+ test_begin (test, "Call cp_eoc_sta_action_auth__authenticated_set_key_req")
+ {
+ cp_t ctx;
+
+ cp_test_init (&ctx);
+
+ cp_net_t *net;
+ cp_sta_t *sta;
+ bitstream_t bitstream;
+ u8 eks, req_key_type, cco_cap;
+ cp_nid_t nid;
+ cp_snid_t snid=0;
+ cp_tei_t tei;
+ u8 buffer[1024];
+ cp_key_t nmk;
+
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+
+ memset (mme, 0, sizeof (*mme));
+ 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);
+
+ req_key_type = CP_MSG_KEY_NEK;
+ mme->prun.prn = ctx.sta_action.nek_prun.prn = 1;
+ nid = 0x11223344556677ull;
+ cco_cap = 1;
+ eks = 0;
+ mme->prun.pid = ctx.sta_action.nek_prun.pid = 2;
+ ctx.sta_action.nek_prun.pmn = 1;
+ mme->prun.pmn = ctx.sta_action.nek_prun.pmn + 1;
+ mme->peks = CP_MME_PEKS_DAK;
+
+ //sample network membership key:
+ nmk.key[0] = 0x11111111;
+ nmk.key[1] = 0x22222222;
+ nmk.key[2] = 0x33333333;
+ nmk.key[3] = 0x44444444;
+ mme->peer.tei = tei = ctx.sta_action.assoc.peer.tei = 5;
+ mme->peer.mac = ctx.sta_action.assoc.peer.mac = 0x2;
+
+ 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);
+
+ net->cco = sta;
+
+ mme->mmtype = CM_SET_KEY_REQ;
+ bitstream_init (&my_mme.bitstream, buffer, sizeof(buffer),
+ BITSTREAM_READ);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+
+ bitstream_access (&bitstream, &req_key_type, 8);
+ /* Reverse nonce order (simulate other side). */
+ bitstream_access (&bitstream, &mme->prun.your_nonce, 32);
+ bitstream_access (&bitstream, &mme->prun.my_nonce, 32);
+ bitstream_access (&bitstream, &mme->prun.pid, 8);
+ bitstream_access (&bitstream, &mme->prun.prn, 16);
+ bitstream_access (&bitstream, &mme->prun.pmn, 8);
+ bitstream_access (&bitstream, &cco_cap, 8);
+ bitstream_access (&bitstream, &nid, 56);
+ bitstream_access (&bitstream, &eks, 8);
+ bitstream_access (&bitstream, &nmk.key[0], 32);
+ bitstream_access (&bitstream, &nmk.key[1], 32);
+ bitstream_access (&bitstream, &nmk.key[2], 32);
+ bitstream_access (&bitstream, &nmk.key[3], 32);
+
+ bitstream_finalise (&bitstream);
+
+ mme->length = 38;
+
+ cp_fsm_event_t event;
+ ctx.fsm.handled_event = &event;
+ ctx.fsm.active_states[0] = CP_FSM_STATE_AUTHENTICATED;
+ ctx.fsm.handled_event->type = CP_FSM_EVENT_TYPE_CM_SET_KEY_REQ;
+
+ cp_eoc_sta_action_auth__authenticated_set_key_req (&ctx, mme);
+
+ test_fail_unless (ctx.fsm.active_states[0] ==
+ CP_FSM_STATE_AUTHENTICATED);
+ /* It should be last action. */
+ test_fail_unless (ctx.sta_action.nek_prun.pmn == 0xFF);
+ cp_eoc_sta_mgr_sta_remove (&ctx, sta);
+ slab_release (sta);
+ cp_eoc_cco_action_test_release_mac_store (&ctx);
+ test_fail_unless (mac_store_sta_remove (ctx.mac_store, mme->peer.tei));
+ cp_test_uninit (&ctx);
+ }
+ test_end
+
+ test_begin (test, "cp_eoc_sta_action_assoc__associated_no_beacons")
+ {
+ cp_t ctx;
+
+ cp_test_init (&ctx);
+
+ cp_net_t *net;
+
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+
+ net = cp_sta_mgr_add_avln (&ctx, 1, 1);
+ cp_sta_mgr_set_our_avln (&ctx, net);
+
+ memset (mme, 0, sizeof (*mme));
+ mme->peer.mac = 2;
+ mme->peer.tei = 5;
+ cp_sta_t *sta = cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei,
+ mme->peer.mac);
+
+ cp_eoc_sta_action_assoc__associated_no_beacons(&ctx);
+
+ cp_sta_own_data_t *own_data = cp_sta_mgr_get_sta_own_data (&ctx);
+ test_fail_unless (own_data->tei_track == MAC_TEI_UNASSOCIATED);
+ test_fail_unless (cp_sta_own_data_get_tei (&ctx) ==
+ MAC_TEI_UNASSOCIATED);
+ test_fail_unless (cp_sta_own_data_get_authenticated_status (&ctx) ==
+ false);
+ test_fail_unless (ctx.sta_action.assoc.retry == 0);
+ test_fail_unless (ctx.sta_action.assoc.beacon_loss == 0);
+ cp_eoc_sta_mgr_sta_remove (&ctx, sta);
+ slab_release (sta);
+ cp_eoc_cco_action_test_release_mac_store (&ctx);
+ test_fail_unless (mac_store_sta_remove (ctx.mac_store, mme->peer.tei));
+ cp_test_uninit (&ctx);
+ }
+ test_end
+
+ test_begin (test, "cp_eoc_sta_action_assoc__associated_timeout")
+ {
+ cp_t ctx;
+
+ cp_test_init (&ctx);
+
+ cp_net_t *net;
+
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+
+ net = cp_sta_mgr_add_avln (&ctx, 1, 1);
+ cp_sta_mgr_set_our_avln (&ctx, net);
+
+ memset (mme, 0, sizeof (*mme));
+ mme->peer.mac = 2;
+ mme->peer.tei = 5;
+ cp_sta_t *sta = cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei,
+ mme->peer.mac);
+
+ cp_eoc_sta_action_assoc__associated_timeout(&ctx);
+
+ cp_sta_own_data_t *own_data = cp_sta_mgr_get_sta_own_data (&ctx);
+ test_fail_unless (own_data->tei_track == MAC_TEI_UNASSOCIATED);
+ test_fail_unless (cp_sta_own_data_get_tei (&ctx) ==
+ MAC_TEI_UNASSOCIATED);
+ test_fail_unless (cp_sta_own_data_get_authenticated_status (&ctx) ==
+ false);
+ test_fail_unless (ctx.sta_action.assoc.retry == 0);
+ test_fail_unless (ctx.sta_action.assoc.beacon_loss == 0);
+ cp_eoc_sta_mgr_sta_remove (&ctx, sta);
+ slab_release (sta);
+ cp_eoc_cco_action_test_release_mac_store (&ctx);
+ test_fail_unless (mac_store_sta_remove (ctx.mac_store, mme->peer.tei));
+ cp_test_uninit (&ctx);
+ }
+ test_end
+
+ test_begin (test, "Call cp_eoc_sta_action_assoc__associated_leave")
+ {
+ cp_t ctx;
+
+ cp_test_init (&ctx);
+
+ cp_net_t *net;
+ bitstream_t bitstream;
+ u8 reason;
+ cp_nid_t nid;
+ cp_snid_t snid;
+ u8 buffer[1024];
+
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+
+ reason = 0;
+ nid = 0x11223344556677ull;
+ snid = 4;
+
+ memset (mme, 0, sizeof (*mme));
+ mme->peer.tei = 5;
+ mme->peer.mac = 0x2;
+
+ net = cp_sta_mgr_add_avln (&ctx, snid, nid);
+ cp_sta_mgr_set_our_avln (&ctx, net);
+
+ cp_sta_t *sta = 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);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+
+ bitstream_access (&bitstream, &reason, 8);
+ bitstream_access (&bitstream, &nid, 56);
+
+ bitstream_finalise (&bitstream);
+
+ mme->length = 8;
+
+ cp_fsm_event_t event;
+ ctx.fsm.handled_event = &event;
+ ctx.fsm.active_states[0] = CP_FSM_STATE_ASSOCIATED;
+ ctx.fsm.handled_event->type = CP_FSM_EVENT_TYPE_CC_LEAVE_IND;
+
+ cp_eoc_sta_action_assoc__associated_leave (&ctx, mme);
+
+ cp_sta_own_data_t *own_data = cp_sta_mgr_get_sta_own_data (&ctx);
+
+ test_fail_unless(ctx.fsm.active_states[0] ==
+ CP_FSM_STATE_DETECTING_BEACON);
+ test_fail_unless (own_data->tei_track == MAC_TEI_UNASSOCIATED);
+ test_fail_unless (cp_sta_own_data_get_tei (&ctx) ==
+ MAC_TEI_UNASSOCIATED);
+ test_fail_unless (cp_sta_own_data_get_authenticated_status (&ctx) ==
+ false);
+ test_fail_unless (ctx.sta_action.assoc.retry == 0);
+ test_fail_unless (ctx.sta_action.assoc.beacon_loss == 0);
+ cp_eoc_sta_mgr_sta_remove (&ctx, sta);
+ slab_release (sta);
+ cp_eoc_cco_action_test_release_mac_store (&ctx);
+ test_fail_unless (mac_store_sta_remove (ctx.mac_store, mme->peer.tei));
+ cp_test_uninit (&ctx);
+ }
+ test_end
+
+ test_begin (test, "Call cp_eoc_sta_action_assoc__authenticated_leave")
+ {
+ cp_t ctx;
+
+ cp_test_init (&ctx);
+
+ cp_net_t *net;
+ bitstream_t bitstream;
+ u8 reason;
+ cp_nid_t nid;
+ cp_snid_t snid;
+ u8 buffer[1024];
+
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+
+ reason = 0;
+ nid = 0x11223344556677ull;
+ snid = 4;
+
+ memset (mme, 0, sizeof (*mme));
+ mme->peer.tei = 5;
+ mme->peer.mac = 0x2;
+
+ net = cp_sta_mgr_add_avln (&ctx, snid, nid);
+ cp_sta_mgr_set_our_avln (&ctx, net);
+
+ cp_sta_t *sta = 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);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+
+ bitstream_access (&bitstream, &reason, 8);
+ bitstream_access (&bitstream, &nid, 56);
+
+ bitstream_finalise (&bitstream);
+
+ mme->length = 8;
+
+ cp_fsm_event_t event;
+ ctx.fsm.handled_event = &event;
+ ctx.fsm.active_states[0] = CP_FSM_STATE_AUTHENTICATED;
+ ctx.fsm.handled_event->type = CP_FSM_EVENT_TYPE_CC_LEAVE_IND;
+
+ cp_eoc_sta_action_assoc__authenticated_leave (&ctx, mme);
+
+ cp_sta_own_data_t *own_data = cp_sta_mgr_get_sta_own_data (&ctx);
+
+ test_fail_unless(ctx.fsm.active_states[0] ==
+ CP_FSM_STATE_DETECTING_BEACON);
+ test_fail_unless (own_data->tei_track == MAC_TEI_UNASSOCIATED);
+ test_fail_unless (cp_sta_own_data_get_tei (&ctx) ==
+ MAC_TEI_UNASSOCIATED);
+ test_fail_unless (cp_sta_own_data_get_authenticated_status (&ctx) ==
+ false);
+ test_fail_unless (ctx.sta_action.assoc.retry == 0);
+ test_fail_unless (ctx.sta_action.assoc.beacon_loss == 0);
+ cp_eoc_sta_mgr_sta_remove (&ctx, sta);
+ slab_release (sta);
+ cp_eoc_cco_action_test_release_mac_store (&ctx);
+ test_fail_unless (mac_store_sta_remove (ctx.mac_store, mme->peer.tei));
+ cp_test_uninit (&ctx);
+ }
+ test_end
+
+ test_begin (test, "cp_eoc_sta_action_assoc__authenticated_no_beacons")
+ {
+ cp_t ctx;
+
+ cp_test_init (&ctx);
+
+ cp_net_t *net;
+
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+
+ net = cp_sta_mgr_add_avln (&ctx, 1, 1);
+ cp_sta_mgr_set_our_avln (&ctx, net);
+
+ memset (mme, 0, sizeof (*mme));
+ mme->peer.mac = 2;
+ mme->peer.tei = 5;
+ cp_sta_t *sta = cp_sta_mgr_sta_add (&ctx, net, mme->peer.tei,
+ mme->peer.mac);
+
+ cp_eoc_sta_action_assoc__authenticated_no_beacons(&ctx);
+
+ cp_sta_own_data_t *own_data = cp_sta_mgr_get_sta_own_data (&ctx);
+ test_fail_unless (own_data->tei_track == MAC_TEI_UNASSOCIATED);
+ test_fail_unless (cp_sta_own_data_get_tei (&ctx) ==
+ MAC_TEI_UNASSOCIATED);
+ test_fail_unless (cp_sta_own_data_get_authenticated_status (&ctx) ==
+ false);
+ test_fail_unless (ctx.sta_action.assoc.retry == 0);
+ test_fail_unless (ctx.sta_action.assoc.beacon_loss == 0);
+ cp_eoc_sta_mgr_sta_remove (&ctx, sta);
+ slab_release (sta);
+ cp_eoc_cco_action_test_release_mac_store (&ctx);
+ test_fail_unless (mac_store_sta_remove (ctx.mac_store, mme->peer.tei));
+ cp_test_uninit (&ctx);
+ }
+ test_end
+
+ test_begin (test, "cp_eoc_sta_action_assoc__beacon_not_received")
+ {
+ cp_t ctx;
+ cp_test_init (&ctx);
+
+ ctx.sta_action.assoc.beacon_loss = CP_MAX_NO_BEACON + 1;
+
+ cp_eoc_sta_action_assoc__beacon_not_received(&ctx);
+
+ test_fail_unless (ctx.sta_action.assoc.beacon_loss == 0);
+ cp_test_uninit (&ctx);
+ }
+ test_end
+
+ test_begin (test, "cp_eoc_sta_action_auth__authenticated_set_out_lev")
+ {
+ cp_t ctx;
+
+ cp_test_init (&ctx);
+
+ cp_net_t *net;
+ bitstream_t bitstream;
+ u8 out_level;
+ u8 buffer[1024];
+
+ cp_mme_rx_t my_mme;
+ cp_mme_rx_t *mme = &my_mme;
+
+ memset (mme, 0, sizeof (*mme));
+ mme->peer.tei = 5;
+ mme->peer.mac = 0x2;
+ out_level = 120;
+
+ //set our avln
+ net = cp_sta_mgr_add_avln (&ctx, 1, 1);
+ cp_sta_mgr_set_our_avln (&ctx, net);
+
+ cp_sta_t *sta = 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);
+
+ /* Build the MME. */
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+
+ bitstream_access (&bitstream, &out_level, 8);
+
+ bitstream_finalise (&bitstream);
+
+ mme->length = 1;
+
+ cp_eoc_sta_action_auth__authenticated_set_out_lev(&ctx, mme);
+ cp_eoc_sta_mgr_sta_remove (&ctx, sta);
+ slab_release (sta);
+ cp_eoc_cco_action_test_release_mac_store (&ctx);
+ test_fail_unless (mac_store_sta_remove (ctx.mac_store, mme->peer.tei));
+ cp_test_uninit (&ctx);
+ }
+ test_end
+}
+
+
+void
+test_case_poweron (test_t test)
+{
+ test_case_begin (test, "Poweron");
+
+ test_begin (test, "Rcv & process cp_eoc_sta_action__power_on_no_beacons")
+ {
+ cp_t ctx;
+ cp_sta_own_data_t *own;
+
+ cp_test_init (&ctx);
+
+ ctx.sta_mgr.sta_own_data.nid = 1;
+ ctx.sta_mgr.sta_own_data.snid = 1;
+
+ cp_eoc_sta_action__power_on_no_beacons (&ctx);
+
+ own = cp_sta_mgr_get_sta_own_data (&ctx);
+
+ test_fail_unless(cp_sta_own_data_get_tei(&ctx) == MAC_TEI_UNASSOCIATED);
+ test_fail_unless(cp_sta_own_data_get_authenticated_status(&ctx) ==
+ false);
+ test_fail_unless(cp_sta_mgr_get_our_avln(&ctx) != NULL);
+ test_fail_unless(own->nid_track == cp_sta_own_data_get_nid (&ctx));
+ test_fail_unless(cp_sta_own_data_get_cco_status(&ctx) == false);
+ test_fail_unless(own->tei_track == MAC_TEI_UNASSOCIATED);
+ test_fail_unless(ctx.sta_action.assoc.retry == 0);
+ test_fail_unless(ctx.sta_action.assoc.beacon_loss == 0);
+ cp_test_uninit (&ctx);
+ }
+ test_end
+
+ test_begin (test, "Rcv & process cp_sta_action_poweron__idle__to_poweron")
+ {
+ cp_t ctx;
+ cp_test_init (&ctx);
+
+ ctx.sta_mgr.sta_own_data.nid = 1;
+ ctx.sta_mgr.sta_own_data.snid = 1;
+
+ cp_sta_action_poweron__idle__to_poweron (&ctx);
+
+ test_fail_unless(ctx.sta_action.assoc.peer.mac == \
+ CP_MME_PEER (MAC_BROADCAST, MAC_TEI_UNASSOCIATED).mac);
+ test_fail_unless(ctx.sta_action.assoc.peer.eth_type ==
+ CP_MME_PEER (MAC_BROADCAST, MAC_TEI_UNASSOCIATED).eth_type);
+ test_fail_unless(ctx.sta_action.assoc.peer.vlan_tci ==
+ CP_MME_PEER (MAC_BROADCAST, MAC_TEI_UNASSOCIATED).vlan_tci);
+ test_fail_unless(ctx.sta_action.assoc.peer.tei ==
+ CP_MME_PEER (MAC_BROADCAST, MAC_TEI_UNASSOCIATED).tei);
+ cp_test_uninit (&ctx);
+ }
+ test_end
+}
+
+
+void
+test_action_test_suite (test_t t)
+{
+ test_suite_begin (t, "sta_action");
+ test_case_association_and_authentication_action (t);
+ test_case_poweron (t);
+}
+
+
+int
+main (int argc, char **argv)
+{
+ test_t t;
+ trace_init ();
+ test_init (t, argc, argv);
+ test_action_test_suite (t);
+ trace_uninit ();
+
+ test_case_begin (t, "Memory allocation");
+ test_begin (t, "memory leaks")
+ {
+ test_fail_if (blk_check_memory () != true, "Memory leaks");
+ }
+ test_end;
+
+ test_result (t);
+ return test_nb_failed (t) == 0 ? 0 : 1;
+}
diff --git a/cesar/cp/eoc/sta/action/test/utest/src/test_fsm.c b/cesar/cp/eoc/sta/action/test/utest/src/test_fsm.c
new file mode 100644
index 0000000000..9e6ddf4e9a
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest/src/test_fsm.c
@@ -0,0 +1,743 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2010 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/test_fsm.c
+ * \brief Test FSM module.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "lib/blk.h"
+#include "lib/test.h"
+#include "lib/scenario/scenario.h"
+#include "cp/fsm/fsm.h"
+#include "cp/inc/context.h"
+#include "cp/sta/core/core.h"
+
+void
+test_fsm_basic_test_case (test_t t)
+{
+ test_case_begin (t, "basic");
+ cp_t cp;
+ cp.sta_core_urgent_flag = false;
+ cp_trace_init (&cp);
+
+ test_begin (t, "successuful authentication")
+ {
+ cp_fsm_init (&cp);
+ cp.sta_core_flag = false;
+ scenario_entry_t entries[] = {
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_SET_MAC_ADDR_REQ),
+ SCENARIO_EVENT (cp_fsm__STOPPED__drv_sta_set_mac_addr_req),
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_SET_CCO_PREF_REQ),
+ SCENARIO_EVENT (cp_fsm__STOPPED__drv_sta_set_cco_pref_req),
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_SET_WAS_CCO_REQ),
+ SCENARIO_EVENT (cp_fsm__STOPPED__drv_sta_set_was_cco_req),
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_SET_NPW_REQ),
+ SCENARIO_EVENT (cp_fsm__STOPPED__drv_sta_set_npw_req),
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_SET_DPW_REQ),
+ SCENARIO_EVENT (cp_fsm__STOPPED__drv_sta_set_dpw_req),
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_SET_SL_REQ),
+ SCENARIO_EVENT (cp_fsm__STOPPED__drv_sta_set_sl_req),
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_SET_NID_REQ),
+ SCENARIO_EVENT (cp_fsm__STOPPED__drv_sta_set_nid_req),
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_SET_TONEMASK_REQ),
+ SCENARIO_EVENT (cp_fsm__STOPPED__drv_sta_set_tonemask_req),
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_SET_KEY_REQ),
+ SCENARIO_EVENT (cp_fsm__STOPPED__drv_sta_set_key_req),
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_SET_DAK_REQ),
+ SCENARIO_EVENT (cp_fsm__STOPPED__drv_sta_set_dak_req),
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_SET_M_STA_HFID_REQ),
+ SCENARIO_EVENT (cp_fsm__STOPPED__drv_sta_set_m_sta_hfid_req),
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_SET_U_STA_HFID_REQ),
+ SCENARIO_EVENT (cp_fsm__STOPPED__drv_sta_set_u_sta_hfid_req),
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_SET_AVLN_HFID_REQ),
+ SCENARIO_EVENT (cp_fsm__STOPPED__drv_sta_set_avln_hfid_req),
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_SET_CONFIG_REQ),
+ SCENARIO_EVENT (cp_sta_action_drv__drv_sta_set_config_req),
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_MAC_START_REQ),
+ SCENARIO_EVENT (cp_fsm__STOPPED__drv_sta_mac_start_req),
+ /* STARTED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_to_poweron),
+ SCENARIO_EVENT (cp_fsm__STARTED__poweron__idle__to_poweron),
+ /* DETECTING_BEACON */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_BEACON),
+ SCENARIO_EVENT (cp_fsm__DETECTING_BEACON__BEACON),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_nd_beacon),
+ SCENARIO_EVENT (cp_fsm__DETECTING_BEACON__nd_beacon),
+ /*Enter ASSOC timer */
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ /* ASSOCIATING*/
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CC_ASSOC_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__CC_ASSOC_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATING, CC_ASSOC_CNF, success)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ /* ASSOCIATED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CM_GET_KEY_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATED__CM_GET_KEY_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATED, CM_GET_KEY_CNF, all_keys_granted)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* AUTHENTICATED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_BEACON),
+ SCENARIO_EVENT (cp_fsm__AUTHENTICATED__BEACON),
+ /* AUTHENTICATED -> VS_EOC_CCO_SET_OUT_LEV_IND -> AUTHENTICATED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_VS_EOC_CCO_SET_OUT_LEV_IND),
+ SCENARIO_EVENT (cp_fsm__AUTHENTICATED__set_out_lev_ind),
+ SCENARIO_END
+ };
+ scenario_globals_t globals = {
+ .cp = &cp,
+ };
+ scenario_run (t, entries, &globals);
+ test_fail_unless (cp.fsm.active_states[0] == CP_FSM_STATE_AUTHENTICATED);
+ cp_fsm_uninit (&cp);
+ } test_end;
+
+ test_begin (t, "unassociated")
+ {
+ cp_fsm_init (&cp);
+ cp.sta_core_flag = false;
+ scenario_entry_t entries[] = {
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_MAC_START_REQ),
+ SCENARIO_EVENT (cp_fsm__STOPPED__drv_sta_mac_start_req),
+ /* STARTED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_to_poweron),
+ SCENARIO_EVENT (cp_fsm__STARTED__poweron__idle__to_poweron),
+ /* DETECTING_BEACON */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_BEACON),
+ SCENARIO_EVENT (cp_fsm__DETECTING_BEACON__BEACON),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_nd_beacon),
+ SCENARIO_EVENT (cp_fsm__DETECTING_BEACON__nd_beacon),
+ /*Enter ASSOC timer */
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ /* ASSOCIATING*/
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CC_ASSOC_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__CC_ASSOC_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATING,
+ CC_ASSOC_CNF, success)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ /* ASSOCIATED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CM_GET_KEY_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATED__CM_GET_KEY_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATED,
+ CM_GET_KEY_CNF, all_keys_granted)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* AUTHENTICATED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_BEACON),
+ SCENARIO_EVENT (cp_fsm__AUTHENTICATED__BEACON),
+ /* AUTHENTICATED -> VS_EOC_CCO_SET_OUT_LEV_IND -> AUTHENTICATED */
+ SCENARIO_ACTION (post_and_process,
+ .type
+ = CP_FSM_EVENT_TYPE_VS_EOC_CCO_SET_OUT_LEV_IND),
+ SCENARIO_EVENT (cp_fsm__AUTHENTICATED__set_out_lev_ind),
+ /* AUTHENTICATED, leave => OK */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CC_LEAVE_IND),
+ SCENARIO_EVENT (cp_fsm__AUTHENTICATED__CC_LEAVE_IND,
+ .branch = CP_FSM_BRANCH (AUTHENTICATED,
+ CC_LEAVE_IND, ok)),
+ /* DETECTING_BEACON, beacon detected */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_nd_beacon),
+ SCENARIO_EVENT (cp_fsm__DETECTING_BEACON__nd_beacon),
+ /* ASSOCIATING, assoc_cnf, unsuccess*/
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CC_ASSOC_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__CC_ASSOC_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATING,
+ CC_ASSOC_CNF, unsuccess)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* UNASSOCIATED */
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_BEACON),
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__BEACON),
+ /* UNASSOCIATED, no beacons */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_no_beacons),
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__no_beacons),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_timeout_unassociating),
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__stop_retry_timer),
+ SCENARIO_END
+ };
+ scenario_globals_t globals = {
+ .cp = &cp,
+ };
+ scenario_run (t, entries, &globals);
+ test_fail_unless (cp.fsm.active_states[0]
+ == CP_FSM_STATE_DETECTING_BEACON);
+ cp_fsm_uninit (&cp);
+ } test_end;
+
+ test_begin (t, "associating, beacon timeout => sleep_unassociated")
+ {
+ cp_fsm_init (&cp);
+ cp.sta_core_flag = false;
+ scenario_entry_t entries[] = {
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_MAC_START_REQ),
+ SCENARIO_EVENT (cp_fsm__STOPPED__drv_sta_mac_start_req),
+ /* STARTED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_to_poweron),
+ SCENARIO_EVENT (cp_fsm__STARTED__poweron__idle__to_poweron),
+ SCENARIO_END
+ };
+ scenario_globals_t globals = {
+ .cp = &cp,
+ };
+ scenario_run (t, entries, &globals);
+ test_fail_unless (cp.fsm.active_states[0]
+ == CP_FSM_STATE_DETECTING_BEACON);
+ cp_fsm_uninit (&cp);
+ } test_end;
+
+ test_begin (t, "bad association")
+ {
+ cp_fsm_init (&cp);
+ cp.sta_core_flag = false;
+ scenario_entry_t entries[] = {
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_MAC_START_REQ),
+ SCENARIO_EVENT (cp_fsm__STOPPED__drv_sta_mac_start_req),
+ /* STARTED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_to_poweron),
+ SCENARIO_EVENT (cp_fsm__STARTED__poweron__idle__to_poweron),
+ /* DETECTING_BEACON, beacon detected */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_nd_beacon),
+ SCENARIO_EVENT (cp_fsm__DETECTING_BEACON__nd_beacon),
+ /*Enter ACCOC timer */
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ /* ASSOCIATING, timeout, retry */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_timeout_associating),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__timeout_associating,
+ .branch = CP_FSM_BRANCH (ASSOCIATING, timeout_associating, retry)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* DETECTING_BEACON, beacon detected */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_nd_beacon),
+ SCENARIO_EVENT (cp_fsm__DETECTING_BEACON__nd_beacon),
+ /*Enter ACCOC timer */
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ /* ASSOCIATING, timeout, no retries*/
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_timeout_associating),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__timeout_associating,
+ .branch = CP_FSM_BRANCH (ASSOCIATING, timeout_associating, no_retry)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* UNASSOCIATED */
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_enter_sleep_unassociated),
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__stop_retry_timer),
+ /* SLEEP_UNASSOCIATED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_exit_sleep_unassociated),
+ /* UNASSOCIATED */
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_retry_unassociated),
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__stop_retry_timer),
+ /* DETECTING_BEACON, beacon detected */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_nd_beacon),
+ SCENARIO_EVENT (cp_fsm__DETECTING_BEACON__nd_beacon),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ /* ASSOCIATING, assoc_cnf, unrelated */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CC_ASSOC_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__CC_ASSOC_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATING, CC_ASSOC_CNF, unsuccess)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__start_retry_timer),
+ /* UNASSOCIATED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_retry_unassociated),
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__stop_retry_timer),
+ /* DETECTING_BEACON, beacon detected */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_nd_beacon),
+ SCENARIO_EVENT (cp_fsm__DETECTING_BEACON__nd_beacon),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ /* ASSOCIATING, no beacons*/
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_no_beacons),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__no_beacons),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* UNASSOCIATED */
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_retry_unassociated),
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__stop_retry_timer),
+ /* DETECTING_BEACON, beacon detected */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_nd_beacon),
+ SCENARIO_EVENT (cp_fsm__DETECTING_BEACON__nd_beacon),
+ /* ASSOCIATING, assoc_cnf, unsuccess*/
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CC_ASSOC_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__CC_ASSOC_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATING, CC_ASSOC_CNF, unsuccess)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* UNASSOCIATED */
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__start_retry_timer),
+ SCENARIO_END
+ };
+ scenario_globals_t globals = {
+ .cp = &cp,
+ };
+ scenario_run (t, entries, &globals);
+ test_fail_unless (cp.fsm.active_states[0] == CP_FSM_STATE_UNASSOCIATED);
+ cp_fsm_uninit (&cp);
+ } test_end;
+
+ test_begin (t, "associated")
+ {
+ cp_fsm_init (&cp);
+ cp.sta_core_flag = false;
+ scenario_entry_t entries[] = {
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_MAC_START_REQ),
+ SCENARIO_EVENT (cp_fsm__STOPPED__drv_sta_mac_start_req),
+ /* STARTED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_to_poweron),
+ SCENARIO_EVENT (cp_fsm__STARTED__poweron__idle__to_poweron),
+ /* DETECTING_BEACON */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_nd_beacon),
+ SCENARIO_EVENT (cp_fsm__DETECTING_BEACON__nd_beacon),
+ /*Enter ACCOC timer */
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ /* ASSOCIATING*/
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CC_ASSOC_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__CC_ASSOC_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATING, CC_ASSOC_CNF, success)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* ASSOCIATED, get_key_cnf, unrelated */
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CM_GET_KEY_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATED__CM_GET_KEY_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATED, CM_GET_KEY_CNF, unrelated)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* UNASSOCIATED */
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_retry_unassociated),
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__stop_retry_timer),
+ /* DETECTING_BEACON */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_nd_beacon),
+ SCENARIO_EVENT (cp_fsm__DETECTING_BEACON__nd_beacon),
+ /* ASSOCIATING*/
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CC_ASSOC_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__CC_ASSOC_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATING, CC_ASSOC_CNF, success)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* ASSOCIATED,get_key_cnf, not granted */
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CM_GET_KEY_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATED__CM_GET_KEY_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATED, CM_GET_KEY_CNF, not_granted)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* UNASSOCIATED */
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_retry_unassociated),
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__stop_retry_timer),
+ /* DETECTING_BEACON */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_nd_beacon),
+ SCENARIO_EVENT (cp_fsm__DETECTING_BEACON__nd_beacon),
+ /* ASSOCIATING*/
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CC_ASSOC_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__CC_ASSOC_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATING, CC_ASSOC_CNF, success)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* ASSOCIATED, encrypt_payload */
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_encrypt_payload_rsp),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATED__encrypt_payload_rsp),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* UNASSOCIATED */
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_retry_unassociated),
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__stop_retry_timer),
+ /* DETECTING_BEACON */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_nd_beacon),
+ SCENARIO_EVENT (cp_fsm__DETECTING_BEACON__nd_beacon),
+ /* ASSOCIATING*/
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CC_ASSOC_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__CC_ASSOC_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATING, CC_ASSOC_CNF, success)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* ASSOCIATED, no beacons */
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_no_beacons),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATED__no_beacons),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* UNASSOCIATED */
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_retry_unassociated),
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__stop_retry_timer),
+ /* DETECTING_BEACON */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_nd_beacon),
+ SCENARIO_EVENT (cp_fsm__DETECTING_BEACON__nd_beacon),
+ /* ASSOCIATING*/
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CC_ASSOC_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__CC_ASSOC_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATING, CC_ASSOC_CNF, success)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* ASSOCIATED, leave */
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CC_LEAVE_IND),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATED__CC_LEAVE_IND,
+ .branch = CP_FSM_BRANCH (ASSOCIATED, CC_LEAVE_IND, ok)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* DETECTING_BEACON */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_nd_beacon),
+ SCENARIO_EVENT (cp_fsm__DETECTING_BEACON__nd_beacon),
+ /* ASSOCIATING*/
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CC_ASSOC_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__CC_ASSOC_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATING, CC_ASSOC_CNF, success)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* ASSOCIATED, timeout_authenticating */
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_timeout_associating),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATED__timeout_associating),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* UNASSOCIATED */
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_retry_unassociated),
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__stop_retry_timer),
+ /* DETECTING_BEACON */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_nd_beacon),
+ SCENARIO_EVENT (cp_fsm__DETECTING_BEACON__nd_beacon),
+ /* ASSOCIATING*/
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CC_ASSOC_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__CC_ASSOC_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATING, CC_ASSOC_CNF, success)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* ASSOCIATED, get_key */
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CM_GET_KEY_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATED__CM_GET_KEY_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATED, CM_GET_KEY_CNF, all_keys_granted)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* AUTHENTICATED */
+ SCENARIO_END
+ };
+ scenario_globals_t globals = {
+ .cp = &cp,
+ };
+ scenario_run (t, entries, &globals);
+ test_fail_unless (cp.fsm.active_states[0] == CP_FSM_STATE_AUTHENTICATED);
+ cp_fsm_uninit (&cp);
+ } test_end;
+
+ test_begin (t, "authenticated")
+ {
+ cp_fsm_init (&cp);
+ cp.sta_core_flag = false;
+ scenario_entry_t entries[] = {
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_MAC_START_REQ),
+ SCENARIO_EVENT (cp_fsm__STOPPED__drv_sta_mac_start_req),
+ /* STARTED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_to_poweron),
+ SCENARIO_EVENT (cp_fsm__STARTED__poweron__idle__to_poweron),
+ /* DETECTING_BEACON */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_nd_beacon),
+ SCENARIO_EVENT (cp_fsm__DETECTING_BEACON__nd_beacon),
+ /*Enter ACCOC timer */
+ /* ASSOCIATING*/
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CC_ASSOC_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__CC_ASSOC_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATING, CC_ASSOC_CNF, success)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* ASSOCIATED */
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CM_GET_KEY_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATED__CM_GET_KEY_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATED, CM_GET_KEY_CNF, all_keys_granted)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* AUTHENTICATED, sleep */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_sleep_enter_cnf),
+ /* SLEEP_AUTHENTICATED, exit sleep */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_sleep_exit_rsp),
+ /* AUTHENTICATED, sleep */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_sleep_enter_cnf),
+ /* SLEEP_AUTHENTICATED, no beacons */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_no_beacons),
+ /* UNASSOCIATED */
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_retry_unassociated),
+ SCENARIO_EVENT (cp_fsm__UNASSOCIATED__stop_retry_timer),
+ /* DETECTING_BEACON */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_nd_beacon),
+ SCENARIO_EVENT (cp_fsm__DETECTING_BEACON__nd_beacon),
+ /* ASSOCIATING*/
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CC_ASSOC_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__CC_ASSOC_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATING, CC_ASSOC_CNF, success)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* ASSOCIATED */
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CM_GET_KEY_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATED__CM_GET_KEY_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATED, CM_GET_KEY_CNF, all_keys_granted)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* AUTHENTICATED, NEK change request */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CM_SET_KEY_REQ),
+ SCENARIO_EVENT (cp_fsm__AUTHENTICATED__CM_SET_KEY_REQ),
+ /* AUTHENTICATED, no beacons */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_no_beacons),
+ SCENARIO_EVENT (cp_fsm__AUTHENTICATED__no_beacons),
+ /* DETECTING_BEACON */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_nd_beacon),
+ SCENARIO_EVENT (cp_fsm__DETECTING_BEACON__nd_beacon),
+ /* ASSOCIATING*/
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CC_ASSOC_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__CC_ASSOC_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATING, CC_ASSOC_CNF, success)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ /* ASSOCIATED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CM_GET_KEY_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATED__CM_GET_KEY_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATED, CM_GET_KEY_CNF, all_keys_granted)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* AUTHENTICATED, CM_NW_STATS */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CM_NW_STATS_REQ),
+ SCENARIO_EVENT (cp_fsm__AUTHENTICATED__CM_NW_STATS_REQ),
+ /* AUTHENTICATED, leave => OK */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CC_LEAVE_IND),
+ SCENARIO_EVENT (cp_fsm__AUTHENTICATED__CC_LEAVE_IND,
+ .branch = CP_FSM_BRANCH (AUTHENTICATED, CC_LEAVE_IND, ok)),
+ SCENARIO_END
+ };
+ scenario_globals_t globals = {
+ .cp = &cp,
+ };
+ scenario_run (t, entries, &globals);
+ test_fail_unless (cp.fsm.active_states[0] == CP_FSM_STATE_DETECTING_BEACON);
+ cp_fsm_uninit (&cp);
+ } test_end;
+
+ test_begin (t, "stopped")
+ {
+ cp_fsm_init (&cp);
+ cp.sta_core_flag = false;
+ scenario_entry_t entries[] = {
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_MAC_START_REQ),
+ SCENARIO_EVENT (cp_fsm__STOPPED__drv_sta_mac_start_req),
+ /* STARTED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_to_poweron),
+ SCENARIO_EVENT (cp_fsm__STARTED__poweron__idle__to_poweron),
+ /* DETECTING_BEACON */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_nd_beacon),
+ SCENARIO_EVENT (cp_fsm__DETECTING_BEACON__nd_beacon),
+ /* ASSOCIATING*/
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CC_ASSOC_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__CC_ASSOC_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATING, CC_ASSOC_CNF, success)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__start_retry_timer),
+ /* ASSOCIATED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CM_GET_KEY_CNF),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATED__CM_GET_KEY_CNF,
+ .branch = CP_FSM_BRANCH (ASSOCIATED, CM_GET_KEY_CNF, all_keys_granted)),
+ SCENARIO_EVENT (cp_fsm__ASSOCIATING__stop_retry_timer),
+ /* AUTHENTICATED, leave => not OK */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_CC_LEAVE_IND),
+ SCENARIO_EVENT (cp_fsm__AUTHENTICATED__CC_LEAVE_IND,
+ .branch = CP_FSM_BRANCH (AUTHENTICATED, CC_LEAVE_IND, nok)),
+ /* STOPPED */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_DRV_STA_MAC_STOP_REQ),
+ SCENARIO_EVENT (cp_fsm__AUTHENTICATED__drv__started__drv_sta_mac_stop_req),
+ /* STOPPING */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_to_stop),
+ SCENARIO_EVENT (cp_fsm__STOPPING__poweron__many__to_idle),
+ /* STOPPING */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_stopped),
+ SCENARIO_EVENT (cp_fsm__STOPPING__drv__stopping__stopped),
+ SCENARIO_END
+ };
+ scenario_globals_t globals = {
+ .cp = &cp,
+ };
+ scenario_run (t, entries, &globals);
+ test_fail_unless (cp.fsm.active_states[0] == CP_FSM_STATE_STOPPED);
+ cp_fsm_uninit (&cp);
+ } test_end;
+
+#if CONFIG_TRACE
+ trace_buffer_dbg_dump (&cp.trace);
+#endif /* CONFIG_TRACE */
+ cp_trace_uninit (&cp);
+}
+
+
+void
+test_fsm_test_suite (test_t t)
+{
+ test_suite_begin (t, "fsm");
+ test_fsm_basic_test_case (t);
+}
+
+void
+cp_sta_core_signal_fsm_event (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ ctx->sta_core_flag = true;
+}
+
+void
+cp_sta_core_signal_fsm_urgent_event (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ ctx->sta_core_urgent_flag = true;
+}
+
+int
+main (int argc, char **argv)
+{
+ test_t t;
+ trace_init ();
+ test_init (t, argc, argv);
+ test_fsm_test_suite (t);
+ trace_uninit ();
+
+ test_case_begin (t, "Memory allocation");
+ test_begin (t, "memory leaks")
+ {
+ test_fail_if (blk_check_memory () != true, "Memory leaks");
+ }
+ test_end;
+ test_result (t);
+ return test_nb_failed (t) == 0 ? 0 : 1;
+}
+
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/Config b/cesar/cp/eoc/sta/action/test/utest_eoc/Config
new file mode 100644
index 0000000000..3702f12660
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/Config
@@ -0,0 +1,8 @@
+CONFIG_CP_AV = n
+CONFIG_CP_EOC = y
+CONFIG_CP_FSM_DEF = "cp/eoc/fsm/src/fsm/cp_eoc_sta.fsm"
+CONFIG_MAC_PBPROC_EOC_FC = y
+CONFIG_CP_MSG_EOC_DRV_MME = y
+CONFIG_MAC_COMMON_EOC_SCHED = y
+CONFIG_CL_EOC_ROUTE = y
+CONFIG_MAC_COMMON_EOC_TEI = y
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/Makefile b/cesar/cp/eoc/sta/action/test/utest_eoc/Makefile
new file mode 100644
index 0000000000..99a54f4527
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/Makefile
@@ -0,0 +1,24 @@
+BASE = ../../../../../..
+
+INCLUDES = cp/eoc/sta/action/test/utest_eoc \
+ cp/eoc/sta/action/test/utest_eoc/override
+
+HOST_PROGRAMS = test_sta_action
+test_sta_action_SOURCES = test_sta_action.c assoc.c drv.c \
+ msg_stub.c dataplane_stub.c fsm_stub.c \
+ core_stub.c beacon_stub.c cp_stub.c \
+ scenario_actions.c ce_stub.c \
+ mac_sar_interface_stub.c secu.c
+
+test_sta_action_MODULES = lib lib/scenario cp/eoc/sta/action cp/eoc/sta/mgr \
+ cp/eoc/fsm/stub mac/common cl/stub cp/secu/stub \
+ cp/eoc/cco/action/stub cp/eoc/beacon/stub \
+ cp/msg/stub ce/stub mac/sar/stub \
+ cp/eoc/cco/bw/stub bsu/stub hal/ipmbox/stub \
+ bufmgr/stub
+
+test_sta_action_CONFIG_MODULES = cp cp/eoc cp/eoc/msg mac/sar mac/pbproc cl
+
+test_sta_action_LDLIBS = -lm
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/assoc-Makefile b/cesar/cp/eoc/sta/action/test/utest_eoc/assoc-Makefile
new file mode 100644
index 0000000000..5565be5a69
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/assoc-Makefile
@@ -0,0 +1,20 @@
+BASE = ../../../../../..
+
+VARIANT = assoc
+
+INCLUDES = cp/eoc/sta/action/test/utest_eoc/assoc-override
+
+HOST_PROGRAMS = test_assoc
+
+test_assoc_SOURCES = test_assoc.c mgr_stub.c core_stub.c cp_stub.c msg_stub.c phy_stub.c
+
+test_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
+
+test_assoc_CONFIG_MODULES = cp/eoc mac cl
+test_assoc_LDLIBS = -lm
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/inc/scenario_defs.h b/cesar/cp/eoc/sta/action/test/utest_eoc/inc/scenario_defs.h
new file mode 100644
index 0000000000..4165f9ef27
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/inc/scenario_defs.h
@@ -0,0 +1,408 @@
+#ifndef inc_scenario_defs_h
+#define inc_scenario_defs_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file inc/scenario_defs.h
+ * \brief Scenario definitions.
+ * \ingroup test
+ */
+
+#include "cp/msg/msg.h"
+#include "cp/sta/mgr/sta.h"
+#include "cp/sta/mgr/net.h"
+#include "cp/fsm/fsm.h"
+#include "cl/cl_mactotei.h"
+#include "mac/common/tonemap.h"
+#include "cp/eoc/msg/inc/msg_vs.h"
+#include "cp/eoc/sta/action/inc/vs.h"
+
+/* Scenario globals. */
+#define SCENARIO_DEFS_GLOBALS \
+ cp_t *cp; \
+ u16 prn; \
+ u32 my_nonce; \
+ u32 your_nonce; \
+ cp_mme_tx_t *mme;
+
+/* Scenario actions. */
+#define SCENARIO_DEFS_ACTIONS \
+ drv__stopped__drv_sta_set_mac_addr_req, \
+ drv__stopped__drv_sta_set_cco_pref_req, \
+ drv__stopped__drv_sta_set_was_cco_req, \
+ drv__stopped__drv_sta_set_npw_req, \
+ drv__stopped__drv_sta_set_dpw_req, \
+ drv__stopped__drv_sta_set_sl_req, \
+ drv__stopped__drv_sta_set_nid_req, \
+ drv__stopped__drv_sta_set_m_sta_hfid_req, \
+ drv__stopped__drv_sta_set_u_sta_hfid_req, \
+ drv__stopped__drv_sta_set_avln_hfid_req, \
+ drv__stopped__drv_sta_set_tonemask_req, \
+ drv__stopped__drv_sta_mac_start_req, \
+ drv__stopped__drv_sta_set_key_req, \
+ drv__stopped__drv_sta_set_dak_req, \
+ drv__started__drv_sta_mac_stop_req, \
+ drv__stopping__stopped, \
+ drv__drv_sta_get_key_req, \
+ drv__drv_sta_status_req, \
+ drv__drv_sta_set_config_req, \
+ \
+ detect__beacon_received, \
+ assoc__detecting_no_beacons, \
+ assoc__detecting_detected, \
+ assoc__associating_cnf, \
+ assoc__associating_timeout, \
+ assoc__associating_no_beacons, \
+ assoc__associated_key_cnf, \
+ assoc__associated_no_beacons, \
+ assoc__associated_timeout, \
+ assoc__associated_leave, \
+ auth__authenticated_key_cnf
+
+/* Actions without parameter. */
+#define __0(action) \
+typedef scenario_empty_t scenario_action_ ## action ## _t; \
+void \
+scenario_action_ ## action ## _cb ( \
+ scenario_globals_t *globals, scenario_params_t *params);
+
+/* Actions with parameters. */
+#define __n(action, param...) \
+typedef struct \
+{ \
+ PREPROC_FOR_EACH (__n_, param) \
+} scenario_action_ ## action ## _t; \
+void \
+scenario_action_ ## action ## _cb ( \
+ scenario_globals_t *globals, scenario_params_t *params);
+#define __n_(param) param;
+
+/* Actions with MME and parameters. */
+#define __m(action, param...) \
+typedef struct \
+{ \
+ cp_mme_peer_t peer; \
+ PREPROC_FOR_EACH (__m_, param) \
+} scenario_action_ ## action ## _t; \
+void \
+scenario_action_ ## action ## _cb ( \
+ scenario_globals_t *globals, scenario_params_t *params);
+#define __m_(param) param;
+
+__m (drv__stopped__drv_sta_set_mac_addr_req)
+__m (drv__stopped__drv_sta_set_cco_pref_req)
+__m (drv__stopped__drv_sta_set_was_cco_req)
+__m (drv__stopped__drv_sta_set_npw_req)
+__m (drv__stopped__drv_sta_set_dpw_req)
+__m (drv__stopped__drv_sta_set_sl_req)
+__m (drv__stopped__drv_sta_set_nid_req)
+__m (drv__stopped__drv_sta_set_m_sta_hfid_req)
+__m (drv__stopped__drv_sta_set_u_sta_hfid_req)
+__m (drv__stopped__drv_sta_set_avln_hfid_req)
+__m (drv__stopped__drv_sta_set_tonemask_req)
+__m (drv__stopped__drv_sta_mac_start_req)
+__m (drv__stopped__drv_sta_set_key_req)
+__m (drv__stopped__drv_sta_set_dak_req)
+__m (drv__started__drv_sta_mac_stop_req)
+__0 (drv__stopping__stopped)
+__m (drv__drv_sta_get_key_req)
+__m (drv__drv_sta_status_req)
+__m (drv__drv_sta_set_config_req)
+
+__n (detect__beacon_received,
+ bsu_beacon_t *beacon, cp_net_t *net, cp_sta_t *sta)
+__0 (assoc__detecting_no_beacons)
+__0 (assoc__detecting_detected)
+__m (assoc__associating_cnf)
+__0 (assoc__associating_timeout)
+__0 (assoc__associating_no_beacons)
+__m (assoc__associated_key_cnf)
+__0 (assoc__associated_no_beacons)
+__0 (assoc__associated_timeout)
+__m (assoc__associated_leave)
+__m (auth__authenticated_key_cnf)
+
+#undef __0
+#undef __n
+#undef __n_
+#undef __m
+#undef __m_
+#undef __m
+
+/* Scenario events. */
+#define SCENARIO_DEFS_EVENTS \
+ cp_msg_drv_sta_set_mac_addr_req_receive, \
+ cp_msg_drv_sta_set_cco_pref_req_receive, \
+ cp_msg_drv_sta_set_was_cco_req_receive, \
+ cp_msg_drv_sta_set_npw_req_receive, \
+ cp_msg_drv_sta_set_dpw_req_receive, \
+ cp_msg_drv_sta_set_sl_req_receive, \
+ cp_msg_drv_sta_set_nid_req_receive, \
+ cp_msg_drv_sta_set_m_sta_hfid_req_receive, \
+ cp_msg_drv_sta_set_u_sta_hfid_req_receive, \
+ cp_msg_drv_sta_set_avln_hfid_req_receive, \
+ cp_msg_drv_sta_set_tonemask_req_receive, \
+ cp_msg_drv_sta_mac_start_req_receive, \
+ cp_msg_drv_sta_mac_stop_req_receive, \
+ cp_msg_drv_sta_sc_req_receive, \
+ cp_msg_drv_sta_set_key_req_receive, \
+ cp_msg_drv_sta_set_key_ind_send, \
+ cp_msg_drv_sta_set_dak_req_receive, \
+ cp_msg_drv_any_cnf_send, \
+ cp_msg_drv_sta_get_key_req_receive, \
+ cp_msg_drv_sta_get_key_cnf_send, \
+ cp_msg_drv_sta_status_req_receive, \
+ cp_msg_drv_sta_status_cnf_send, \
+ cp_msg_drv_sta_status_ind_send, \
+ cp_msg_drv_sta_set_config_req_receive, \
+ \
+ cp_msg_cc_assoc_req_send, \
+ cp_msg_cc_assoc_cnf_receive, \
+ cp_msg_cc_leave_ind_receive, \
+ cp_msg_cc_leave_rsp_send, \
+ \
+ cp_msg_cm_get_key_req_send, \
+ cp_msg_cm_get_key_cnf_receive, \
+ \
+ cp_msg_vs_eoc_cco_get_info_req_receive, \
+ cp_msg_vs_eoc_cco_get_info_cnf_send, \
+ cp_msg_vs_eoc_cco_diagnostic_info_req_receive, \
+ cp_msg_vs_eoc_cco_diagnostict_info_cnf_send, \
+ cp_msg_vs_eoc_cco_get_real_time_stats_req_receive, \
+ cp_msg_vs_eoc_cco_get_real_time_stats_cnf_send, \
+ cp_msg_eoc_sta_vs_set_out_lev_ind_receive, \
+ cp_msg_vs_eoc_cco_set_out_lev_ind_send, \
+ \
+ cp_msg_vs_get_attenuation_list_req_receive, \
+ cp_msg_vs_get_attenuation_list_cnf_send_begin, \
+ cp_msg_vs_get_attenuation_list_cnf_send_entry, \
+ cp_msg_vs_get_attenuation_list_cnf_send_end, \
+ \
+ cp_fsm_event_bare_new, \
+ cp_fsm_event_mme_new, \
+ cp_fsm_branch, \
+ \
+ cp_sta_core_gen_timed_event, \
+ cp_sta_core_stop_timed_or_cyclic_event, \
+ \
+ cp_beacon_create_default_schedules, \
+ cp_beacon_process_tracked_avln, \
+ cp_beacon_process_untracked_avln, \
+ cp_beacon_reconfigure_timer, \
+ cp_beacon_change_nek, \
+ cp_beacon_deactivate, \
+ cp_beacon_synchronised, \
+ \
+ cp_eoc_cco_bw_sta_allocations, \
+ \
+ sar_activate, \
+ sar_cleanup, \
+ \
+ pbproc_activate, \
+ pbproc_parameters_adjust
+
+/* MME send event. */
+#define __ms(event, param...) \
+typedef struct \
+{ \
+ cp_mme_peer_t peer; \
+ PREPROC_FOR_EACH (__p_, ## param) \
+} scenario_event_ ## event ## _t;
+
+/* MME send event complex. */
+#define __msc(event, param...) \
+typedef struct \
+{ \
+ PREPROC_FOR_EACH (__p_, ## param) \
+} scenario_event_ ## event ## _t;
+
+/* MME send event with encryption information. */
+#define __msk(event, param...) \
+typedef struct \
+{ \
+ cp_mme_peer_t peer; \
+ cp_mme_peks_t peks; \
+ u8 pid; \
+ u8 pmn; \
+ PREPROC_FOR_EACH (__p_, ## param) \
+} scenario_event_ ## event ## _t;
+
+/* MME send event for CC_RELAY.IND. */
+#define __msr(event, param...) \
+typedef struct \
+{ \
+ mac_t mac_fa; \
+ cp_tei_t ftei; \
+ PREPROC_FOR_EACH (__p_, ## param) \
+} scenario_event_ ## event ## _t;
+
+/* MME receive event. */
+#define __mr(event, param...) \
+typedef struct \
+{ \
+ bool ok; \
+ PREPROC_FOR_EACH (__p_, ## param) \
+} scenario_event_ ## event ## _t;
+
+/* MME receive event with encryption information. */
+#define __mrk(event, param...) \
+typedef struct \
+{ \
+ bool ok; \
+ cp_mme_peks_t peks; \
+ u8 pid; \
+ u8 pmn; \
+ bool new_prn; \
+ bool new_my_nonce; \
+ bool new_your_nonce; \
+ PREPROC_FOR_EACH (__p_, ## param) \
+} scenario_event_ ## event ## _t;
+
+#define __p_(param) param;
+
+__mr (cp_msg_drv_sta_set_mac_addr_req_receive, mac_t mac)
+__mr (cp_msg_drv_sta_set_cco_pref_req_receive, bool cco_pref)
+__mr (cp_msg_drv_sta_set_was_cco_req_receive, bool was_cco)
+__mr (cp_msg_drv_sta_set_npw_req_receive, char *npw)
+__mr (cp_msg_drv_sta_set_dpw_req_receive, char *dpw)
+__mr (cp_msg_drv_sta_set_sl_req_receive, cp_security_level_t sl)
+__mr (cp_msg_drv_sta_set_nid_req_receive, cp_nid_t nid)
+__mr (cp_msg_drv_sta_set_m_sta_hfid_req_receive, char *m_sta_hfid)
+__mr (cp_msg_drv_sta_set_u_sta_hfid_req_receive, char *u_sta_hfid)
+__mr (cp_msg_drv_sta_set_avln_hfid_req_receive, char *avln_hfid)
+__mr (cp_msg_drv_sta_set_tonemask_req_receive, u32 *tonemask)
+__mr (cp_msg_drv_sta_mac_start_req_receive)
+__mr (cp_msg_drv_sta_mac_stop_req_receive)
+__mr (cp_msg_drv_sta_sc_req_receive, bool sc_join)
+__mr (cp_msg_drv_sta_set_key_req_receive, cp_key_t nmk,
+ enum cp_msg_drv_sta_set_key_type_t type, cp_nid_t nid,
+ cp_security_level_t sl)
+__ms (cp_msg_drv_sta_set_key_ind_send, cp_key_t nmk,
+ enum cp_msg_drv_sta_set_key_type_t type, cp_nid_t nid,
+ cp_security_level_t sl)
+__mr (cp_msg_drv_sta_set_dak_req_receive, cp_key_t dak)
+__ms (cp_msg_drv_any_cnf_send, mmtype_t mmtype, cp_msg_drv_result_t result)
+__mr (cp_msg_drv_sta_get_key_req_receive)
+__ms (cp_msg_drv_sta_get_key_cnf_send, uint result, cp_key_t nmk,
+ cp_nid_t nid, cp_security_level_t sl)
+__mr (cp_msg_drv_sta_status_req_receive)
+__ms (cp_msg_drv_sta_status_cnf_send, uint result,
+ cp_msg_drv_sta_status_status_t status,
+ cp_msg_drv_sta_status_cco_t cco,
+ bool preferred_cco,
+ bool backup_cco,
+ bool simple_connect,
+ bsu_aclf_frequency_t pwl_sync_frequency)
+__ms (cp_msg_drv_sta_status_ind_send,
+ cp_msg_drv_sta_status_status_t status,
+ cp_msg_drv_sta_status_cco_t cco,
+ bool preferred_cco,
+ bool backup_cco,
+ bool simple_connect,
+ bsu_aclf_frequency_t pwl_sync_frequency)
+__mr (cp_msg_drv_sta_set_config_req_receive,
+ char *config)
+__ms (cp_msg_cc_assoc_req_send, enum cp_msg_cc_assoc_req_type_t request_type,
+ cp_nid_t nid, u8 cco_cap, u8 proxy_cap)
+__mr (cp_msg_cc_assoc_cnf_receive, enum cp_msg_cc_assoc_cnf_result_t result,
+ cp_nid_t nid, cp_snid_t snid, cp_tei_t sta_tei, u16 lease_time_min)
+__mr (cp_msg_cc_leave_ind_receive, enum cp_msg_cc_leave_ind_reason_t reason,
+ cp_nid_t nid)
+__ms (cp_msg_cc_leave_rsp_send)
+__msk (cp_msg_cm_get_key_req_send, bool relayed,
+ enum cp_msg_key_type_t key_type, cp_nid_t nid, u32 *hash_key)
+__mrk (cp_msg_cm_get_key_cnf_receive,
+ enum cp_msg_cm_get_key_cnf_result_t result,
+ enum cp_msg_key_type_t key_type, cp_nid_t nid, u8 eks, u32 *hash_key,
+ cp_key_t *key)
+__mr (cp_msg_vs_eoc_cco_get_info_req_receive,
+ u8 internal_eoc_index, u8 control)
+__ms (cp_msg_vs_eoc_cco_get_info_cnf_send,
+ cp_msg_vs_eoc_get_info_req_result_t status,
+ u16 tei, s8 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)
+__mr (cp_msg_vs_eoc_cco_diagnostic_info_req_receive,
+ u8 internal_eoc_index, u8 control)
+__ms (cp_msg_vs_eoc_cco_diagnostict_info_cnf_send,
+ 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)
+__mr (cp_msg_vs_eoc_cco_get_real_time_stats_req_receive,
+ u8 control)
+__ms (cp_msg_vs_eoc_cco_get_real_time_stats_cnf_send,
+ cp_msg_vs_eoc_get_real_time_statistics_req_result_t status,
+ real_time_stats_t *rt_stats);
+__mr (cp_msg_eoc_sta_vs_set_out_lev_ind_receive, uint output_level)
+__ms (cp_msg_vs_eoc_cco_set_out_lev_ind_send, uint output_level)
+
+__mr (cp_msg_vs_get_attenuation_list_req_receive)
+__ms (cp_msg_vs_get_attenuation_list_cnf_send_begin, uint nb)
+__msc (cp_msg_vs_get_attenuation_list_cnf_send_entry,
+ mac_t mac, cp_tei_t tei,
+ vs_get_attenuation_list_att_status_t status, s8 attenuation_db)
+__msc (cp_msg_vs_get_attenuation_list_cnf_send_end)
+
+#undef __ms
+#undef __msk
+#undef __msr
+#undef __mr
+#undef __mrk
+#undef __msc
+
+/* Event with return. */
+#define __er(event, param...) \
+typedef struct \
+{ \
+ bool ok; \
+ PREPROC_FOR_EACH (__p_, ## param) \
+} scenario_event_ ## event ## _t;
+
+
+/* Any event. */
+#define __e(event, param...) \
+typedef struct \
+{ \
+ PREPROC_FOR_EACH (__p_, ## param) \
+} scenario_event_ ## event ## _t;
+
+__e (cp_fsm_event_bare_new, cp_fsm_event_type_t type)
+__e (cp_fsm_event_mme_new, cp_fsm_event_type_t type)
+__e (cp_fsm_branch, cp_fsm_branch_t branch)
+
+__e (cp_sta_core_gen_timed_event, uint delay_min_ms, uint delay_max_ms)
+__e (cp_sta_core_stop_timed_or_cyclic_event)
+
+__e (cp_beacon_create_default_schedules)
+__e (cp_beacon_process_tracked_avln, bsu_beacon_t *beacon, cp_net_t *net)
+__e (cp_beacon_process_untracked_avln)
+__e (cp_beacon_reconfigure_timer)
+__e (cp_beacon_change_nek, u8 eks, cp_key_t *nek, bool now)
+__e (cp_beacon_deactivate)
+__er (cp_beacon_synchronised)
+
+__e (cp_eoc_cco_bw_sta_allocations)
+
+__e (sar_activate, bool flag)
+__e (sar_cleanup)
+
+__e (pbproc_activate, bool flag)
+__e (pbproc_parameters_adjust, bool adjust)
+
+#undef __e
+#undef __er
+
+#undef __p_
+
+#endif /* inc_scenario_defs_h */
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/inc/test_sta_action.h b/cesar/cp/eoc/sta/action/test/utest_eoc/inc/test_sta_action.h
new file mode 100644
index 0000000000..177f1ca7d1
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/inc/test_sta_action.h
@@ -0,0 +1,70 @@
+#ifndef inc_test_sta_action_h
+#define inc_test_sta_action_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file inc/test_sta_action.h
+ * \brief Test sta/action.
+ * \ingroup test
+ */
+#include "cp/inc/context.h"
+
+/** Contexts used in tests. */
+struct test_sta_action_t
+{
+ cp_t cp;
+ mac_config_t mac_config;
+ bsu_aclf_t bsu_aclf;
+};
+typedef struct test_sta_action_t test_sta_action_t;
+
+/**
+ * Initialise test contexts.
+ * \param ctx test context
+ */
+void
+test_sta_action_init (test_sta_action_t *ctx);
+
+/**
+ * Uninitialise test contexts.
+ * \param ctx test context
+ */
+void
+test_sta_action_uninit (test_sta_action_t *ctx);
+
+/**
+ * Reset test contexts.
+ * \param ctx test context
+ */
+void
+test_sta_action_reset (test_sta_action_t *ctx);
+
+/**
+ * Create our AVLN as if the STA was associated.
+ * \param ctx test context
+ * \param nid our NID
+ * \param snid our SNID
+ */
+void
+test_sta_action_create_our_net (test_sta_action_t *ctx, cp_nid_t nid,
+ cp_snid_t snid);
+
+/**
+ * Fill the beacon with the NID, SNID, STEI and MAC address if valid.
+ * \param beacon the beacon to fill.
+ * \param nid the network Identifier of the CCo.
+ * \param snid the short network identifier of the CCo.
+ * \param stei the source TEI of the CCo.
+ * \param mac the Mac address of the CCo.
+ */
+void
+test_sta_action_beacon_create (
+ bsu_beacon_t *beacon, cp_nid_t nid, cp_snid_t snid, cp_tei_t stei,
+ mac_t mac);
+
+#endif /* inc_test_sta_action_h */
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/override/cp/inc/context.h b/cesar/cp/eoc/sta/action/test/utest_eoc/override/cp/inc/context.h
new file mode 100644
index 0000000000..10294d018c
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/override/cp/inc/context.h
@@ -0,0 +1,79 @@
+#ifndef override_cp_inc_context_h
+#define override_cp_inc_context_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file override/cp/inc/context.h
+ * \brief Control plane context override.
+ * \ingroup test
+ */
+#include "cp/types.h"
+#include "cp/sta/action/inc/context.h"
+#include "cp/sta/mgr/sta_mgr.h"
+#include "cp/sta/mgr/inc/sta_mgr.h"
+#include "cl/cl.h"
+#include "mac/common/config.h"
+#include "mac/common/store.h"
+#include "mac/sar/sar.h"
+#include "mac/pbproc/pbproc.h"
+#include "lib/rnd.h"
+#include "lib/trace.h"
+#include "ce/tx/inc/tx.h"
+
+enum cp_handover_reason_t
+{
+ CP_HANDOVER_REASON_CCO_SELECTION,
+ CP_HANDOVER_REASON_CCO_LEAVING,
+ CP_HANDOVER_REASON_USER_APPOINT,
+ CP_HANDOVER_REASON_NB,
+};
+
+enum cp_handover_soft_hard_t
+{
+ CP_HANDOVER_SOFT_HARD_SOFT,
+ CP_HANDOVER_SOFT_HARD_HARD,
+ CP_HANDOVER_NB,
+};
+
+struct cp_handover_t
+{
+ /** Handover timeout. */
+ cp_sta_core_timed_event_def_t handover_timeout;
+
+ /** handover reason. */
+ enum cp_handover_reason_t reason;
+
+ /** Handover soft hard */
+ enum cp_handover_soft_hard_t soft_hard;
+};
+
+
+struct cp_t
+{
+ cp_sta_action_t sta_action;
+ cp_sta_mgr_t sta_mgr;
+ lib_rnd_t rnd;
+ cl_t *cl;
+ mac_config_t *mac_config;
+ mac_store_t *mac_store;
+ sar_t *sar;
+ pbproc_t *pbproc;
+ /** Handover context. */
+ struct cp_handover_t handover;
+ ce_tx_t ce_tx;
+ ce_rx_t *ce_rx;
+ void *bsu;
+ bsu_aclf_t *bsu_aclf;
+ phy_t *phy;
+
+#if CONFIG_TRACE
+ trace_buffer_t trace;
+#endif
+};
+
+#endif /* override_cp_inc_context_h */
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/override/cp/sta/core/core.h b/cesar/cp/eoc/sta/action/test/utest_eoc/override/cp/sta/core/core.h
new file mode 100644
index 0000000000..e7519405ee
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/override/cp/sta/core/core.h
@@ -0,0 +1,38 @@
+#ifndef override_cp_sta_core_core_h
+#define override_cp_sta_core_core_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file override/cp/sta/core/core.h
+ * \brief STA core override.
+ * \ingroup test
+ */
+#include "cp/types.h"
+#include "cp/fsm/forward.h"
+
+struct cp_sta_core_timed_event_def_t
+{
+};
+typedef struct cp_sta_core_timed_event_def_t cp_sta_core_timed_event_def_t;
+
+void
+cp_sta_core_gen_timed_event (
+ cp_t *cp_ctx, cp_sta_core_timed_event_def_t *sta_core_timed_event,
+ cp_fsm_event_t *fsm_event, uint event_delay_ms);
+
+void
+cp_sta_core_stop_timed_or_cyclic_event(
+ cp_t *cp_ctx, cp_sta_core_timed_event_def_t *sta_core_timed_event);
+
+u32
+cp_sta_core_get_date_ms (cp_t *ctx);
+
+void
+cp_sta_core_checkpoint (cp_t *ctx);
+
+#endif /* override_cp_sta_core_core_h */
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/scenario-Config b/cesar/cp/eoc/sta/action/test/utest_eoc/scenario-Config
new file mode 100644
index 0000000000..ec1d21cd90
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/scenario-Config
@@ -0,0 +1,9 @@
+CONFIG_CP_EOC = y
+CONFIG_DEBUG_FATAL_CATCH = y
+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_EOC_DBG_PRINT_LEVEL = 0
+CONFIG_CP_MSG_EOC_DRV_MME = y
+CONFIG_MAC_COMMON_EOC_SCHED = y
+CONFIG_CL_EOC_ROUTE = y
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/scenario-Makefile b/cesar/cp/eoc/sta/action/test/utest_eoc/scenario-Makefile
new file mode 100644
index 0000000000..d748e94bc2
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/scenario-Makefile
@@ -0,0 +1,22 @@
+BASE = ../../../../../..
+
+VARIANT = scenario
+
+INCLUDES = cp/eoc/sta/action/test/utest_eoc/scenario-override \
+ cp/eoc/sta/action/test/utest_eoc
+
+HOST_PROGRAMS = test_scenario
+
+test_scenario_SOURCES = test_scenario.c scenario_actions.c fsm_stub.c\
+ mgr_stub.c core_stub.c cp_stub.c msg_stub.c phy_stub.c
+
+test_scenario_MODULES = lib lib/scenario cp/eoc/fsm/stub cp/sta/mgr mac/common cp/eoc/sta/action \
+ cl/stub mac/sar/stub cp/eoc/sta/mgr \
+ cp/msg/stub cp/secu cp/beacon/stub bsu/stub cp/eoc/cco/bw/stub mac/pbproc/stub cp/eoc/beacon/stub cp/eoc/msg/stub
+
+test_scenario_CONFIG_MODULES = cp/eoc mac cl
+
+cp_eoc_sta_action_MODULE_SOURCES = assoc.c poweron.c drv.c assoc_slave.c
+cp_sta_action_MODULE_SOURCES =
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/src/assoc.c b/cesar/cp/eoc/sta/action/test/utest_eoc/src/assoc.c
new file mode 100644
index 0000000000..063f62a200
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/src/assoc.c
@@ -0,0 +1,461 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/assoc.c
+ * \brief Test sta/action/assoc.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "lib/scenario/scenario.h"
+
+#include "inc/test_sta_action.h"
+
+#include "cp/sta/action/action.h"
+#include "cp/sta/mgr/inc/sta.h"
+
+void
+assoc_create_master (test_t t, test_sta_action_t *ctx, cp_snid_t snid,
+ cp_nid_t nid, cp_tei_t master_tei, mac_t master_mac,
+ cp_net_t **master_net, cp_sta_t **master)
+{
+ /* Create a Master to associate with. */
+ *master_net = cp_sta_mgr_add_avln (&ctx->cp, snid, nid);
+ dbg_assert (*master_net);
+ *master = cp_sta_mgr_sta_add (
+ &ctx->cp, *master_net, master_tei, master_mac);
+ cp_net_set_cco (&ctx->cp, *master_net, master_tei);
+}
+
+void
+assoc_test_case_basic (test_t t)
+{
+ test_sta_action_t ctx;
+ test_sta_action_init (&ctx);
+ cp_eoc_sta_action_init (&ctx.cp);
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+
+ test_case_begin (t, "Associate with a Master");
+ test_begin (t, "Started up.")
+ {
+ test_fail_unless (ctx.cp.mac_config->authenticated == false);
+ test_fail_unless (ctx.cp.sta_action.assoc.retry == 0);
+ test_fail_unless (ctx.cp.sta_action.assoc.beacon_loss == 0);
+ test_fail_unless (cp_sta_own_data_get_tei (&ctx.cp)
+ == MAC_TEI_UNASSOCIATED);
+ }
+ test_end;
+
+ test_begin (t, "No beacons")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (assoc__detecting_no_beacons),
+ SCENARIO_EVENT (cp_beacon_process_untracked_avln),
+ SCENARIO_EVENT (cp_eoc_cco_bw_sta_allocations),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ }
+ test_end;
+
+ /* Create a Master to associate with. */
+ const cp_snid_t snid = 0;
+ const cp_nid_t nid = 0xf11111111111ull;
+ const cp_tei_t master_tei = 1, sta_tei = 3;
+ const mac_t master_mac = 0x111111111111ull;
+ cp_net_t *master_net;
+ cp_sta_t *master = NULL;
+
+ /* Create a second master, as on EoC clients barely change the NPW (i.e.
+ * the nid is a hash of the NMK which is hashed from the NPW) the second
+ * master has the same NID. */
+ const cp_tei_t master2_tei = 1;
+ const mac_t master2_mac = 0x222222222222ull;
+ cp_sta_t *master2 = NULL;
+
+ const cp_tei_t master3_tei = 1;
+ const mac_t master3_mac = 0x333333333333ull;
+ cp_net_t *master3_net = NULL;
+ cp_sta_t *master3 = NULL;
+ const cp_snid_t master3_snid = snid + 1;
+
+ assoc_create_master (t, &ctx, snid, nid, master2_tei, master2_mac,
+ &master_net, &master2);
+
+ /* Create and set Master as the real master of the net. */
+ assoc_create_master (t, &ctx, snid, nid, master_tei, master_mac,
+ &master_net, &master);
+
+ assoc_create_master (t, &ctx, master3_snid, nid, master3_tei,
+ master3_mac, &master3_net, &master3);
+
+ bsu_beacon_t beacon_master;
+ test_sta_action_beacon_create (&beacon_master, nid, snid,
+ master_tei, master_mac);
+ bsu_beacon_t beacon_master2;
+ test_sta_action_beacon_create (&beacon_master2, nid, snid,
+ master2_tei, master2_mac);
+
+ bsu_beacon_t beacon_master3;
+ test_sta_action_beacon_create (&beacon_master3, nid, master3_snid,
+ master3_tei, master3_mac);
+
+ cp_sta_own_data_set_nid (&ctx.cp, nid);
+ cp_sta_own_data_set_snid (&ctx.cp, 0xf);
+
+ ctx.cp.sta_action.assoc.init_count = 1;
+ test_begin (t, "Receive a beacon from the master, synchronisation")
+ {
+ /* In state DETECTING_BEACON */
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (detect__beacon_received,
+ .beacon = &beacon_master,
+ .net = master_net,
+ .sta = master),
+ SCENARIO_EVENT (cp_beacon_process_tracked_avln,
+ .beacon = &beacon_master,
+ .net = master_net),
+ /* Synchronisation still wrong. */
+ SCENARIO_ACTION (detect__beacon_received,
+ .beacon = &beacon_master,
+ .net = master_net,
+ .sta = master),
+ SCENARIO_EVENT (cp_beacon_synchronised, .ok = false),
+ /* Synchronisation is okay. */
+ SCENARIO_ACTION (detect__beacon_received,
+ .beacon = &beacon_master,
+ .net = master_net,
+ .sta = master),
+ SCENARIO_EVENT (cp_beacon_synchronised, .ok = true),
+ /* Synchronisation is okay, start association */
+ SCENARIO_ACTION (detect__beacon_received,
+ .beacon = &beacon_master,
+ .net = master_net,
+ .sta = master),
+ SCENARIO_EVENT (cp_beacon_synchronised, .ok = true),
+ SCENARIO_EVENT (cp_fsm_event_bare_new,
+ .type = CP_FSM_EVENT_TYPE_nd_beacon),
+ /* Synchronisation is okay, should NOT associate */
+ SCENARIO_ACTION (detect__beacon_received,
+ .beacon = &beacon_master2,
+ .net = master_net,
+ .sta = master2),
+ /* With a Master which as a snid different. It should not
+ * associate */
+ SCENARIO_ACTION (detect__beacon_received,
+ .beacon = &beacon_master3,
+ .net = master3_net,
+ .sta = master3),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+
+ cp_sta_own_data_t *own = cp_sta_mgr_get_sta_own_data (&ctx.cp);
+ test_fail_unless (own->tei_track == master_tei);
+ test_fail_unless (own->cco_mac_addr_track = master_mac);
+ test_fail_unless (own->nid_track = nid);
+ test_fail_unless (cp_sta_own_data_get_snid (&ctx.cp)
+ == cp_net_get_snid (&ctx.cp, master_net));
+ }
+ test_end;
+
+ cp_mme_peer_t master_peer, master2_peer;
+ cp_sta_get_peer (master, &master_peer);
+ cp_sta_get_peer (master2, &master2_peer);
+
+ test_begin (t, "Associate with the master")
+ {
+ ctx.cp.sta_action.assoc.retry = 2;
+ scenario_entry_t entries[] = {
+ /* In state DETECTING_BEACON with event nd_beacon */
+ SCENARIO_ACTION (assoc__detecting_detected),
+ SCENARIO_EVENT (cp_msg_cc_assoc_req_send,
+ .peer = master_peer,
+ .request_type = CP_MSG_CC_ASSOC_REQ_TYPE_NEW,
+ .nid = nid,
+ .cco_cap = CP_CCO_LEVEL,
+ .proxy_cap = CP_PCO_CAP),
+ /* Master2 answers. */
+ SCENARIO_ACTION (assoc__associating_cnf, .peer = master2_peer),
+ SCENARIO_EVENT (cp_msg_cc_assoc_cnf_receive, .ok = true,
+ .result = CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS,
+ .nid = nid, .snid = snid, .sta_tei = sta_tei,
+ .lease_time_min = 15),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (
+ ASSOCIATING, CC_ASSOC_CNF, unrelated)),
+ /* Master answers. */
+ SCENARIO_ACTION (assoc__associating_cnf, .peer = master_peer),
+ SCENARIO_EVENT (cp_msg_cc_assoc_cnf_receive, .ok = true,
+ .result = CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS,
+ .nid = nid, .snid = snid, .sta_tei = sta_tei,
+ .lease_time_min = 15),
+ SCENARIO_EVENT (cp_msg_cm_get_key_req_send,
+ .peer = master_peer, .peks = CP_MME_PEKS_DAK,
+ .pid = 0, .pmn = 1, .relayed = false,
+ .key_type = CP_MSG_KEY_NEK, .nid = nid),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (
+ ASSOCIATING, CC_ASSOC_CNF, success)),
+ /* Master answers White list ALL */
+ SCENARIO_ACTION (assoc__associating_cnf, .peer = master_peer),
+ SCENARIO_EVENT (
+ cp_msg_cc_assoc_cnf_receive, .ok = true,
+ .result = CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS_WL_ACCEPT_ALL,
+ .nid = nid, .snid = snid, .sta_tei = sta_tei,
+ .lease_time_min = 15),
+ SCENARIO_EVENT (cp_msg_cm_get_key_req_send,
+ .peer = master_peer, .peks = CP_MME_PEKS_DAK,
+ .pid = 0, .pmn = 1, .relayed = false,
+ .key_type = CP_MSG_KEY_NEK, .nid = nid),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (
+ ASSOCIATING, CC_ASSOC_CNF, success)),
+ /* Master answers with an error in the mme */
+ SCENARIO_ACTION (assoc__associating_cnf, .peer = master_peer),
+ SCENARIO_EVENT (cp_msg_cc_assoc_cnf_receive, .ok = false,
+ .result = CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS,
+ .nid = nid, .snid = snid, .sta_tei = sta_tei,
+ .lease_time_min = 15),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (
+ ASSOCIATING, CC_ASSOC_CNF, unrelated)),
+ /* Wrong NID. */
+ SCENARIO_ACTION (assoc__associating_cnf, .peer = master_peer),
+ SCENARIO_EVENT (cp_msg_cc_assoc_cnf_receive, .ok = true,
+ .result = CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS,
+ .nid = 0, .snid = snid, .sta_tei = sta_tei,
+ .lease_time_min = 15),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (
+ ASSOCIATING, CC_ASSOC_CNF, unrelated)),
+ /* Associating receiving a timeout retry */
+ SCENARIO_ACTION (assoc__associating_timeout),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (
+ ASSOCIATING, timeout_associating, retry)),
+ /* Associating receiving a timeout no retry */
+ SCENARIO_ACTION (assoc__associating_timeout),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (
+ ASSOCIATING, timeout_associating, no_retry)),
+ SCENARIO_EVENT (cp_beacon_process_untracked_avln),
+ SCENARIO_EVENT (cp_eoc_cco_bw_sta_allocations),
+ /* ASSOCIATING receives a no_beacons event. */
+ SCENARIO_ACTION (assoc__associating_no_beacons),
+ SCENARIO_EVENT (cp_beacon_process_untracked_avln),
+ SCENARIO_EVENT (cp_eoc_cco_bw_sta_allocations),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ }
+ test_end;
+
+ cp_key_t nek = {.key = {0, 0, 0, 0 }};
+ test_begin (t, "Authenticate with the master")
+ {
+ ctx.cp.sta_action.assoc.prun.pid = 0;
+ ctx.cp.sta_action.assoc.prun.pmn = 0;
+ scenario_entry_t entries[] = {
+ /* Receive the get key conf from the master 2. */
+ SCENARIO_ACTION (assoc__associated_key_cnf, .peer = master2_peer),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (
+ ASSOCIATED, CM_GET_KEY_CNF, unrelated)),
+ /* Receive the get key conf from the master MME is wrong. */
+ SCENARIO_ACTION (assoc__associated_key_cnf, .peer = master_peer),
+ SCENARIO_EVENT (cp_msg_cm_get_key_cnf_receive,
+ .ok = false,
+ .result = CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED,
+ .key_type = CP_MSG_KEY_NEK,
+ .nid = nid),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (
+ ASSOCIATED, CM_GET_KEY_CNF, unrelated)),
+ /* Receive the get key conf from the master MME key refuse. */
+ SCENARIO_ACTION (assoc__associated_key_cnf,
+ .peer = master_peer),
+ SCENARIO_EVENT (cp_msg_cm_get_key_cnf_receive,
+ .ok = true,
+ .peks = CP_MME_PEKS_DAK,
+ .pid = 0,
+ .pmn = 0x2,
+ .new_prn = true,
+ .new_my_nonce = false,
+ .new_your_nonce = false,
+ .result = CP_MSG_CM_GET_KEY_CNF_RESULT_REQUEST_REFUSED,
+ .key_type = CP_MSG_KEY_NEK,
+ .nid = nid),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (
+ ASSOCIATED, CM_GET_KEY_CNF, not_granted)),
+ /* Receive the get key conf from the master MME key granted, wrong
+ * NID. */
+ SCENARIO_ACTION (assoc__associated_key_cnf,
+ .peer = master_peer),
+ SCENARIO_EVENT (cp_msg_cm_get_key_cnf_receive,
+ .ok = true,
+ .peks = CP_MME_PEKS_DAK,
+ .new_prn = true,
+ .pid = 0,
+ .pmn = 0x2,
+ .result = CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED,
+ .key_type = CP_MSG_KEY_NEK),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (
+ ASSOCIATED, CM_GET_KEY_CNF, unrelated)),
+ /* Receive the get key conf from the master MME key granted.
+ * Wrong Key type. */
+ SCENARIO_ACTION (assoc__associated_key_cnf,
+ .peer = master_peer),
+ SCENARIO_EVENT (cp_msg_cm_get_key_cnf_receive,
+ .ok = true,
+ .peks = CP_MME_PEKS_DAK,
+ .new_prn = true,
+ .pid = 0,
+ .pmn = 0x2,
+ .result = CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED,
+ .key_type = CP_MSG_KEY_TEK,
+ .nid = nid),
+ /* Receive the get key conf from the master MME key granted. */
+ SCENARIO_ACTION (assoc__associated_key_cnf,
+ .peer = master_peer),
+ SCENARIO_EVENT (cp_msg_cm_get_key_cnf_receive,
+ .ok = true,
+ .peks = CP_MME_PEKS_DAK,
+ .pid = 0,
+ .pmn = 0,
+ .new_prn = false,
+ .result = CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED,
+ .key_type = CP_MSG_KEY_NEK,
+ .nid = nid,
+ .eks = 0,
+ .key = &nek),
+ SCENARIO_EVENT (cp_beacon_change_nek, .eks = 0,
+ .nek = &nek,
+ .now = true),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (
+ ASSOCIATED, CM_GET_KEY_CNF, all_keys_granted)),
+ SCENARIO_EVENT (cp_msg_cm_get_key_req_send,
+ .peer = master_peer,
+ .peks = CP_MME_PEKS_DAK,
+ .pid = 0,
+ .pmn = 1,
+ .relayed = false,
+ .key_type = CP_MSG_KEY_TEK,
+ .nid = nid),
+ /* ASSOCIATED no beacons. */
+ SCENARIO_ACTION (assoc__associated_no_beacons),
+ SCENARIO_EVENT (cp_beacon_process_untracked_avln),
+ SCENARIO_EVENT (cp_eoc_cco_bw_sta_allocations),
+ /* ASSOCIATED timeout associating. */
+ SCENARIO_ACTION (assoc__associated_timeout),
+ SCENARIO_EVENT (cp_beacon_process_untracked_avln),
+ SCENARIO_EVENT (cp_eoc_cco_bw_sta_allocations),
+ /* ASSOCIATED receives a CC_LEAVE_IND. Wrong MME. */
+ SCENARIO_ACTION (assoc__associated_leave, .peer = master_peer),
+ SCENARIO_EVENT (
+ cp_msg_cc_leave_ind_receive,
+ .ok = false,
+ .reason = CP_MSG_CC_LEAVE_IND_REASON_TEI_LEASE_EXPIRED,
+ .nid = nid),
+ SCENARIO_EVENT (
+ cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (ASSOCIATED, CC_LEAVE_IND, nok)),
+ /* ASSOCIATED receives a CC_LEAVE_IND. Wrong NID */
+ SCENARIO_ACTION (assoc__associated_leave, .peer = master_peer),
+ SCENARIO_EVENT (
+ cp_msg_cc_leave_ind_receive,
+ .ok = true,
+ .reason = CP_MSG_CC_LEAVE_IND_REASON_TEI_LEASE_EXPIRED,
+ .nid = 0),
+ SCENARIO_EVENT (
+ cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (ASSOCIATED, CC_LEAVE_IND, nok)),
+ /* ASSOCIATED receives a CC_LEAVE_IND. */
+ SCENARIO_ACTION (assoc__associated_leave, .peer = master_peer),
+ SCENARIO_EVENT (
+ cp_msg_cc_leave_ind_receive,
+ .ok = true,
+ .reason = CP_MSG_CC_LEAVE_IND_REASON_TEI_LEASE_EXPIRED,
+ .nid = nid),
+ SCENARIO_EVENT (cp_msg_cc_leave_rsp_send, .peer = master_peer),
+ SCENARIO_EVENT (
+ cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (ASSOCIATED, CC_LEAVE_IND, ok)),
+ SCENARIO_EVENT (cp_beacon_process_untracked_avln),
+ SCENARIO_EVENT (cp_eoc_cco_bw_sta_allocations),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ }
+ test_end;
+
+ test_begin (t, "Authenticate with the master")
+ {
+ cp_sta_mgr_set_our_avln (&ctx.cp, master_net);
+ scenario_entry_t entries[] = {
+ /* Receives the cm_get_key_cnf from Master2. Fails. */
+ SCENARIO_ACTION (auth__authenticated_key_cnf,
+ .peer = master2_peer),
+ /* Receives the cm_get_key_cnf from Master. Wrong MME. */
+ SCENARIO_ACTION (auth__authenticated_key_cnf,
+ .peer = master_peer),
+ SCENARIO_EVENT (cp_msg_cm_get_key_cnf_receive,
+ .ok = true),
+ /* Receives the cm_get_key_cnf from Master. Wrong key. */
+ SCENARIO_ACTION (auth__authenticated_key_cnf,
+ .peer = master_peer),
+ SCENARIO_EVENT (cp_msg_cm_get_key_cnf_receive,
+ .ok = true,
+ .peks = CP_MME_PEKS_DAK,
+ .pid = 0,
+ .pmn = 0x2,
+ .result = CP_MSG_CM_GET_KEY_CNF_RESULT_REQUEST_REFUSED,
+ .key_type = CP_MSG_KEY_NEK,
+ .nid = nid),
+ /* Receives the cm_get_key_cnf from Master. Refused. */
+ SCENARIO_ACTION (auth__authenticated_key_cnf,
+ .peer = master_peer),
+ SCENARIO_EVENT (cp_msg_cm_get_key_cnf_receive,
+ .ok = true,
+ .peks = CP_MME_PEKS_DAK,
+ .pid = 0,
+ .pmn = 0x2,
+ .result = CP_MSG_CM_GET_KEY_CNF_RESULT_REQUEST_REFUSED,
+ .key_type = CP_MSG_KEY_TEK,
+ .nid = nid),
+ /* Receives the cm_get_key_cnf from Master. Granted. */
+ SCENARIO_ACTION (auth__authenticated_key_cnf,
+ .peer = master_peer),
+ SCENARIO_EVENT (cp_msg_cm_get_key_cnf_receive,
+ .ok = true,
+ .peks = CP_MME_PEKS_DAK,
+ .pid = 0,
+ .pmn = 0x2,
+ .result = CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED,
+ .key_type = CP_MSG_KEY_TEK,
+ .nid = nid),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ }
+ test_end;
+
+ test_sta_action_uninit (&ctx);
+}
+
+void
+assoc_test_suite (test_t t)
+{
+ test_suite_begin (t, "assoc");
+ assoc_test_case_basic (t);
+}
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/src/beacon_stub.c b/cesar/cp/eoc/sta/action/test/utest_eoc/src/beacon_stub.c
new file mode 100644
index 0000000000..026d682bba
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/src/beacon_stub.c
@@ -0,0 +1,112 @@
+/* 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 "cp/sta/mgr/sta_mgr.h"
+
+#include "lib/scenario/scenario.h"
+
+void
+cp_beacon_create_default_schedules (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ scenario_event (cp_beacon_create_default_schedules);
+}
+
+void
+cp_beacon_process_tracked_avln (cp_t *ctx, bsu_beacon_t *beacon,
+ cp_net_t *net)
+{
+ dbg_assert (ctx);
+ dbg_assert (beacon);
+ dbg_assert (net);
+ cp_sta_own_data_t *own = cp_sta_mgr_get_sta_own_data (ctx);
+ own->nid_track = beacon->vf.nid;
+ own->tei_track = beacon->vf.stei;
+ own->cco_mac_addr_track = beacon->bmis.mac_address.present ?
+ beacon->bmis.mac_address.mac_address : MAC_ZERO;
+ scenario_event (cp_beacon_process_tracked_avln, param);
+ test_fail_unless (beacon == param->beacon);
+ test_fail_unless (net == param->net);
+ test_fail_unless (cp_net_get_nid (ctx, net) == beacon->vf.nid);
+}
+
+void
+cp_beacon_process_untracked_avln (cp_t *ctx)
+{
+ cp_sta_own_data_t *own = cp_sta_mgr_get_sta_own_data (ctx);
+ own->nid_track = 0;
+ own->tei_track = 0;
+ own->cco_mac_addr_track = MAC_ZERO;
+ scenario_event (cp_beacon_process_untracked_avln);
+}
+
+void
+cp_beacon_beacon_not_received (cp_t *ctx)
+{
+ dbg_assert (ctx);
+}
+
+void
+cp_beacon_reconfigure_timer (cp_t *ctx, bool cco)
+{
+ dbg_assert (ctx);
+ scenario_event (cp_beacon_reconfigure_timer);
+}
+
+void
+cp_beacon_change_nek (cp_t *ctx, uint eks, cp_key_t nek, bool now)
+{
+ dbg_assert (ctx);
+ scenario_event (cp_beacon_change_nek, param);
+ test_fail_unless (eks == param->eks);
+ test_fail_unless (memcmp (&nek, param->nek, sizeof (nek)) == 0);
+ test_fail_unless (now == param->now);
+}
+
+void
+cp_beacon_deactivate (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ scenario_event (cp_beacon_deactivate);
+}
+
+void
+cp_beacon_poweron_init (cp_t *ctx)
+{
+}
+
+void
+cp_av_beacon_sta_update_beacon_data (cp_t *ctx)
+{
+}
+
+void
+cp_beacon_cco_update_beacon_data (cp_t *ctx)
+{
+}
+
+
+void
+cp_av_beacon_discover_init (cp_t *ctx) {}
+
+void
+cp_av_beacon_discover_uninit (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_eoc/src/ce_stub.c b/cesar/cp/eoc/sta/action/test/utest_eoc/src/ce_stub.c
new file mode 100644
index 0000000000..ec7ff29510
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/src/ce_stub.c
@@ -0,0 +1,24 @@
+/* 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"
+
+extern 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_eoc/src/core_stub.c b/cesar/cp/eoc/sta/action/test/utest_eoc/src/core_stub.c
new file mode 100644
index 0000000000..dae4a03060
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/src/core_stub.c
@@ -0,0 +1,42 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/core_stub.c
+ * \brief STA core stub.
+ * \ingroup test
+ */
+#include "common/std.h"
+#include "cp/sta/core/core.h"
+
+#include "lib/scenario/scenario.h"
+
+void
+cp_sta_core_gen_timed_event (
+ cp_t *cp_ctx, cp_sta_core_timed_event_def_t *sta_core_timed_event,
+ cp_fsm_event_t *fsm_event, uint event_delay_ms)
+{
+ dbg_assert (cp_ctx);
+ dbg_assert (sta_core_timed_event);
+ scenario_event (cp_sta_core_gen_timed_event, param);
+ test_fail_unless (event_delay_ms >= param->delay_min_ms);
+ test_fail_unless (event_delay_ms <= param->delay_max_ms);
+}
+
+void
+cp_sta_core_stop_timed_or_cyclic_event(
+ cp_t *cp_ctx, cp_sta_core_timed_event_def_t *sta_core_timed_event)
+{
+ dbg_assert (cp_ctx);
+ dbg_assert (sta_core_timed_event);
+ scenario_event (cp_sta_core_stop_timed_or_cyclic_event);
+}
+
+void
+cp_sta_core_checkpoint (cp_t *ctx)
+{
+}
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/src/cp_stub.c b/cesar/cp/eoc/sta/action/test/utest_eoc/src/cp_stub.c
new file mode 100644
index 0000000000..b9d5f3c7f3
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/src/cp_stub.c
@@ -0,0 +1,35 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/cp_stub.c
+ * \brief CP stub.
+ * \ingroup test
+ */
+#include "common/std.h"
+#include "lib/scenario/scenario.h"
+#include "cp/cp.h"
+
+void
+cp_compute_nmk_and_nid_from_npw (cp_t *ctx, const char *npw,
+ cp_security_level_t sl)
+{
+ dbg_assert (ctx);
+ dbg_assert (npw);
+}
+
+u32
+cp_sta_core_get_date_ms (cp_t *ctx)
+{
+ return 0;
+}
+
+void
+cp_eoc_cco_bw_sta_allocations (cp_t *ctx)
+{
+ scenario_event (cp_eoc_cco_bw_sta_allocations);
+}
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/src/dataplane_stub.c b/cesar/cp/eoc/sta/action/test/utest_eoc/src/dataplane_stub.c
new file mode 100644
index 0000000000..f8bc35fbf8
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/src/dataplane_stub.c
@@ -0,0 +1,84 @@
+/* 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_activate (sar_t *ctx, bool flag)
+{
+ scenario_event (sar_activate, param);
+ test_fail_unless (flag == param->flag);
+}
+
+void
+sar_cleanup (sar_t *ctx)
+{
+ if (!scenario.current
+ || scenario.current->event_id != SCENARIO_EVENT_sar_cleanup)
+ return; /* Be less strict. */
+ scenario_event (sar_cleanup);
+}
+
+void
+sar_store_mfs_remove (mac_store_t *mac_store, mfs_t *mfs, void *user)
+{
+ mac_store_mfs_remove (mac_store, mfs);
+}
+
+void
+sar_sta_remove (sar_t *ctx, u8 tei)
+{
+ cp_t *cp = (void *) ctx;
+ /* For EoC some GLID are created. */
+ sta_t *sta = mac_store_sta_get (cp->mac_store, tei);
+ if (sta)
+ {
+ mac_store_mfs_travel_by_tei (cp->mac_store, tei,
+ sar_store_mfs_remove,
+ ctx);
+ dbg_check (mac_store_sta_remove (cp->mac_store, tei));
+ blk_release (sta);
+ }
+}
+
+void
+pbproc_activate (pbproc_t *ctx, bool flag)
+{
+ scenario_event (pbproc_activate, param);
+ test_fail_unless (flag == param->flag);
+}
+
+
+void
+pbproc_parameters_adjust (pbproc_t *ctx, bool adjust)
+{
+ scenario_event (pbproc_parameters_adjust, param);
+ test_fail_unless (adjust == param->adjust);
+}
+
+void
+phy_tx_scale_adapt_exp_set (phy_t *ctx, u8 exp)
+{
+ dbg_assert_default ();
+}
+
+void
+phy_tx_scale_adapt_set (phy_t *ctx, u16 value)
+{
+ dbg_assert_default ();
+}
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/src/drv.c b/cesar/cp/eoc/sta/action/test/utest_eoc/src/drv.c
new file mode 100644
index 0000000000..e51a17e2cd
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/src/drv.c
@@ -0,0 +1,688 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/drv.c
+ * \brief Test sta/action/drv.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "lib/scenario/scenario.h"
+#include "cp/av/sta/action/poweron.h"
+#include "inc/test_sta_action.h"
+#include "lib/stats.h"
+#include "cl/inc/context.h"
+#include "bsu/aclf/aclf.h"
+
+#include <string.h>
+
+static void
+drv_set_params (cp_t *ctx,
+ mac_t mac,
+ bool cco_pref,
+ bool was_cco,
+ const char *npw,
+ const char *dpw,
+ cp_security_level_t sl,
+ cp_nid_t nid,
+ const char *m_sta_hfid,
+ const char *u_sta_hfid,
+ const char *avln_hfid,
+ const u32 *tonemask,
+ uint carrier_nb)
+{
+ int i;
+ cp_sta_own_data_t *own = cp_sta_mgr_get_sta_own_data (ctx);
+ cp_sta_own_data_set_mac_address (ctx, mac);
+ own->cco_prefered = cco_pref;
+ cp_sta_own_data_set_was_cco (ctx, was_cco);
+ cp_sta_own_data_set_npw (ctx, npw);
+ cp_sta_own_data_set_dpw (ctx, dpw);
+ cp_sta_own_data_set_security_level (ctx, sl);
+ cp_sta_own_data_set_nid (ctx, nid);
+ cp_sta_own_data_set_hfid_manufacturer (ctx, m_sta_hfid);
+ cp_sta_own_data_set_hfid_user (ctx, u_sta_hfid);
+ cp_sta_own_data_set_hfid_avln (ctx, avln_hfid);
+ dbg_assert (tonemask == NULL);
+ for (i = 0; i < PHY_TONEMASK_WORDS; i++)
+ ctx->mac_config->tonemask_info.tonemask[i] = 0;
+ ctx->mac_config->tonemask_info.carrier_nb = carrier_nb;
+}
+
+static void
+drv_check_params (cp_t *ctx,
+ test_t t,
+ mac_t mac,
+ bool cco_pref,
+ bool was_cco,
+ const char *npw,
+ const char *dpw,
+ cp_security_level_t sl,
+ cp_nid_t nid,
+ const char *m_sta_hfid,
+ const char *u_sta_hfid,
+ const char *avln_hfid,
+ const u32 *tonemask,
+ uint carrier_nb)
+{
+ int i;
+ test_within (t);
+ cp_sta_own_data_t *own = cp_sta_mgr_get_sta_own_data (ctx);
+ test_fail_unless (mac == cp_sta_own_data_get_mac_address (ctx));
+ test_fail_unless (cco_pref == own->cco_prefered);
+ test_fail_unless (was_cco == cp_sta_own_data_get_was_cco (ctx));
+ test_fail_unless (strcmp (npw, cp_sta_own_data_get_npw (ctx)) == 0);
+ test_fail_unless (strcmp (dpw, cp_sta_own_data_get_dpw (ctx)) == 0);
+ test_fail_unless (sl == cp_sta_own_data_get_security_level (ctx));
+ test_fail_unless (nid == cp_sta_own_data_get_nid (ctx));
+ test_fail_unless (strcmp (m_sta_hfid, own->hfid_manufacturer) == 0);
+ test_fail_unless (strcmp (u_sta_hfid, own->hfid_user) == 0);
+ test_fail_unless (strcmp (avln_hfid, own->hfid_avln) == 0);
+ if (tonemask == NULL)
+ for (i = 0; i < PHY_TONEMASK_WORDS; i++)
+ test_fail_unless (ctx->mac_config->tonemask_info.tonemask[i]
+ == 0);
+ else
+ for (i = 0; i < PHY_TONEMASK_WORDS; i++)
+ test_fail_unless (ctx->mac_config->tonemask_info.tonemask[i]
+ == tonemask[i]);
+ test_fail_unless (ctx->mac_config->tonemask_info.carrier_nb
+ == carrier_nb);
+}
+
+static void
+drv_basic_test_case (test_t t)
+{
+ test_sta_action_t ctx;
+ test_sta_action_init (&ctx);
+ cp_mme_peer_t peer = CP_MME_PEER (0xaabbccddeeffull, MAC_TEI_FOREIGN);
+ cp_nid_t nid;
+ test_case_begin (t, "basic");
+ test_begin (t, "set")
+ {
+ drv_set_params (&ctx.cp, MAC_BROADCAST, false, false, "", "",
+ CP_SECURITY_LEVEL_SC, 1, "", "", "", NULL, 0);
+ u32 tonemask[PHY_TONEMASK_WORDS];
+ uint i;
+ nid = ((u64) CP_SECURITY_LEVEL_HS) << (HPAV_NID_SIZE_BITS - 2)
+ | 0x002233445566ull;
+ uint carriers_nb = tonemask_default (tonemask);
+ u8 my_param_u8 = 0;
+ u64 my_param_u64 = 0;
+ char config[] = "my_param_u8:42 my_param_u64:0x4242424242";
+ lib_stats_set_stat_value_notype ("my_param_u8", &my_param_u8,
+ LIB_STATS_ACCESS_WRITE_ONLY,
+ LIB_STATS_USER);
+ lib_stats_set_stat_value_notype ("my_param_u64", &my_param_u64,
+ LIB_STATS_ACCESS_READ_WRITE,
+ LIB_STATS_USER);
+ scenario_entry_t entries[] = {
+ /* Set MAC address. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_mac_addr_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_mac_addr_req_receive,
+ .ok = true,
+ .mac = 0x112233445566ull),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_MAC_ADDR_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ /* Set CCo preferred flag. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_cco_pref_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_cco_pref_req_receive,
+ .ok = true,
+ .cco_pref = true),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_CCO_PREF_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ /* Set was CCo flag. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_was_cco_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_was_cco_req_receive,
+ .ok = true,
+ .was_cco = true),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_WAS_CCO_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ /* Set NPW. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_npw_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_npw_req_receive,
+ .ok = true,
+ .npw = "p4ssw0rd"),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_NPW_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ /* Set DPW. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_dpw_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_dpw_req_receive,
+ .ok = true,
+ .dpw = "s3cr3t"),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_DPW_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ /* Set SL. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_sl_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_sl_req_receive,
+ .ok = true,
+ .sl = CP_SECURITY_LEVEL_HS),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_SL_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ /* Set NID. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_nid_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_nid_req_receive,
+ .ok = true,
+ .nid = nid),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_NID_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ /* Set manufacturer STA HFID. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_m_sta_hfid_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_m_sta_hfid_req_receive,
+ .ok = true,
+ .m_sta_hfid = "the M STA HFID"),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_M_STA_HFID_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ /* Set user STA HFID. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_u_sta_hfid_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_u_sta_hfid_req_receive,
+ .ok = true,
+ .u_sta_hfid = "the U STA HFID"),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_U_STA_HFID_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ /* Set AVLN HFID. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_avln_hfid_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_avln_hfid_req_receive,
+ .ok = true,
+ .avln_hfid = "the AVLN HFID"),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_AVLN_HFID_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ /* Set tonemask. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_tonemask_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_tonemask_req_receive,
+ .ok = true,
+ .tonemask = tonemask),
+ SCENARIO_EVENT (pbproc_parameters_adjust, .adjust = false),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_TONEMASK_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ /* Set config. */
+ SCENARIO_ACTION (drv__drv_sta_set_config_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_config_req_receive,
+ .ok = true,
+ .config = config),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_CONFIG_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ SCENARIO_END
+ };
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+ scenario_run (t, entries, &globals);
+ drv_check_params (&ctx.cp, t, 0x112233445566ull, true, true,
+ "p4ssw0rd", "s3cr3t", CP_SECURITY_LEVEL_HS,
+ nid, "the M STA HFID",
+ "the U STA HFID", "the AVLN HFID", tonemask,
+ carriers_nb);
+
+
+ cp_key_t nmk_old = { { 0x0, 0x0, 0x0, 0x0} };
+ ctx.cp.sta_mgr.sta_own_data.nmk = nmk_old;
+ cp_nid_t old_nid = 0x1;
+
+ cp_sta_own_data_set_nid (&ctx.cp, old_nid);
+ cp_sta_own_data_set_security_level (&ctx.cp, 0x0);
+
+ enum cp_msg_drv_sta_set_key_type_t type =
+ CP_MSG_DRV_STA_SET_KEY_TYPE_CHANGE_NID;
+ cp_security_level_t sl = 0x1;
+ nid = ((u64) sl) << (HPAV_NID_SIZE_BITS - 2) | 0x123456789abcdull;
+
+ cp_sta_own_data_set_nid (&ctx.cp, nid);
+ cp_key_t nmk = { { 0x11112222, 0x33334444, 0x55556666, 0x77778889 } };
+
+ type = CP_MSG_DRV_STA_SET_KEY_TYPE_CHANGE_SECURITY_LEVEL;
+ scenario_entry_t entries3[] = {
+ /* Set KEY. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_key_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_key_req_receive,
+ .ok = true,
+ .nmk = nmk,
+ .type = type,
+ .nid = nid,
+ .sl = sl),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_KEY_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_key_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_key_req_receive,
+ .ok = false,
+ .nmk = nmk,
+ .type = type,
+ .nid = nid,
+ .sl = sl),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_KEY_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ SCENARIO_END
+ };
+ scenario_run (t, entries3, &globals);
+
+ nid = cp_secu_nmk2nid (&ctx.cp, nmk, sl);
+ test_fail_unless ((cp_sta_own_data_get_nid (&ctx.cp)) == nid);
+
+ /* SET DAK. */
+ cp_key_t dak = {{ 0x11111111, 0x22222222, 0x33333333, 0x44444444}};
+ cp_key_t own_dak;
+ scenario_entry_t entries4[] = {
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_dak_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_dak_req_receive,
+ .ok = true,
+ .dak = dak),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_DAK_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ SCENARIO_END
+ };
+ scenario_run (t, entries4, &globals);
+
+ own_dak = cp_sta_own_data_get_dak (&ctx.cp);
+ for (i = 0; i < COUNT (dak.key); i++)
+ test_fail_unless (dak.key[i] == own_dak.key[i]);
+
+ memset (&dak, 0, sizeof (cp_key_t));
+ scenario_entry_t entries5[] = {
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_dak_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_dak_req_receive,
+ .ok = false,
+ .dak = dak),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_DAK_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ SCENARIO_END
+ };
+ scenario_run (t, entries5, &globals);
+
+ own_dak = cp_sta_own_data_get_dak (&ctx.cp);
+ for (i = 0; i < COUNT (dak.key); i++)
+ test_fail_unless (dak.key[i] != own_dak.key[i]);
+ } test_end;
+ test_begin (t, "set error")
+ {
+ drv_set_params (&ctx.cp, MAC_BROADCAST, false, false, "", "",
+ CP_SECURITY_LEVEL_SC, 1, "", "", "", NULL, 0);
+ scenario_entry_t entries[] = {
+ /* Set MAC address. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_mac_addr_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_mac_addr_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_MAC_ADDR_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ /* Set CCo preferred flag. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_cco_pref_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_cco_pref_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_CCO_PREF_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ /* Set was CCo flag. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_was_cco_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_was_cco_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_WAS_CCO_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ /* Set NPW. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_npw_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_npw_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_NPW_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ /* Set DPW. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_dpw_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_dpw_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_DPW_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ /* Set SL. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_sl_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_sl_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_SL_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ /* Set NID. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_nid_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_nid_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_NID_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ /* Set manufacturer STA HFID. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_m_sta_hfid_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_m_sta_hfid_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_M_STA_HFID_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ /* Set user STA HFID. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_u_sta_hfid_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_u_sta_hfid_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_U_STA_HFID_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ /* Set AVLN HFID. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_avln_hfid_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_avln_hfid_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_AVLN_HFID_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ /* Set tonemask. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_tonemask_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_tonemask_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_TONEMASK_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ SCENARIO_END
+ };
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+ scenario_run (t, entries, &globals);
+ drv_check_params (&ctx.cp, t, MAC_BROADCAST, false, false, "", "",
+ CP_SECURITY_LEVEL_SC, 1, "", "", "", NULL, 0);
+ } test_end;
+ test_begin (t, "start")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (drv__stopped__drv_sta_mac_start_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_mac_start_req_receive,
+ .ok = true),
+ SCENARIO_EVENT (cp_fsm_event_bare_new,
+ .type = CP_FSM_EVENT_TYPE_to_poweron),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_MAC_START_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ SCENARIO_END
+ };
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_begin (t, "start error")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (drv__stopped__drv_sta_mac_start_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_mac_start_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_MAC_START_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ SCENARIO_END
+ };
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_begin (t, "stop")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (drv__started__drv_sta_mac_stop_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_mac_stop_req_receive,
+ .ok = true),
+ SCENARIO_EVENT (cp_fsm_event_bare_new,
+ .type = CP_FSM_EVENT_TYPE_to_stop),
+ /* ... */
+ SCENARIO_ACTION (drv__stopping__stopped),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_MAC_STOP_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ SCENARIO_END
+ };
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_sta_action_uninit (&ctx);
+}
+
+void
+drv_get_key_test_case (test_t t)
+{
+ test_sta_action_t ctx;
+ test_case_begin (t, "DRV_GET_KEY");
+
+ test_begin (t, "Good and bad")
+ {
+ cp_key_t nmk = { { 0x11112222, 0x33334444, 0x55556666, 0x77778888 } };
+ cp_security_level_t sl = 0x1;
+ cp_nid_t nid = (((u64) sl) << (HPAV_NID_SIZE_BITS - 2)) | 0x123456789abcdull;
+ cp_mme_peer_t peer = CP_MME_PEER (0x012345, MAC_TEI_UNASSOCIATED);
+ test_sta_action_init (&ctx);
+
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+
+ /* Set NID, sl, and nmk. */
+ ctx.cp.sta_mgr.sta_own_data.nmk = nmk;
+ cp_sta_own_data_set_security_level (&ctx.cp, sl);
+ cp_sta_own_data_set_nid (&ctx.cp, nid);
+
+ cp_key_t nmk_null = { {0, 0, 0, 0}};
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (drv__drv_sta_get_key_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_get_key_req_receive,
+ .ok = true),
+ SCENARIO_EVENT (cp_msg_drv_sta_get_key_cnf_send,
+ .peer = peer,
+ .result = CP_MSG_DRV_RESULT_SUCCESS,
+ .nmk = nmk,
+ .nid = nid,
+ .sl = sl),
+ SCENARIO_ACTION (drv__drv_sta_get_key_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_get_key_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_sta_get_key_cnf_send,
+ .peer = peer,
+ .result = CP_MSG_DRV_RESULT_FAILURE,
+ .nmk = nmk_null,
+ .nid = 0,
+ .sl = 0),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ }
+ test_end;
+}
+
+
+void
+drv_get_sta_status_test_case (test_t t)
+{
+ test_sta_action_t ctx;
+ test_case_begin (t, "DRV_GET_STA_STATUS");
+ cp_mme_peer_t peer = CP_MME_PEER(0x1, MAC_TEI_FOREIGN);
+ test_sta_action_init (&ctx);
+ cl_t cl;
+ ctx.cp.cl = &cl;
+
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+
+ cp_sta_own_data_set_tei (&ctx.cp, 1);
+ cp_sta_own_data_set_security_level (&ctx.cp, CP_SECURITY_LEVEL_HS);
+ *((bsu_aclf_frequency_t*) &ctx.cp.bsu_aclf->frequency) =
+ BSU_ACLF_FREQ_50HZ;
+
+ test_begin (t, "Good and bad")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (drv__drv_sta_status_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_status_req_receive,
+ .ok = true),
+ SCENARIO_EVENT (cp_msg_drv_sta_status_cnf_send,
+ .peer = peer,
+ .result = CP_MSG_DRV_RESULT_SUCCESS,
+ .status = CP_MSG_DRV_STA_STATUS_STATUS_ASSOC,
+ .cco = CP_MSG_DRV_STA_STATUS_CCO_STA,
+ .preferred_cco = false,
+ .backup_cco = false,
+ .simple_connect = false,
+ .pwl_sync_frequency = BSU_ACLF_FREQ_50HZ),
+ SCENARIO_ACTION (drv__drv_sta_status_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_status_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_sta_status_cnf_send,
+ .peer = peer,
+ .result = CP_MSG_DRV_RESULT_FAILURE,
+ .status = 0,
+ .cco = 0,
+ .preferred_cco = false,
+ .backup_cco = false,
+ .simple_connect = false,
+ .pwl_sync_frequency = 0),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ }
+ test_end;
+ test_begin (t, "UCCo/CCo status")
+ {
+ scenario_entry_t entries_ucco[] = {
+ SCENARIO_ACTION (drv__drv_sta_status_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_status_req_receive,
+ .ok = true),
+ SCENARIO_EVENT (cp_msg_drv_sta_status_cnf_send,
+ .peer = peer,
+ .result = CP_MSG_DRV_RESULT_SUCCESS,
+ .status = CP_MSG_DRV_STA_STATUS_STATUS_UNASSOC,
+ .cco = CP_MSG_DRV_STA_STATUS_CCO_CCO,
+ .preferred_cco = false,
+ .backup_cco = false,
+ .simple_connect = false,
+ .pwl_sync_frequency = BSU_ACLF_FREQ_50HZ),
+ SCENARIO_END
+ };
+ /* Set our AVLN. */
+ cp_snid_t snid = cp_sta_own_data_get_snid (&ctx.cp);
+ cp_nid_t nid = cp_sta_own_data_get_nid (&ctx.cp);
+ cp_net_t *net = cp_sta_mgr_add_avln (&ctx.cp, snid, nid);
+ cp_sta_mgr_set_our_avln (&ctx.cp, net);
+ cp_sta_own_data_set_cco_status (&ctx.cp, true);
+ net->num_associated_stas = 0;
+ scenario_run (t, entries_ucco, &globals);
+
+ scenario_entry_t entries_cco[] = {
+ SCENARIO_ACTION (drv__drv_sta_status_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_status_req_receive,
+ .ok = true),
+ SCENARIO_EVENT (cp_msg_drv_sta_status_cnf_send,
+ .peer = peer,
+ .result = CP_MSG_DRV_RESULT_SUCCESS,
+ .status = CP_MSG_DRV_STA_STATUS_STATUS_AUTH,
+ .cco = CP_MSG_DRV_STA_STATUS_CCO_CCO,
+ .preferred_cco = false,
+ .backup_cco = false,
+ .simple_connect = false,
+ .pwl_sync_frequency = BSU_ACLF_FREQ_50HZ),
+ SCENARIO_END
+ };
+ /* Set our AVLN. */
+ net->num_associated_stas = 1;
+ scenario_run (t, entries_cco, &globals);
+ }
+ test_end;
+}
+
+void
+drv_test_suite (test_t t)
+{
+ test_suite_begin (t, "drv");
+ drv_basic_test_case (t);
+ drv_get_key_test_case (t);
+ drv_get_sta_status_test_case (t);
+}
+
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/src/fsm_stub.c b/cesar/cp/eoc/sta/action/test/utest_eoc/src/fsm_stub.c
new file mode 100644
index 0000000000..99ba41477f
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/src/fsm_stub.c
@@ -0,0 +1,50 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/fsm_stub.c
+ * \brief FSM stub.
+ * \ingroup test
+ */
+#include "common/std.h"
+#include "cp/fsm/fsm.h"
+
+#include "lib/scenario/scenario.h"
+
+cp_fsm_event_t *
+cp_fsm_event_bare_new (cp_t *ctx, cp_fsm_event_type_t type)
+{
+ dbg_assert (ctx);
+ switch (type)
+ {
+ /* Ignore. */
+ return INVALID_PTR;
+ default:
+ ;
+ }
+ scenario_event (cp_fsm_event_bare_new, param);
+ test_fail_unless (type == param->type);
+ return INVALID_PTR;
+}
+
+cp_fsm_event_t *
+cp_fsm_event_mme_new (cp_t *ctx, cp_fsm_event_type_t type, cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+ scenario_event (cp_fsm_event_mme_new, param);
+ test_fail_unless (type == param->type);
+ return INVALID_PTR;
+}
+
+void
+cp_fsm_branch_ (cp_t *ctx, cp_fsm_branch_t branch)
+{
+ dbg_assert (ctx);
+ scenario_event (cp_fsm_branch, param);
+ test_fail_unless (branch == param->branch);
+}
+
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/src/key.c b/cesar/cp/eoc/sta/action/test/utest_eoc/src/key.c
new file mode 100644
index 0000000000..994be95772
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/src/key.c
@@ -0,0 +1,34 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/key.c
+ * \brief Test sta/action/key.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "lib/scenario/scenario.h"
+
+#include "inc/test_sta_action.h"
+
+void
+key_basic_test_case (test_t t)
+{
+ test_sta_action_t ctx;
+ test_sta_action_init (&ctx);
+ /* Cleanup. */
+ test_sta_action_uninit (&ctx);
+ dbg_assert_default ();
+}
+
+void
+key_test_suite (test_t t)
+{
+ test_suite_begin (t, "key");
+ key_basic_test_case (t);
+}
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/src/mac_sar_interface_stub.c b/cesar/cp/eoc/sta/action/test/utest_eoc/src/mac_sar_interface_stub.c
new file mode 100644
index 0000000000..7670aca0aa
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/src/mac_sar_interface_stub.c
@@ -0,0 +1,35 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2011 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/mac_sar_interface_stub.c
+ * \brief SAR interface stub functions.
+ * \ingroup cp_msg
+ *
+ * « long description »
+ */
+#include "common/std.h"
+
+#include "mac/sar/sar.h"
+#include "mac/sar/sar_pb_stats.h"
+
+static sar_pb_stats_entry_t fake;
+
+sar_pb_stats_entry_t*
+sar_read_pb_stats_entry (sar_t *ctx, uint index)
+{
+ int i;
+ fake.ntb_clock = 0;
+ fake.stei = 0;
+ fake.pb_nb = 0;
+ fake.fl_av = 0;
+
+ for (i=0; i<PB_STATS_BITMAP_SIZE; i++)
+ fake.pb_bitmap[i] = 0;
+
+ return &fake;
+}
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/src/misc.c b/cesar/cp/eoc/sta/action/test/utest_eoc/src/misc.c
new file mode 100644
index 0000000000..9f752f4db5
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/src/misc.c
@@ -0,0 +1,2074 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/misc.c
+ * \brief Test sta/action/misc.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "lib/scenario/scenario.h"
+
+#include "inc/test_sta_action.h"
+
+#include "mac/common/ntb.h" /* for mac_ntb_init */
+
+#include "common/defs/spidcom.h"
+#include "mac/common/timings.h"
+#include "cp/sta/action/action.h"
+
+#include "build_info.h"
+
+void
+misc_whoru_test_case (test_t t)
+{
+ test_sta_action_t ctx;
+ test_sta_action_init (&ctx);
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+ cp_t *cp = &ctx.cp;
+ cp_mme_peer_t peer = CP_MME_PEER (0x112233445566ull, 2);
+ const cp_nid_t nid = 0x111111111111ull;
+ const mac_t mac = 0x111111111111ull;
+ cp_sta_own_data_set_mac_address (cp, mac);
+ char *avln_hfid = "AVLN";
+ cp_sta_own_data_set_hfid_avln (cp, avln_hfid);
+ cp_sta_own_data_set_tei (cp, 1);
+ test_sta_action_create_our_net (&ctx, nid, 12);
+ test_case_begin (t, "whoru");
+ test_begin (t, "ok cco")
+ {
+ cp_sta_own_data_set_cco_status (cp, true);
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cc_who_ru_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cc_who_ru_req_receive, .ok = true,
+ .nid = nid),
+ SCENARIO_EVENT (cp_msg_cc_who_ru_cnf_send, .peer = peer,
+ .nid = nid, .cco_mac = mac,
+ .avln_hfid = avln_hfid),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_begin (t, "nok mme")
+ {
+ cp_sta_own_data_set_cco_status (cp, true);
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cc_who_ru_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cc_who_ru_req_receive, .ok = false,
+ .nid = nid + 1),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_begin (t, "nok nid")
+ {
+ cp_sta_own_data_set_cco_status (cp, true);
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cc_who_ru_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cc_who_ru_req_receive, .ok = true,
+ .nid = nid + 1),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ /* Cleanup. */
+ test_sta_action_uninit (&ctx);
+}
+
+void
+misc_cc_discover_list_test_case (test_t t)
+{
+ test_sta_action_t ctx;
+ test_sta_action_init (&ctx);
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+ cp_t *cp = &ctx.cp;
+ const cp_nid_t nid = 0x111111111111ull;
+ const mac_t mac = 0x111111111111ull;
+ const cp_snid_t snid = 1;
+ const cp_tei_t tei = 1;
+
+ cp_mme_peer_t peer = CP_MME_PEER (0x112233445577ull, 5);
+ cp_mme_tx_t mme_to_send;
+ globals.mme = &mme_to_send;
+
+ test_case_begin (t, "cc_discover_list");
+
+ test_begin (t, "receive ko")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cc_discover_list_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_req_receive, .ok = false),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+
+ cp_msg_cc_discover_list_ctx_t disc_ctx;
+
+ test_begin (t, "no station and no network")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cc_discover_list_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_req_receive, .ok = true),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_begin,
+ .nb_sta = 0, .nb_net = 0, .disc_ctx = &disc_ctx),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_stations_begin,
+ .disc_ctxc = &disc_ctx),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_net_begin,
+ .disc_ctxc = &disc_ctx),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+
+ /* no own network yet but one network and station discovered. */
+ cp_net_t *other_net = cp_sta_mgr_add_avln (cp, snid, nid);
+ cp_sta_t *sta_1 = cp_sta_mgr_sta_add (cp, other_net, tei, mac);
+
+ test_begin (t, "one station and one network")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cc_discover_list_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_req_receive, .ok = true),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_begin,
+ .nb_sta = 1, .nb_net = 1, .disc_ctx = &disc_ctx),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_stations_begin,
+ .disc_ctxc = &disc_ctx),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_station,
+ .mac_addr = mac,
+ .tei = tei,
+ .same_network =
+ CC_DISCOVER_LIST_NET_DIFFERENT_NETWORK,
+ .snid = snid,
+ .access = 0,
+ .cco_cap = 0,
+ .proxy_cap = 0,
+ .backup_cco_cap = 0,
+ .cco_status = 0,
+ .pco_status = 0,
+ .backup_cco_status = 0,
+ .signal_level = 0,
+ .average_ble = 0),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_net_begin,
+ .disc_ctxc = &disc_ctx),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_net,
+ .nid = nid,
+ .snid = snid,
+ .access = 0,
+ .hm = other_net->hm,
+ .numslots = other_net->avln_num_slots,
+ .coordinated_status =
+ CC_DISCOVER_LIST_COORD_NON_COORDINATED,
+ .offset = 0),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+
+ /* Our network is created. */
+ test_sta_action_create_our_net (&ctx, nid + 1, snid + 1);
+ cp_net_t *my_net = cp_sta_mgr_get_our_avln (cp);
+ cp_sta_own_data_set_mac_address (cp, mac + 1);
+ cp_sta_own_data_set_tei (cp, tei);
+
+ test_begin (t, "one station and one network")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cc_discover_list_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_req_receive, .ok = true),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_begin,
+ .nb_sta = 1, .nb_net = 1, .disc_ctx = &disc_ctx),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_stations_begin,
+ .disc_ctxc = &disc_ctx),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_station,
+ .mac_addr = mac,
+ .tei = tei,
+ .same_network =
+ CC_DISCOVER_LIST_NET_DIFFERENT_NETWORK,
+ .snid = snid,
+ .access = 0,
+ .cco_cap = 0,
+ .proxy_cap = 0,
+ .backup_cco_cap = 0,
+ .cco_status = 0,
+ .pco_status = 0,
+ .backup_cco_status = 0,
+ .signal_level = 0,
+ .average_ble = 0),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_net_begin,
+ .disc_ctxc = &disc_ctx),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_net,
+ .nid = nid,
+ .snid = snid,
+ .access = 0,
+ .hm = other_net->hm,
+ .numslots = other_net->avln_num_slots,
+ .coordinated_status =
+ CC_DISCOVER_LIST_COORD_NON_COORDINATED,
+ .offset = 0),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ /** One station is created in our network with no interval and
+ * default tmi = 0. */
+ cp_sta_t *sta_2 = cp_sta_mgr_sta_add (cp, my_net, tei + 2, mac + 2);
+ other_net->network_mode = MAC_NM_COORDINATED;
+ other_net->avln_slot_id = 2;
+ my_net->avln_slot_id = 1;
+ sta_t *sta2 = mac_store_sta_get (cp->mac_store, tei+2);
+ sta2->tx_tonemaps->intervals->intervals_nb = 0;
+ sta2->tx_tonemaps->default_tmi = PHY_MOD_ROBO;
+ cp->mac_config->tonemask_info.tonemap_robo[PHY_MOD_ROBO].ble = 0x12;
+
+ /** One station is created in our network with tei = 0. */
+ cp_sta_t *sta_5 = cp_sta_mgr_sta_add (cp, my_net, 0, mac + 5);
+
+ test_begin (t, "3 stations and one network")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cc_discover_list_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_req_receive, .ok = true),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_begin,
+ .nb_sta = 3, .nb_net = 1, .disc_ctx = &disc_ctx),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_stations_begin,
+ .disc_ctxc = &disc_ctx),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_station,
+ .mac_addr = mac,
+ .tei = tei,
+ .same_network =
+ CC_DISCOVER_LIST_NET_DIFFERENT_NETWORK,
+ .snid = snid,
+ .access = 0,
+ .cco_cap = 0,
+ .proxy_cap = 0,
+ .backup_cco_cap = 0,
+ .cco_status = 0,
+ .pco_status = 0,
+ .backup_cco_status = 0,
+ .signal_level = 0,
+ .average_ble = 0),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_station,
+ .mac_addr = mac+5,
+ .tei = 0,
+ .same_network =
+ CC_DISCOVER_LIST_NET_DIFFERENT_NETWORK,
+ .snid = snid+1,
+ .access = 0,
+ .cco_cap = 0,
+ .proxy_cap = 0,
+ .backup_cco_cap = 0,
+ .cco_status = 0,
+ .pco_status = 0,
+ .backup_cco_status = 0,
+ .signal_level = 0,
+ .average_ble = 0),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_station,
+ .mac_addr = mac+2,
+ .tei = tei + 2,
+ .same_network = CC_DISCOVER_LIST_NET_SAME_NETWORK,
+ .snid = snid+1,
+ .access = 0,
+ .cco_cap = 0,
+ .proxy_cap = 0,
+ .backup_cco_cap = 0,
+ .cco_status = 0,
+ .pco_status = 0,
+ .backup_cco_status = 0,
+ .signal_level = 0,
+ .average_ble = 0x12),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_net_begin,
+ .disc_ctxc = &disc_ctx),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_net,
+ .nid = nid,
+ .snid = snid,
+ .access = 0,
+ .hm = other_net->hm,
+ .numslots = other_net->avln_num_slots,
+ .coordinated_status =
+ CC_DISCOVER_LIST_COORD_COORDINATED_GROUP_UNKNOWN,
+ .offset = 0),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+
+ /** A new station is created in our network with no interval and
+ * negociated default tmi. */
+ cp_sta_t *sta_3 = cp_sta_mgr_sta_add (cp, my_net, tei + 3, mac + 3);
+
+ sta_t *sta3 = mac_store_sta_get (cp->mac_store, tei+3);
+ sta3->tx_tonemaps->intervals->intervals_nb = 0;
+ sta3->tx_tonemaps->default_tmi = TONEMAP_INDEX_NEGOTIATED_FIRST;
+ sta3->tx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST] = tonemap_alloc ();
+ sta3->tx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST]->ble = 0x23;
+
+ /** A new station is created in our network with 6 intervals . */
+ cp_sta_t *sta_4 = cp_sta_mgr_sta_add (cp, my_net, tei + 4, mac + 4);
+
+ sta_t *sta4 = mac_store_sta_get (cp->mac_store, tei+4);
+ sta4->tx_tonemaps->intervals->intervals_nb = 6;
+ sta4->tx_tonemaps->default_tmi = TONEMAP_INDEX_NEGOTIATED_FIRST;
+ sta4->tx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST] = tonemap_alloc ();
+ sta4->tx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST]->ble = 0xFF;
+ sta4->tx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST + 1] = tonemap_alloc ();
+ sta4->tx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST + 1]->ble = 0x00;
+ sta4->tx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST + 2] = tonemap_alloc ();
+ sta4->tx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST + 2]->ble = 0x08;
+ sta4->tx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST + 3] = tonemap_alloc ();
+ sta4->tx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST + 3]->ble = 0x0F;
+ /* The 3rd and 6th intervals have no tonemap. */
+
+ sta4->tx_tonemaps->intervals->interval[0].tmi =
+ TONEMAP_INDEX_NEGOTIATED_FIRST;
+ sta4->tx_tonemaps->intervals->interval[0].end_offset_atu = 10;
+ sta4->tx_tonemaps->intervals->interval[1].tmi =
+ TONEMAP_INDEX_NEGOTIATED_FIRST + 1;
+ sta4->tx_tonemaps->intervals->interval[1].end_offset_atu = 100;
+ sta4->tx_tonemaps->intervals->interval[2].tmi = 0xFF;
+ sta4->tx_tonemaps->intervals->interval[2].end_offset_atu = 500;
+ sta4->tx_tonemaps->intervals->interval[3].tmi =
+ TONEMAP_INDEX_NEGOTIATED_FIRST + 2;
+ sta4->tx_tonemaps->intervals->interval[3].end_offset_atu = 800;
+ sta4->tx_tonemaps->intervals->interval[4].tmi =
+ TONEMAP_INDEX_NEGOTIATED_FIRST + 3;
+ sta4->tx_tonemaps->intervals->interval[4].end_offset_atu = 900;
+ sta4->tx_tonemaps->intervals->interval[5].tmi =
+ TONEMAP_INDEX_NEGOTIATED_FIRST + 4;
+ sta4->tx_tonemaps->intervals->interval[5].end_offset_atu = 950;
+
+ test_begin (t, "5 stations and one network")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cc_discover_list_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_req_receive, .ok = true),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_begin,
+ .nb_sta = 5, .nb_net = 1, .disc_ctx = &disc_ctx),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_stations_begin,
+ .disc_ctxc = &disc_ctx),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_station,
+ .mac_addr = mac,
+ .tei = tei,
+ .same_network =
+ CC_DISCOVER_LIST_NET_DIFFERENT_NETWORK,
+ .snid = snid,
+ .access = 0,
+ .cco_cap = 0,
+ .proxy_cap = 0,
+ .backup_cco_cap = 0,
+ .cco_status = 0,
+ .pco_status = 0,
+ .backup_cco_status = 0,
+ .signal_level = 0,
+ .average_ble = 0),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_station,
+ .mac_addr = mac+5,
+ .tei = 0,
+ .same_network =
+ CC_DISCOVER_LIST_NET_DIFFERENT_NETWORK,
+ .snid = snid+1,
+ .access = 0,
+ .cco_cap = 0,
+ .proxy_cap = 0,
+ .backup_cco_cap = 0,
+ .cco_status = 0,
+ .pco_status = 0,
+ .backup_cco_status = 0,
+ .signal_level = 0,
+ .average_ble = 0),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_station,
+ .mac_addr = mac+2,
+ .tei = tei+2,
+ .same_network = CC_DISCOVER_LIST_NET_SAME_NETWORK,
+ .snid = snid+1,
+ .access = 0,
+ .cco_cap = 0,
+ .proxy_cap = 0,
+ .backup_cco_cap = 0,
+ .cco_status = 0,
+ .pco_status = 0,
+ .backup_cco_status = 0,
+ .signal_level = 0,
+ .average_ble = 0x12),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_station,
+ .mac_addr = mac+3,
+ .tei = tei+3,
+ .same_network = CC_DISCOVER_LIST_NET_SAME_NETWORK,
+ .snid = snid+1,
+ .access = 0,
+ .cco_cap = 0,
+ .proxy_cap = 0,
+ .backup_cco_cap = 0,
+ .cco_status = 0,
+ .pco_status = 0,
+ .backup_cco_status = 0,
+ .signal_level = 0,
+ .average_ble = 0x23),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_station,
+ .mac_addr = mac+4,
+ .tei = tei+4,
+ .same_network = CC_DISCOVER_LIST_NET_SAME_NETWORK,
+ .snid = snid+1,
+ .access = 0,
+ .cco_cap = 0,
+ .proxy_cap = 0,
+ .backup_cco_cap = 0,
+ .cco_status = 0,
+ .pco_status = 0,
+ .backup_cco_status = 0,
+ .signal_level = 0,
+ .average_ble = 0x05),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_net_begin,
+ .disc_ctxc = &disc_ctx),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_net,
+ .nid = nid,
+ .snid = snid,
+ .access = 0,
+ .hm = other_net->hm,
+ .numslots = other_net->avln_num_slots,
+ .coordinated_status =
+ CC_DISCOVER_LIST_COORD_COORDINATED_GROUP_UNKNOWN,
+ .offset = 0),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+
+ /* Remove the tonemaps. */
+ tonemap_release_list_t tm_release_list;
+ tonemap_release_list_init (&tm_release_list);
+ tonemap_release (sta3->tx_tonemaps, TONEMAP_INDEX_NEGOTIATED_FIRST, &tm_release_list);
+ tonemap_release (sta4->tx_tonemaps, TONEMAP_INDEX_NEGOTIATED_FIRST, &tm_release_list);
+ tonemap_release (sta4->tx_tonemaps, TONEMAP_INDEX_NEGOTIATED_FIRST+1, &tm_release_list);
+ tonemap_release (sta4->tx_tonemaps, TONEMAP_INDEX_NEGOTIATED_FIRST+2, &tm_release_list);
+ tonemap_release (sta4->tx_tonemaps, TONEMAP_INDEX_NEGOTIATED_FIRST+3, &tm_release_list);
+ while (!tonemap_release_list_clean (&tm_release_list))
+ ;
+
+ test_begin (t, "Invalid tonemaps")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cc_discover_list_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_req_receive, .ok = true),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_begin,
+ .nb_sta = 5, .nb_net = 1, .disc_ctx = &disc_ctx),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_stations_begin,
+ .disc_ctxc = &disc_ctx),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_station,
+ .mac_addr = mac,
+ .tei = tei,
+ .same_network =
+ CC_DISCOVER_LIST_NET_DIFFERENT_NETWORK,
+ .snid = snid,
+ .access = 0,
+ .cco_cap = 0,
+ .proxy_cap = 0,
+ .backup_cco_cap = 0,
+ .cco_status = 0,
+ .pco_status = 0,
+ .backup_cco_status = 0,
+ .signal_level = 0,
+ .average_ble = 0),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_station,
+ .mac_addr = mac+5,
+ .tei = 0,
+ .same_network =
+ CC_DISCOVER_LIST_NET_DIFFERENT_NETWORK,
+ .snid = snid+1,
+ .access = 0,
+ .cco_cap = 0,
+ .proxy_cap = 0,
+ .backup_cco_cap = 0,
+ .cco_status = 0,
+ .pco_status = 0,
+ .backup_cco_status = 0,
+ .signal_level = 0,
+ .average_ble = 0),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_station,
+ .mac_addr = mac+2,
+ .tei = tei+2,
+ .same_network = CC_DISCOVER_LIST_NET_SAME_NETWORK,
+ .snid = snid+1,
+ .access = 0,
+ .cco_cap = 0,
+ .proxy_cap = 0,
+ .backup_cco_cap = 0,
+ .cco_status = 0,
+ .pco_status = 0,
+ .backup_cco_status = 0,
+ .signal_level = 0,
+ .average_ble = 0x12),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_station,
+ .mac_addr = mac+3,
+ .tei = tei+3,
+ .same_network = CC_DISCOVER_LIST_NET_SAME_NETWORK,
+ .snid = snid+1,
+ .access = 0,
+ .cco_cap = 0,
+ .proxy_cap = 0,
+ .backup_cco_cap = 0,
+ .cco_status = 0,
+ .pco_status = 0,
+ .backup_cco_status = 0,
+ .signal_level = 0,
+ .average_ble = 0),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_station,
+ .mac_addr = mac+4,
+ .tei = tei+4,
+ .same_network = CC_DISCOVER_LIST_NET_SAME_NETWORK,
+ .snid = snid+1,
+ .access = 0,
+ .cco_cap = 0,
+ .proxy_cap = 0,
+ .backup_cco_cap = 0,
+ .cco_status = 0,
+ .pco_status = 0,
+ .backup_cco_status = 0,
+ .signal_level = 0,
+ .average_ble = 0),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_net_begin,
+ .disc_ctxc = &disc_ctx),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_net,
+ .nid = nid,
+ .snid = snid,
+ .access = 0,
+ .hm = other_net->hm,
+ .numslots = other_net->avln_num_slots,
+ .coordinated_status =
+ CC_DISCOVER_LIST_COORD_COORDINATED_GROUP_UNKNOWN,
+ .offset = 0),
+ SCENARIO_EVENT (cp_msg_cc_discover_list_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+
+ /* Cleanup. */
+ blk_release (sta4);
+ blk_release (sta3);
+ blk_release (sta2);
+ slab_release (sta_1);
+ cp_sta_mgr_sta_remove_from_mac (cp, mac);
+ slab_release (sta_2);
+ cp_sta_mgr_sta_remove_from_mac (cp, mac + 2);
+ slab_release (sta_3);
+ cp_sta_mgr_sta_remove_from_mac (cp, mac + 3);
+ slab_release (sta_4);
+ cp_sta_mgr_sta_remove_from_mac (cp, mac + 4);
+ slab_release (sta_5);
+ cp_sta_mgr_sta_remove_from_mac (cp, mac + 5);
+
+ test_sta_action_uninit (&ctx);
+}
+
+void
+misc_relay_test_case (test_t t)
+{
+ test_sta_action_t ctx;
+ test_sta_action_init (&ctx);
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+ cp_t *cp = &ctx.cp;
+ const cp_nid_t nid = 0x111111111111ull;
+ cp_sta_own_data_set_tei (cp, 2);
+ test_sta_action_create_our_net (&ctx, nid, 1);
+ cp_net_t *our_net = cp_sta_mgr_get_our_avln (cp);
+ mac_t cco_mac = 0x111111111111ull;
+ cp_tei_t cco_tei = 1;
+ cp_sta_t *cco = cp_sta_mgr_sta_add (cp, our_net, cco_tei, cco_mac);
+ cp_net_set_cco (cp, our_net, cco_tei);
+ slab_release (cco);
+ cp_mme_peer_t unapeer = CP_MME_PEER (0x000000000001ull, 0);
+ cp_mme_peer_t apeer = CP_MME_PEER (0x333333333333ull, 3);
+ test_case_begin (t, "relay");
+ test_begin (t, "error")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cc_relay_req, .peer = unapeer),
+ SCENARIO_EVENT (cp_msg_cc_relay_req_receive, .ok = false),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_begin (t, "encrypted payload")
+ {
+ scenario_entry_t entries[] = {
+ /* Unassociated. */
+ SCENARIO_ACTION (process_cc_relay_req, .peer = unapeer),
+ SCENARIO_EVENT (cp_msg_cc_relay_req_receive, .ok = true,
+ .mac_fa = cco_mac, .ftei = cco_tei,
+ .length = 1234,
+ .mmtype = CM_ENCRYPTED_PAYLOAD_IND),
+ SCENARIO_EVENT (cp_msg_cc_relay_ind_send,
+ .mac_fa = cco_mac, .ftei = MAC_TEI_BCAST,
+ .osa = unapeer.mac, .stei = unapeer.tei,
+ .length = 1234),
+ /* Associated. */
+ SCENARIO_ACTION (process_cc_relay_req, .peer = apeer),
+ SCENARIO_EVENT (cp_msg_cc_relay_req_receive, .ok = true,
+ .mac_fa = cco_mac, .ftei = cco_tei,
+ .length = 1234,
+ .mmtype = CM_ENCRYPTED_PAYLOAD_IND),
+ SCENARIO_EVENT (cp_msg_cc_relay_ind_send,
+ .mac_fa = cco_mac, .ftei = MAC_TEI_BCAST,
+ .osa = apeer.mac, .stei = apeer.tei,
+ .length = 1234),
+ /* Authenticated. */
+ SCENARIO_ACTION (process_cc_relay_req, .peer = apeer,
+ .encrypt = true),
+ SCENARIO_EVENT (cp_msg_cc_relay_req_receive, .ok = true,
+ .mac_fa = cco_mac, .ftei = cco_tei,
+ .length = 1234,
+ .mmtype = CM_ENCRYPTED_PAYLOAD_IND),
+ SCENARIO_EVENT (cp_msg_cc_relay_ind_send,
+ .mac_fa = cco_mac, .ftei = MAC_TEI_BCAST,
+ .osa = apeer.mac, .stei = apeer.tei,
+ .length = 1234),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_begin (t, "assoc.req")
+ {
+ scenario_entry_t entries[] = {
+ /* Unassociated. */
+ SCENARIO_ACTION (process_cc_relay_req, .peer = unapeer),
+ SCENARIO_EVENT (cp_msg_cc_relay_req_receive, .ok = true,
+ .mac_fa = cco_mac, .ftei = cco_tei,
+ .length = 1234,
+ .mmtype = CC_ASSOC_REQ),
+ SCENARIO_EVENT (cp_msg_cc_relay_ind_send,
+ .mac_fa = cco_mac, .ftei = cco_tei,
+ .osa = unapeer.mac, .stei = unapeer.tei,
+ .length = 1234),
+ SCENARIO_ACTION (process_cc_relay_req, .peer = unapeer),
+ SCENARIO_EVENT (cp_msg_cc_relay_req_receive, .ok = true,
+ .mac_fa = MAC_BROADCAST, .ftei = MAC_TEI_BCAST,
+ .length = 1234,
+ .mmtype = CC_ASSOC_REQ),
+ SCENARIO_EVENT (cp_msg_cc_relay_ind_send,
+ .mac_fa = cco_mac, .ftei = cco_tei,
+ .osa = unapeer.mac, .stei = unapeer.tei,
+ .length = 1234),
+ SCENARIO_ACTION (process_cc_relay_req, .peer = unapeer),
+ SCENARIO_EVENT (cp_msg_cc_relay_req_receive, .ok = true,
+ .mac_fa = MAC_BROADCAST, .ftei = 1,
+ .length = 1234,
+ .mmtype = CC_ASSOC_REQ),
+ SCENARIO_EVENT (cp_msg_cc_relay_ind_send,
+ .mac_fa = MAC_BROADCAST, .ftei = 1,
+ .osa = unapeer.mac, .stei = unapeer.tei,
+ .length = 1234),
+ /* Associated. */
+ SCENARIO_ACTION (process_cc_relay_req, .peer = apeer),
+ SCENARIO_EVENT (cp_msg_cc_relay_req_receive, .ok = true,
+ .mac_fa = cco_mac, .ftei = cco_tei,
+ .length = 1234,
+ .mmtype = CC_ASSOC_REQ),
+ SCENARIO_EVENT (cp_msg_cc_relay_ind_send,
+ .mac_fa = cco_mac, .ftei = cco_tei,
+ .osa = apeer.mac, .stei = apeer.tei,
+ .length = 1234),
+ SCENARIO_ACTION (process_cc_relay_req, .peer = apeer),
+ SCENARIO_EVENT (cp_msg_cc_relay_req_receive, .ok = true,
+ .mac_fa = MAC_BROADCAST, .ftei = MAC_TEI_BCAST,
+ .length = 1234,
+ .mmtype = CC_ASSOC_REQ),
+ SCENARIO_EVENT (cp_msg_cc_relay_ind_send,
+ .mac_fa = MAC_BROADCAST, .ftei = MAC_TEI_BCAST,
+ .osa = apeer.mac, .stei = apeer.tei,
+ .length = 1234),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_begin (t, "unassociated ok")
+ {
+ scenario_entry_t entries[] = {
+ /* Unassociated. */
+ SCENARIO_ACTION (process_cc_relay_req, .peer = unapeer),
+ SCENARIO_EVENT (cp_msg_cc_relay_req_receive, .ok = true,
+ .mac_fa = cco_mac, .ftei = cco_tei,
+ .length = 1234,
+ .mmtype = CC_WHO_RU_REQ),
+ SCENARIO_EVENT (cp_msg_cc_relay_ind_send,
+ .mac_fa = cco_mac, .ftei = cco_tei,
+ .osa = unapeer.mac, .stei = unapeer.tei,
+ .length = 1234),
+ /* Associated. */
+ SCENARIO_ACTION (process_cc_relay_req, .peer = apeer),
+ SCENARIO_EVENT (cp_msg_cc_relay_req_receive, .ok = true,
+ .mac_fa = cco_mac, .ftei = cco_tei,
+ .length = 1234,
+ .mmtype = CC_WHO_RU_REQ),
+ SCENARIO_EVENT (cp_msg_cc_relay_ind_send,
+ .mac_fa = cco_mac, .ftei = cco_tei,
+ .osa = apeer.mac, .stei = apeer.tei,
+ .length = 1234),
+ /* Authenticated. */
+ SCENARIO_ACTION (process_cc_relay_req, .peer = apeer,
+ .encrypt = true),
+ SCENARIO_EVENT (cp_msg_cc_relay_req_receive, .ok = true,
+ .mac_fa = cco_mac, .ftei = cco_tei,
+ .length = 1234,
+ .mmtype = CC_WHO_RU_REQ),
+ SCENARIO_EVENT (cp_msg_cc_relay_ind_send,
+ .mac_fa = cco_mac, .ftei = cco_tei,
+ .osa = apeer.mac, .stei = apeer.tei,
+ .length = 1234),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_begin (t, "associated ok")
+ {
+ scenario_entry_t entries[] = {
+ /* Unassociated. */
+ SCENARIO_ACTION (process_cc_relay_req, .peer = unapeer),
+ SCENARIO_EVENT (cp_msg_cc_relay_req_receive, .ok = true,
+ .mac_fa = cco_mac, .ftei = cco_tei,
+ .length = 1234,
+ .mmtype = CM_SET_KEY_REQ),
+ /* Associated. */
+ SCENARIO_ACTION (process_cc_relay_req, .peer = apeer),
+ SCENARIO_EVENT (cp_msg_cc_relay_req_receive, .ok = true,
+ .mac_fa = cco_mac, .ftei = cco_tei,
+ .length = 1234,
+ .mmtype = CM_SET_KEY_REQ),
+ SCENARIO_EVENT (cp_msg_cc_relay_ind_send,
+ .mac_fa = cco_mac, .ftei = cco_tei,
+ .osa = apeer.mac, .stei = apeer.tei,
+ .length = 1234),
+ /* Authenticated. */
+ SCENARIO_ACTION (process_cc_relay_req, .peer = apeer,
+ .encrypt = true),
+ SCENARIO_EVENT (cp_msg_cc_relay_req_receive, .ok = true,
+ .mac_fa = cco_mac, .ftei = cco_tei,
+ .length = 1234,
+ .mmtype = CM_SET_KEY_REQ),
+ SCENARIO_EVENT (cp_msg_cc_relay_ind_send,
+ .mac_fa = cco_mac, .ftei = cco_tei,
+ .osa = apeer.mac, .stei = apeer.tei,
+ .length = 1234),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_begin (t, "authenticated ok")
+ {
+ scenario_entry_t entries[] = {
+ /* Unassociated. */
+ SCENARIO_ACTION (process_cc_relay_req, .peer = unapeer),
+ SCENARIO_EVENT (cp_msg_cc_relay_req_receive, .ok = true,
+ .mac_fa = cco_mac, .ftei = cco_tei,
+ .length = 1234,
+ .mmtype = CC_HANDOVER_REQ),
+ /* Associated. */
+ SCENARIO_ACTION (process_cc_relay_req, .peer = apeer),
+ SCENARIO_EVENT (cp_msg_cc_relay_req_receive, .ok = true,
+ .mac_fa = cco_mac, .ftei = cco_tei,
+ .length = 1234,
+ .mmtype = CC_HANDOVER_REQ),
+ /* Authenticated. */
+ SCENARIO_ACTION (process_cc_relay_req, .peer = apeer,
+ .encrypt = true),
+ SCENARIO_EVENT (cp_msg_cc_relay_req_receive, .ok = true,
+ .mac_fa = cco_mac, .ftei = cco_tei,
+ .length = 1234,
+ .mmtype = CC_HANDOVER_REQ),
+ SCENARIO_EVENT (cp_msg_cc_relay_ind_send,
+ .mac_fa = cco_mac, .ftei = cco_tei,
+ .osa = apeer.mac, .stei = apeer.tei,
+ .length = 1234),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ /* Cleanup. */
+ test_sta_action_uninit (&ctx);
+}
+
+void
+misc_hfid_test_case (test_t t)
+{
+ test_sta_action_t ctx;
+ test_sta_action_init (&ctx);
+ cp_av_sta_action_init (&ctx.cp);
+
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+ cp_t *cp = &ctx.cp;
+ cp_mme_peer_t peer = CP_MME_PEER (0x112233445566ull, 2);
+ cp_mme_peer_t drvpeer = CP_MME_PEER (0x112233445566ull, MAC_TEI_FOREIGN);
+ const cp_nid_t nid = 0x111111111111ull;
+ const mac_t mac = 0x111111111111ull;
+ cp_mme_peer_t hlepeer = CP_MME_PEER (mac, MAC_TEI_FOREIGN);
+ cp_sta_own_data_set_mac_address (cp, mac);
+ char *manufacturer_hfid = "MANUFACTURER";
+ cp_sta_own_data_set_hfid_manufacturer (cp, manufacturer_hfid);
+ char *user_hfid = "USER";
+ cp_sta_own_data_set_hfid_user (cp, user_hfid);
+ char *avln_hfid = "AVLN";
+ cp_sta_own_data_set_hfid_avln (cp, avln_hfid);
+ cp_sta_own_data_set_tei (cp, 1);
+ test_sta_action_create_our_net (&ctx, nid, 12);
+ cp_sta_own_data_t *own_data = cp_sta_mgr_get_sta_own_data (cp);
+
+ test_case_begin (t, "hfid");
+
+ /* Check reply parameters at init. */
+ test_begin (t, "avln hfid reply parameters init")
+ {
+ test_fail_unless (cp->sta_action.cm_hfid_reply_peer.mac == 0);
+ } test_end;
+
+ /* Check get avln hfid when we are cco. */
+ cp_sta_own_data_set_cco_status (cp, true);
+
+ test_begin (t, "get avln hfid ok when cco")
+ {
+ scenario_entry_t entries[] = {
+ /* User HFID. */
+ SCENARIO_ACTION (process_cm_hfid_req, .peer = peer),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_req_receive, .ok = true,
+ .req_type = CM_HFID_REQ_REQTYPE_PROVIDE_NETWORK_HFID,
+ .nid = nid,
+ ),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_cnf_send, .peer = peer,
+ .restype = CM_HFID_CNF_RESTYPE_PROVIDE_NETWORK_HFID,
+ .hfid = avln_hfid,
+ ),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ /* Check HFID values. */
+ test_fail_unless (strcmp (own_data->hfid_avln, avln_hfid) == 0);
+ /* Check reply parameters in cp_sta_action context. */
+ test_fail_unless (cp->sta_action.cm_hfid_reply_peer.mac == 0);
+ } test_end;
+
+ cp_sta_own_data_set_cco_status (cp, false);
+
+ /** Configure the cco. */
+ cp_net_t *our_net = cp_sta_mgr_get_our_avln (cp);
+ mac_t cco_mac = 0x111111111112ull;
+ cp_tei_t cco_tei = 2;
+ cp_sta_t *cco = cp_sta_mgr_sta_add (cp, our_net, cco_tei, cco_mac);
+ cp_net_set_cco (cp, our_net, cco_tei);
+ cp_mme_peer_t cco_peer;
+ cp_mme_peer_t wrong_peer;
+
+ cco_peer.mac = cco_mac;
+ cco_peer.tei = cco_tei;
+ cco_peer.eth_type = HPAV_MTYPE_MME;
+ cco_peer.vlan_tci = 0;
+
+ wrong_peer.mac = cco_mac + 1;
+ wrong_peer.tei = cco_tei + 1;
+ wrong_peer.eth_type = HPAV_MTYPE_MME;
+ wrong_peer.vlan_tci = 0;
+
+ slab_release (cco);
+
+ test_begin (t, "get ok")
+ {
+ scenario_entry_t entries[] = {
+ /* Manufacturer HFID. */
+ SCENARIO_ACTION (process_cm_hfid_req, .peer = peer),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_req_receive, .ok = true,
+ .req_type = CM_HFID_REQ_REQTYPE_PROVIDE_MANUFACTURER_SET_HFID,
+ ),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_cnf_send, .peer = peer,
+ .restype = CM_HFID_CNF_RESTYPE_PROVIDE_MANUFACTURER_SET_HFID,
+ .hfid = manufacturer_hfid,
+ ),
+ /* User HFID. */
+ SCENARIO_ACTION (process_cm_hfid_req, .peer = peer),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_req_receive, .ok = true,
+ .req_type = CM_HFID_REQ_REQTYPE_PROVIDE_USER_SET_HFID,
+ ),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_cnf_send, .peer = peer,
+ .restype = CM_HFID_CNF_RESTYPE_PROVIDE_USER_SET_HFID,
+ .hfid = user_hfid,
+ ),
+ /* AVLN HFID. */
+ SCENARIO_ACTION (process_cm_hfid_req, .peer = peer),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_req_receive, .ok = true,
+ .req_type = CM_HFID_REQ_REQTYPE_PROVIDE_NETWORK_HFID,
+ .nid = nid,
+ ),
+ SCENARIO_EVENT (cp_msg_cc_who_ru_req_send, .peer = cco_peer,
+ .nid = nid,),
+ SCENARIO_EVENT (cp_fsm_event_bare_new,
+ .type = CP_FSM_EVENT_TYPE_whoru_timeout),
+ SCENARIO_EVENT (cp_sta_core_gen_timed_event,
+ .delay_min_ms = CP_TIMEOUT_MS,
+ .delay_max_ms = CP_TIMEOUT_MS),
+ SCENARIO_ACTION (process_cc_who_ru_cnf, .peer = cco_peer),
+ SCENARIO_EVENT (cp_sta_core_stop_timed_or_cyclic_event),
+ SCENARIO_EVENT (
+ cp_msg_cc_who_ru_cnf_receive, .ok = true,
+ .nid = nid,
+ .cco_mac = cco_mac,
+ .avln_hfid = avln_hfid,
+ ),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_cnf_send, .peer = peer,
+ .restype = CM_HFID_CNF_RESTYPE_PROVIDE_NETWORK_HFID,
+ .hfid = avln_hfid,
+ ),
+ /* Get Who_ru.cnf from the wrong peer. */
+ SCENARIO_ACTION (process_cm_hfid_req, .peer = peer),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_req_receive, .ok = true,
+ .req_type = CM_HFID_REQ_REQTYPE_PROVIDE_NETWORK_HFID,
+ .nid = nid,
+ ),
+ SCENARIO_EVENT (cp_msg_cc_who_ru_req_send, .peer = cco_peer,
+ .nid = nid,),
+ SCENARIO_EVENT (cp_fsm_event_bare_new,
+ .type = CP_FSM_EVENT_TYPE_whoru_timeout),
+ SCENARIO_EVENT (cp_sta_core_gen_timed_event,
+ .delay_min_ms = CP_TIMEOUT_MS,
+ .delay_max_ms = CP_TIMEOUT_MS),
+ SCENARIO_ACTION (process_cc_who_ru_cnf, .peer = wrong_peer),
+ SCENARIO_ACTION (process_cc_who_ru_cnf, .peer = cco_peer),
+ SCENARIO_EVENT (cp_sta_core_stop_timed_or_cyclic_event),
+ SCENARIO_EVENT (
+ cp_msg_cc_who_ru_cnf_receive, .ok = true,
+ .nid = nid,
+ .cco_mac = cco_mac,
+ .avln_hfid = avln_hfid,
+ ),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_cnf_send, .peer = peer,
+ .restype = CM_HFID_CNF_RESTYPE_PROVIDE_NETWORK_HFID,
+ .hfid = avln_hfid,
+ ),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ /* Check HFID values. */
+ test_fail_unless (strcmp (own_data->hfid_avln, avln_hfid) == 0);
+ test_fail_unless (strcmp (own_data->hfid_user, user_hfid) == 0);
+ test_fail_unless (strcmp (own_data->hfid_manufacturer,
+ manufacturer_hfid) == 0);
+ /* Check reply parameters in cp_sta_action context. */
+ test_fail_unless (cp->sta_action.cm_hfid_reply_peer.mac == 0);
+ } test_end;
+ test_begin (t, "get error")
+ {
+ scenario_entry_t entries[] = {
+ /* Bad MME. */
+ SCENARIO_ACTION (process_cm_hfid_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_hfid_req_receive, .ok = false),
+ /* Bad NID. */
+ SCENARIO_ACTION (process_cm_hfid_req, .peer = peer),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_req_receive, .ok = true,
+ .req_type = CM_HFID_REQ_REQTYPE_PROVIDE_NETWORK_HFID,
+ .nid = nid + 1,
+ ),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_cnf_send, .peer = peer,
+ .restype = CM_HFID_CNF_RESTYPE_FAILURE,
+ .hfid = "",
+ ),
+ /* WHO_RU timeout */
+ SCENARIO_ACTION (process_cm_hfid_req, .peer = peer),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_req_receive, .ok = true,
+ .req_type = CM_HFID_REQ_REQTYPE_PROVIDE_NETWORK_HFID,
+ .nid = nid,),
+ SCENARIO_EVENT (cp_msg_cc_who_ru_req_send, .peer = cco_peer,
+ .nid = nid,),
+ SCENARIO_EVENT (cp_fsm_event_bare_new,
+ .type = CP_FSM_EVENT_TYPE_whoru_timeout),
+ SCENARIO_EVENT (cp_sta_core_gen_timed_event,
+ .delay_min_ms = CP_TIMEOUT_MS,
+ .delay_max_ms = CP_TIMEOUT_MS),
+ SCENARIO_ACTION (whoru_timeout_process),
+ SCENARIO_EVENT (cp_sta_core_stop_timed_or_cyclic_event),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_cnf_send, .peer = peer,
+ .restype = CM_HFID_CNF_RESTYPE_FAILURE,
+ .hfid = "",),
+ /* Avln request while previous one is still in progress. */
+ SCENARIO_ACTION (process_cm_hfid_req, .peer = peer),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_req_receive, .ok = true,
+ .req_type = CM_HFID_REQ_REQTYPE_PROVIDE_NETWORK_HFID,
+ .nid = nid,),
+ SCENARIO_EVENT (cp_msg_cc_who_ru_req_send, .peer = cco_peer,
+ .nid = nid,),
+ SCENARIO_EVENT (cp_fsm_event_bare_new,
+ .type = CP_FSM_EVENT_TYPE_whoru_timeout),
+ SCENARIO_EVENT (cp_sta_core_gen_timed_event,
+ .delay_min_ms = CP_TIMEOUT_MS,
+ .delay_max_ms = CP_TIMEOUT_MS),
+ SCENARIO_ACTION (process_cm_hfid_req, .peer = peer),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_req_receive, .ok = true,
+ .req_type = CM_HFID_REQ_REQTYPE_PROVIDE_NETWORK_HFID,
+ .nid = nid + 1,),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_cnf_send, .peer = peer,
+ .restype = CM_HFID_CNF_RESTYPE_FAILURE,
+ .hfid = "",),
+ SCENARIO_ACTION (process_cc_who_ru_cnf, .peer = cco_peer),
+ SCENARIO_EVENT (cp_sta_core_stop_timed_or_cyclic_event),
+ SCENARIO_EVENT (cp_msg_cc_who_ru_cnf_receive, .ok = true,
+ .nid = nid, .cco_mac = cco_mac,
+ .avln_hfid = avln_hfid,),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_cnf_send, .peer = peer,
+ .restype = CM_HFID_CNF_RESTYPE_PROVIDE_NETWORK_HFID,
+ .hfid = avln_hfid,),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ /* Check HFID values. */
+ test_fail_unless (strcmp (own_data->hfid_avln, avln_hfid) == 0);
+ test_fail_unless (strcmp (own_data->hfid_user, user_hfid) == 0);
+ test_fail_unless (strcmp (own_data->hfid_manufacturer,
+ manufacturer_hfid) == 0);
+ /* Check reply parameters in cp_sta_action context. */
+ test_fail_unless (cp->sta_action.cm_hfid_reply_peer.mac == 0);
+ } test_end;
+ cp_sta_own_data_set_cco_status (cp, true);
+ test_begin (t, "set ok")
+ {
+ scenario_entry_t entries[] = {
+ /* User HFID. */
+ SCENARIO_ACTION (process_cm_hfid_req, .peer = drvpeer),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_req_receive, .ok = true,
+ .req_type = CM_HFID_REQ_REQTYPE_SET_USER_SET_HFID,
+ .hfid = "new user",
+ ),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_cnf_send, .peer = drvpeer,
+ .restype = CM_HFID_CNF_RESTYPE_SET_USER_SET_HFID,
+ .hfid = "new user",
+ ),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_u_sta_hfid_ind_send,
+ .peer = hlepeer, .u_sta_hfid = "new user",),
+ /* AVLN HFID. */
+ SCENARIO_ACTION (process_cm_hfid_req, .peer = drvpeer),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_req_receive, .ok = true,
+ .req_type = CM_HFID_REQ_REQTYPE_SET_NETWORK_HFID,
+ .nid = nid,
+ .hfid = "new avln",
+ ),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_cnf_send, .peer = drvpeer,
+ .restype = CM_HFID_CNF_RESTYPE_SET_NETWORK_HFID,
+ .hfid = "new avln",
+ ),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_avln_hfid_ind_send,
+ .peer = hlepeer, .avln_hfid = "new avln",),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ /* Check HFID values. */
+ test_fail_unless (strcmp (own_data->hfid_avln, "new avln") == 0);
+ test_fail_unless (strcmp (own_data->hfid_user, "new user") == 0);
+ test_fail_unless (strcmp (own_data->hfid_manufacturer,
+ manufacturer_hfid) == 0);
+ /* Restore HFID. */
+ cp_sta_own_data_set_hfid_user (cp, user_hfid);
+ cp_sta_own_data_set_hfid_avln (cp, avln_hfid);
+ } test_end;
+ test_begin (t, "set error")
+ {
+ scenario_entry_t entries[] = {
+ /* Forbidden for user HFID. */
+ SCENARIO_ACTION (process_cm_hfid_req, .peer = peer),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_req_receive, .ok = true,
+ .req_type = CM_HFID_REQ_REQTYPE_SET_USER_SET_HFID,
+ .hfid = "new user error",
+ ),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_cnf_send, .peer = peer,
+ .restype = CM_HFID_CNF_RESTYPE_FAILURE,
+ .hfid = user_hfid,
+ ),
+ /* Forbidden for AVLN HFID. */
+ SCENARIO_ACTION (process_cm_hfid_req, .peer = peer),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_req_receive, .ok = true,
+ .req_type = CM_HFID_REQ_REQTYPE_SET_NETWORK_HFID,
+ .nid = nid,
+ .hfid = "new avln error",
+ ),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_cnf_send, .peer = peer,
+ .restype = CM_HFID_CNF_RESTYPE_FAILURE,
+ .hfid = avln_hfid,
+ ),
+ /* Bad NID. */
+ SCENARIO_ACTION (process_cm_hfid_req, .peer = drvpeer),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_req_receive, .ok = true,
+ .req_type = CM_HFID_REQ_REQTYPE_SET_NETWORK_HFID,
+ .nid = nid + 1,
+ .hfid = "new avln error",
+ ),
+ SCENARIO_EVENT (
+ cp_msg_cm_hfid_cnf_send, .peer = drvpeer,
+ .restype = CM_HFID_CNF_RESTYPE_FAILURE,
+ .hfid = avln_hfid,
+ ),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ /* Check HFID values. */
+ test_fail_unless (strcmp (own_data->hfid_avln, avln_hfid) == 0);
+ test_fail_unless (strcmp (own_data->hfid_user, user_hfid) == 0);
+ test_fail_unless (strcmp (own_data->hfid_manufacturer,
+ manufacturer_hfid) == 0);
+ } test_end;
+ /* Cleanup. */
+ test_sta_action_uninit (&ctx);
+}
+
+void
+misc_mme_error_test_case (test_t t)
+{
+ test_sta_action_t ctx;
+ test_sta_action_init (&ctx);
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+ cp_mme_peer_t peer = CP_MME_PEER (0x112233445566ull, 2);
+ test_case_begin (t, "mme_error");
+ test_begin (t, "ok")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_mme_error_ind, .peer = peer),
+#if CONFIG_TRACE
+ SCENARIO_EVENT (cp_msg_cm_mme_error_ind_receive, .ok = true,
+ .reason =
+ CP_MSG_CM_MME_ERROR_IND_REASON_MME_NOT_SUPPORTED,
+ .rx_mmv = 42, .rx_mmtype = 4242, .offset = 424242),
+#endif
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_begin (t, "error")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_mme_error_ind, .peer = peer),
+#if CONFIG_TRACE
+ SCENARIO_EVENT (cp_msg_cm_mme_error_ind_receive, .ok = false,
+ .reason =
+ CP_MSG_CM_MME_ERROR_IND_REASON_MME_NOT_SUPPORTED,
+ .rx_mmv = 42, .rx_mmtype = 4242, .offset = 424242),
+#endif
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ /* Cleanup. */
+ test_sta_action_uninit (&ctx);
+}
+
+void
+misc_nw_stats_test_case (test_t t)
+{
+ /* init test context */
+ test_sta_action_t ctx;
+ cp_t *cp = &ctx.cp;
+
+ /* init globals */
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+ const cp_tei_t my_tei = 2;
+ cp_mme_peer_t peer = CP_MME_PEER (0x112233445577ull, 5);
+ cp_mme_tx_t mme_to_send;
+ globals.mme = &mme_to_send;
+
+ test_sta_action_init (&ctx);
+
+ /* Init mac ntb */
+ mac_config_t mac_config;
+ mac_ntb_init (&mac_config);
+
+ test_case_begin (t, "nw_stats_req when no avln");
+ test_begin (t, "ok")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_nw_stats_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_nw_stats_req_receive, .ok = true),
+ SCENARIO_EVENT (cp_msg_cm_nw_stats_cnf_send_begin, .peer = peer,
+ .num_stats = 0),
+ SCENARIO_EVENT (cp_msg_cm_nw_stats_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+
+ /* Create our net/AVLN. */
+ test_sta_action_create_our_net (&ctx, 0xAB, my_tei);
+ cp_sta_own_data_set_tei (cp, my_tei);
+ cp_net_t *my_net = cp_sta_mgr_get_our_avln (cp);
+ const cp_tei_t tei_1 = 10;
+ const cp_tei_t tei_2 = 11;
+ const mac_t mac_1 = 0x111111111111ull;
+ const mac_t mac_2 = 0x222222222222ull;
+ cp_sta_t *sta_1 = cp_sta_mgr_sta_add (cp, my_net, tei_1, mac_1);
+ cp_sta_t *sta_2 = cp_sta_mgr_sta_add (cp, my_net, tei_2, mac_2);
+
+ test_case_begin (t, "nw_stats_req with avln but no authentication");
+ test_begin (t, "ok")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_nw_stats_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_nw_stats_req_receive, .ok = true),
+ SCENARIO_EVENT (cp_msg_cm_nw_stats_cnf_send_begin, .peer = peer,
+ .num_stats = 0),
+ SCENARIO_EVENT (cp_msg_cm_nw_stats_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+
+ cp_sta_set_authenticated(cp, sta_1, true);
+ cp_sta_set_authenticated(cp, sta_2, true);
+
+ sta_t *sta1 = mac_store_sta_get (cp->mac_store, tei_1);
+ sta1->tx_tonemaps->intervals->intervals_nb = 0;
+ sta1->tx_tonemaps->default_tmi = PHY_MOD_ROBO;
+ sta1->rx_tonemaps->intervals->intervals_nb = 0;
+ sta1->rx_tonemaps->default_tmi = PHY_MOD_HS_ROBO;
+ cp->mac_config->tonemask_info.tonemap_robo[PHY_MOD_ROBO].ble = 0x15;
+ cp->mac_config->tonemask_info.tonemap_robo[PHY_MOD_HS_ROBO].ble = 0x16;
+
+ sta_t *sta2 = mac_store_sta_get (cp->mac_store, tei_2);
+ sta2->tx_tonemaps->intervals->intervals_nb = 0;
+ sta2->tx_tonemaps->default_tmi = TONEMAP_INDEX_NEGOTIATED_FIRST;
+
+ sta2->tx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST] = tonemap_alloc ();
+ sta2->tx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST]->ble = 0x23;
+
+ sta2->rx_tonemaps->intervals->intervals_nb = 4;
+ sta2->rx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST] = tonemap_alloc ();
+ sta2->rx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST]->ble = 0xFF;
+ sta2->rx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST + 1] = tonemap_alloc ();
+ sta2->rx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST + 1]->ble = 0x00;
+ sta2->rx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST + 2] = tonemap_alloc ();
+ sta2->rx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST + 2]->ble = 0x08;
+ sta2->rx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST + 3] = tonemap_alloc ();
+ sta2->rx_tonemaps->tm[TONEMAP_INDEX_NEGOTIATED_FIRST + 3]->ble = 0x0F;
+
+ sta2->rx_tonemaps->intervals->interval[0].tmi =
+ TONEMAP_INDEX_NEGOTIATED_FIRST;
+ sta2->rx_tonemaps->intervals->interval[0].end_offset_atu = 10;
+ sta2->rx_tonemaps->intervals->interval[1].tmi =
+ TONEMAP_INDEX_NEGOTIATED_FIRST + 1;
+ sta2->rx_tonemaps->intervals->interval[1].end_offset_atu = 100;
+ sta2->rx_tonemaps->intervals->interval[2].tmi =
+ TONEMAP_INDEX_NEGOTIATED_FIRST + 2;
+ sta2->rx_tonemaps->intervals->interval[2].end_offset_atu = 400;
+ sta2->rx_tonemaps->intervals->interval[3].tmi =
+ TONEMAP_INDEX_NEGOTIATED_FIRST + 3;
+ sta2->rx_tonemaps->intervals->interval[3].end_offset_atu = 500;
+
+ test_case_begin (t, "nw_stats_req with two stations authenticated");
+ test_begin (t, "ok")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_nw_stats_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_nw_stats_req_receive, .ok = true),
+ SCENARIO_EVENT (cp_msg_cm_nw_stats_cnf_send_begin, .peer = peer,
+ .num_stats = 2),
+ SCENARIO_EVENT (cp_msg_cm_nw_stats_cnf_send,
+ .mac = mac_1, .phy_dr_tx = 69, .phy_dr_rx = 138),
+ SCENARIO_EVENT (cp_msg_cm_nw_stats_cnf_send,
+ .mac = mac_2, .phy_dr_tx = 18, .phy_dr_rx = 65),
+ SCENARIO_EVENT (cp_msg_cm_nw_stats_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+
+ cp_sta_set_authenticated(cp, sta_1, false);
+
+ test_case_begin (t, "nw_stats_req with not all stations authenticated");
+ test_begin (t, "ok")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_nw_stats_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_nw_stats_req_receive, .ok = true),
+ SCENARIO_EVENT (cp_msg_cm_nw_stats_cnf_send_begin, .peer = peer,
+ .num_stats = 1),
+ SCENARIO_EVENT (cp_msg_cm_nw_stats_cnf_send,
+ .mac = mac_2, .phy_dr_tx = 18, .phy_dr_rx = 65),
+ SCENARIO_EVENT (cp_msg_cm_nw_stats_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+
+ /* Cleanup. */
+ mac_ntb_uninit ();
+ blk_release (sta1);
+ blk_release (sta2);
+ slab_release (sta_1);
+ slab_release (sta_2);
+ cp_sta_mgr_sta_remove_from_mac (cp, mac_1);
+ cp_sta_mgr_sta_remove_from_mac (cp, mac_2);
+ cp_sta_mgr_remove_avln (cp, 0xAB, my_tei);
+ test_sta_action_uninit (&ctx);
+}
+
+void
+misc_nw_info_test_case (test_t t)
+{
+ /* init test context */
+ test_sta_action_t ctx;
+ cp_t *cp = &ctx.cp;
+
+ /* init globals */
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+
+ test_sta_action_init (&ctx);
+
+ cp_mme_peer_t peer = CP_MME_PEER (0x112233445577ull, 5);
+ cp_mme_tx_t mme_to_send;
+ globals.mme = &mme_to_send;
+
+ test_sta_action_init (&ctx);
+
+ test_case_begin (t, "nw_info_req when no avln");
+ test_begin (t, "ok")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_nw_info_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_nw_info_req_receive, .ok = true),
+ SCENARIO_EVENT (cp_msg_cm_nw_info_cnf_send_begin, .peer = peer,
+ .num_nw = 0),
+ SCENARIO_EVENT (cp_msg_cm_nw_info_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+
+ /* Create our net/AVLN. */
+ cp_snid_t snid = 0x34;
+ cp_nid_t nid = 0x111111111111ull;
+
+ test_sta_action_create_our_net (&ctx, nid, snid);
+
+ mac_t mac = 0x111111111111ull;
+ mac_t cco_mac = 0x111111111110ull;
+ cp_tei_t tei = 2;
+ cp_tei_t cco_tei = 1;
+ cp_net_t *my_net = cp_sta_mgr_get_our_avln (cp);
+
+ /* Set cco */
+ cp_sta_t *cco = cp_sta_mgr_sta_add (cp, my_net, cco_tei, cco_mac);
+ cp_net_set_cco (cp, my_net, cco_tei);
+ slab_release (cco);
+ cp_net_set_access (cp, my_net, HPAV_ACCESS_IN_HOME);
+
+ cp_sta_own_data_set_mac_address (cp, mac);
+ cp_sta_own_data_set_tei (cp, tei);
+ cp_sta_own_data_set_authenticated_status (cp, true);
+
+ test_case_begin (t, "nw_info_req with avln");
+ test_begin (t, "ok")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_nw_info_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_nw_info_req_receive, .ok = true),
+ SCENARIO_EVENT (cp_msg_cm_nw_info_cnf_send_begin, .peer = peer,
+ .num_nw = 1),
+ SCENARIO_EVENT (cp_msg_cm_nw_info_cnf_send, .nid = nid,
+ .snid = snid, .tei = tei,
+ .sta_role = CM_NW_INFO_CNF_STA_ROLE_STA,
+ .cco_mac = cco_mac, .access = HPAV_ACCESS_IN_HOME,
+ .num_coord_nets = 0),
+ SCENARIO_EVENT (cp_msg_cm_nw_info_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+
+ /* change the role of the station : the station is the cco
+ * change the access mode */
+ cco = cp_sta_mgr_sta_add (cp, my_net, tei, mac);
+ cp_net_set_cco (cp, my_net, tei);
+ slab_release (cco);
+ cp_net_set_access (cp, my_net, HPAV_ACCESS_ACCESS);
+
+ cp_sta_own_data_set_authenticated_status (cp, true);
+
+ test_case_begin (t, "nw_info_req with avln");
+ test_begin (t, "ok")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_nw_info_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_nw_info_req_receive, .ok = true),
+ SCENARIO_EVENT (cp_msg_cm_nw_info_cnf_send_begin, .peer = peer,
+ .num_nw = 1),
+ SCENARIO_EVENT (cp_msg_cm_nw_info_cnf_send, .nid = nid,
+ .snid = snid, .tei = tei,
+ .sta_role = CM_NW_INFO_CNF_STA_ROLE_CCO,
+ .cco_mac = mac, .access = HPAV_ACCESS_ACCESS,
+ .num_coord_nets = 0),
+ SCENARIO_EVENT (cp_msg_cm_nw_info_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+
+ /* Cleanup. */
+ cp_sta_mgr_remove_avln (cp, snid, nid);
+ test_sta_action_uninit (&ctx);
+}
+
+void
+misc_link_stats_test_case_common (test_t t,
+ cp_msg_cm_link_stats_tlflag_t transmit)
+{
+ test_sta_action_t ctx;
+ cp_t *cp = &ctx.cp;
+ char msg [10];
+ /* init globals */
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+ cp_mme_peer_t peer = CP_MME_PEER (0x112233445577ull, 5);
+ cp_mme_tx_t mme_to_send;
+ globals.mme = &mme_to_send;
+ test_sta_action_init (&ctx);
+ cp_net_t *my_net = cp_sta_mgr_add_avln (cp, 1, 1);
+ cp_sta_mgr_set_our_avln (cp, my_net);
+ if (transmit == CM_LINK_STATS_TLFLAG_TRANSMIT)
+ strcpy (msg, "TX");
+ else
+ strcpy (msg, "RX");
+ test_begin (t, msg)
+ {
+ uint lid;
+ bool added;
+ cp_sta_t *my_sta = cp_sta_mgr_sta_add (cp, my_net, 254,
+ MAC_ADDRESS (0x00, 0x13, 0xd7, 0x01, 0x11, 0x12));
+ for (lid = 0; lid <= 0xff; lid++)
+ {
+ if (MAC_LID_IS_XLID (lid))
+ {
+ mfs_t *mfs = mac_store_mfs_add (
+ cp->mac_store, !transmit, false, false, lid,
+ cp_sta_get_tei (my_sta),
+ &added);
+ test_fail_unless (added);
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_link_stats_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_req_receive,
+ .ok = true,
+ .req_type = CM_LINK_STATS_REQTYPE_GET,
+ .req_id = 0,
+ .nid = cp_net_get_nid (cp, my_net),
+ .lid = lid,
+ .transmit = transmit,
+ .mgmt_flag = CM_LINK_STATS_MGMT_NOT_MGMT,
+ .mac = cp_sta_get_mac_address (my_sta)),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_begin,
+ .peer = peer, .req_id = 0,
+ .res_type = CM_LINK_STATS_RESTYPE_SUCCESS),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send,
+ .mfs = mfs,
+ .transmit = transmit),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ mac_store_mfs_remove (cp->mac_store, mfs);
+ blk_release (mfs);
+ }
+ else
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_link_stats_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_req_receive,
+ .ok = true,
+ .req_type = CM_LINK_STATS_REQTYPE_GET,
+ .req_id = 0,
+ .nid = cp_net_get_nid (cp, my_net),
+ .lid = lid,
+ .transmit = transmit,
+ .mgmt_flag = CM_LINK_STATS_MGMT_NOT_MGMT,
+ .mac = cp_sta_get_mac_address (my_sta)),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_begin,
+ .peer = peer, .req_id = 0,
+ .res_type = CM_LINK_STATS_RESTYPE_FAILURE),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ }
+ }
+ cp_sta_mgr_sta_remove (cp, my_sta);
+ slab_release (my_sta);
+ test_sta_action_uninit (&ctx);
+ }
+ test_end;
+}
+
+void
+misc_link_stats_test_case (test_t t)
+{
+ /* init test context */
+ test_sta_action_t ctx;
+ cp_t *cp = &ctx.cp;
+ const cp_tei_t tei_1 = 10;
+ const mac_t mac_1 = MAC_ADDRESS (0x00, 0x13, 0xd7, 0x00, 0x00, 0x01);
+ u8 lid_tx = 0;
+ u8 lid_rx = 1;
+ cp_nid_t our_nid = 0x4242;
+
+ /* init globals */
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+ const cp_tei_t my_tei = 2;
+ cp_mme_peer_t peer = CP_MME_PEER (0x112233445577ull, 5);
+ cp_mme_tx_t mme_to_send;
+ globals.mme = &mme_to_send;
+
+ test_sta_action_init (&ctx);
+
+ test_case_begin (t, "link_stats_req invalid message");
+ test_begin (t, "nok")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_link_stats_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_req_receive, .ok = false,
+ .req_id = 1,
+ .req_type = CM_LINK_STATS_REQTYPE_GET),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_begin,
+ .peer = peer, .req_id = 0,
+ .res_type = CM_LINK_STATS_RESTYPE_FAILURE),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+
+ /* Create our net/AVLN. */
+ test_sta_action_create_our_net (&ctx, our_nid, my_tei);
+ cp_net_t *my_net = cp_sta_mgr_get_our_avln (cp);
+
+ test_case_begin (t, "link_stats_req invalid nid");
+ test_begin (t, "ok")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_link_stats_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_req_receive, .ok = true,
+ .req_type = CM_LINK_STATS_REQTYPE_GET, .req_id = 1,
+ .nid = 42, .lid = lid_tx, .transmit = true,
+ .mgmt_flag = false, .mac = mac_1),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_begin,
+ .peer = peer, .req_id = 1,
+ .res_type = CM_LINK_STATS_RESTYPE_FAILURE),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+
+ test_case_begin (t, "link_stats_req unknown mac");
+ test_begin (t, "ok")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_link_stats_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_req_receive, .ok = true,
+ .req_type = CM_LINK_STATS_REQTYPE_GET, .req_id = 2,
+ .nid = our_nid, .lid = lid_tx,
+ .transmit = CM_LINK_STATS_TLFLAG_TRANSMIT,
+ .mgmt_flag = CM_LINK_STATS_MGMT_NOT_MGMT, .mac = mac_1),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_begin,
+ .peer = peer, .req_id = 2,
+ .res_type = CM_LINK_STATS_RESTYPE_FAILURE),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+
+ /* Create a station in the network */
+ cp_sta_t *sta_1 = cp_sta_mgr_sta_add (cp, my_net, tei_1, mac_1);
+
+ test_case_begin (t, "link_stats_req unknown link");
+ test_begin (t, "ok")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_link_stats_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_req_receive, .ok = true,
+ .req_type = CM_LINK_STATS_REQTYPE_GET, .req_id = 3,
+ .nid = our_nid, .lid = lid_tx,
+ .transmit = CM_LINK_STATS_TLFLAG_TRANSMIT,
+ .mgmt_flag = CM_LINK_STATS_MGMT_NOT_MGMT, .mac = mac_1),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_begin,
+ .peer = peer, .req_id = 3,
+ .res_type = CM_LINK_STATS_RESTYPE_FAILURE),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+
+ /* Create a tx link (tx=true, broadcast=false, mme=false) */
+ bool added = false;
+ mfs_t *m_tx = mac_store_mfs_add (cp->mac_store, true, false, false,
+ lid_tx, tei_1, &added);
+
+ test_case_begin (t, "link_stats_req valid tx link req");
+ test_begin (t, "ok")
+ {
+ test_fail_unless (added == true);
+
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_link_stats_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_req_receive, .ok = true,
+ .req_type = CM_LINK_STATS_REQTYPE_GET, .req_id = 4,
+ .nid = our_nid, .lid = lid_tx,
+ .transmit = CM_LINK_STATS_TLFLAG_TRANSMIT,
+ .mgmt_flag = CM_LINK_STATS_MGMT_NOT_MGMT, .mac = mac_1),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_begin,
+ .peer = peer, .req_id = 4,
+ .res_type = CM_LINK_STATS_RESTYPE_SUCCESS),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send,
+ .mfs = m_tx, .transmit = CM_LINK_STATS_TLFLAG_TRANSMIT),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ mac_store_mfs_remove (cp->mac_store, m_tx);
+ blk_release (m_tx);
+
+ /* Create a tx link (tx=true, broadcast=true, mme=false) */
+ added = false;
+ m_tx = mac_store_mfs_add (cp->mac_store, true, true, false,
+ 0, 0xff, &added);
+ dbg_check (added);
+
+ test_case_begin (t, "link_stats_req valid tx link req");
+ test_begin (t, "ok")
+ {
+ test_fail_unless (added == true);
+
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_link_stats_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_req_receive, .ok = true,
+ .req_type = CM_LINK_STATS_REQTYPE_GET, .req_id = 4,
+ .nid = our_nid, .lid = 0,
+ .transmit = CM_LINK_STATS_TLFLAG_TRANSMIT,
+ .mgmt_flag = CM_LINK_STATS_MGMT_NOT_MGMT,
+ .mac = MAC_ADDRESS (0xff, 0xff, 0xff, 0xff, 0xff, 0xff)),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_begin,
+ .peer = peer, .req_id = 4,
+ .res_type = CM_LINK_STATS_RESTYPE_FAILURE),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ mac_store_mfs_remove (cp->mac_store, m_tx);
+ blk_release (m_tx);
+
+ /* Create a tx link (tx=true, broadcast=false, mme=true) */
+ added = false;
+ m_tx = mac_store_mfs_add (cp->mac_store, true, false, true,
+ MAC_LID_NONE, tei_1, &added);
+ dbg_check (added);
+
+ test_case_begin (t, "link_stats_req valid tx link req");
+ test_begin (t, "ok")
+ {
+ test_fail_unless (added == true);
+
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_link_stats_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_req_receive, .ok = true,
+ .req_type = CM_LINK_STATS_REQTYPE_GET, .req_id = 4,
+ .nid = our_nid, .lid = MAC_LID_NONE,
+ .transmit = CM_LINK_STATS_TLFLAG_TRANSMIT,
+ .mgmt_flag = CM_LINK_STATS_MGMT_MGMT, .mac = mac_1),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_begin,
+ .peer = peer, .req_id = 4,
+ .res_type = CM_LINK_STATS_RESTYPE_SUCCESS),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send,
+ .mfs = m_tx, .transmit = CM_LINK_STATS_TLFLAG_TRANSMIT),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ mac_store_mfs_remove (cp->mac_store, m_tx);
+ blk_release (m_tx);
+
+ /* Create a rx link (tx=false, broadcast=false, mme=false) */
+ added = false;
+ mfs_t *m_rx = mac_store_mfs_add (cp->mac_store, false, false, false,
+ lid_rx, tei_1, &added);
+ dbg_check (added);
+ mfs_t *mme_rx = mac_store_mfs_add (cp->mac_store, false, false, true,
+ MAC_LID_NONE, tei_1, &added);
+ dbg_check (added);
+ mfs_t *bcast_rx = mac_store_mfs_add (cp->mac_store, false, true, false,
+ 0, tei_1, &added);
+ dbg_check (added);
+
+ test_case_begin (t, "link_stats_req valid rx link req");
+ test_begin (t, "multiple rx")
+ {
+ scenario_entry_t entries[] = {
+ /* Unicast link. */
+ SCENARIO_ACTION (process_cm_link_stats_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_req_receive, .ok = true,
+ .req_type = CM_LINK_STATS_REQTYPE_GET, .req_id = 5,
+ .nid = our_nid, .lid = lid_rx,
+ .transmit = CM_LINK_STATS_TLFLAG_RECEIVE,
+ .mgmt_flag = CM_LINK_STATS_MGMT_NOT_MGMT, .mac = mac_1),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_begin,
+ .peer = peer, .req_id = 5,
+ .res_type = CM_LINK_STATS_RESTYPE_SUCCESS),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send,
+ .mfs = m_rx, .transmit = CM_LINK_STATS_TLFLAG_RECEIVE),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_end),
+ /* Unicast MME link. */
+ SCENARIO_ACTION (process_cm_link_stats_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_req_receive, .ok = true,
+ .req_type = CM_LINK_STATS_REQTYPE_GET, .req_id = 5,
+ .nid = our_nid, .lid = 124,
+ .transmit = CM_LINK_STATS_TLFLAG_RECEIVE,
+ .mgmt_flag = CM_LINK_STATS_MGMT_MGMT, .mac = mac_1),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_begin,
+ .peer = peer, .req_id = 5,
+ .res_type = CM_LINK_STATS_RESTYPE_SUCCESS),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send,
+ .mfs = mme_rx, .transmit = CM_LINK_STATS_TLFLAG_RECEIVE),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_end),
+ /* Bcast link. */
+ SCENARIO_ACTION (process_cm_link_stats_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_req_receive, .ok = true,
+ .req_type = CM_LINK_STATS_REQTYPE_GET, .req_id = 5,
+ .nid = our_nid, .lid = 0,
+ .transmit = CM_LINK_STATS_TLFLAG_RECEIVE,
+ .mgmt_flag = CM_LINK_STATS_MGMT_NOT_MGMT,
+ .mac = MAC_BROADCAST),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_begin,
+ .peer = peer, .req_id = 5,
+ .res_type = CM_LINK_STATS_RESTYPE_FAILURE),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ mac_store_mfs_remove (cp->mac_store, mme_rx);
+ mac_store_mfs_remove (cp->mac_store, bcast_rx);
+ blk_release (mme_rx);
+ blk_release (bcast_rx);
+
+ added = false;
+ m_tx = mac_store_mfs_add (cp->mac_store, true, false, false,
+ lid_tx, tei_1, &added);
+
+ /* Force tx stats value with non-zero values */
+ m_tx->tx.stats.statistics_start_rtc_date = 0xFFFFFFFF;
+ m_tx->tx.stats.num_msdus = 0xFFFFFFFF;
+ m_tx->tx.stats.octets = 0xFFFFFFFF;
+ m_tx->tx.stats.num_segs = 0xFFFFFFFF;
+ m_tx->tx.stats.num_segs_suc = 0xFFFFFFFF;
+ m_tx->tx.stats.num_segs_dropped = 0xFFFFFFFF;
+ m_tx->tx.stats.num_pbs = 0xFFFFFFFF;
+ m_tx->tx.stats.num_mpdus = 0xFFFFFFFF;
+ m_tx->tx.stats.num_bursts = 0xFFFFFFFF;
+ m_tx->tx.stats.num_sacks = 0xFFFFFFFF;
+
+ test_case_begin (t, "link_stats_req valid tx link get and reset");
+ test_begin (t, "ok")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_link_stats_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_req_receive, .ok = true,
+ .req_type = CM_LINK_STATS_REQTYPE_GET_AND_RESET,
+ .req_id = 8, .nid = our_nid, .lid = lid_tx,
+ .transmit = CM_LINK_STATS_TLFLAG_TRANSMIT,
+ .mgmt_flag = CM_LINK_STATS_MGMT_NOT_MGMT, .mac = mac_1),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_begin,
+ .peer = peer, .req_id = 8,
+ .res_type = CM_LINK_STATS_RESTYPE_SUCCESS),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send,
+ .mfs = m_tx, .transmit = CM_LINK_STATS_TLFLAG_TRANSMIT),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+
+ test_fail_unless (m_tx->tx.stats.statistics_start_rtc_date == 0);
+ test_fail_unless (m_tx->tx.stats.num_msdus == 0);
+ test_fail_unless (m_tx->tx.stats.octets == 0);
+ test_fail_unless (m_tx->tx.stats.num_segs == 0);
+ test_fail_unless (m_tx->tx.stats.num_segs_suc == 0);
+ test_fail_unless (m_tx->tx.stats.num_segs_dropped == 0);
+ test_fail_unless (m_tx->tx.stats.num_pbs == 0);
+ test_fail_unless (m_tx->tx.stats.num_mpdus == 0);
+ test_fail_unless (m_tx->tx.stats.num_bursts == 0);
+ test_fail_unless (m_tx->tx.stats.num_sacks == 0);
+ } test_end;
+
+ /* Force tx stats value with non-zero values */
+ m_tx->tx.stats.statistics_start_rtc_date = 0xFFFFFFFF;
+ m_tx->tx.stats.num_msdus = 0xFFFFFFFF;
+ m_tx->tx.stats.octets = 0xFFFFFFFF;
+ m_tx->tx.stats.num_segs = 0xFFFFFFFF;
+ m_tx->tx.stats.num_segs_suc = 0xFFFFFFFF;
+ m_tx->tx.stats.num_segs_dropped = 0xFFFFFFFF;
+ m_tx->tx.stats.num_pbs = 0xFFFFFFFF;
+ m_tx->tx.stats.num_mpdus = 0xFFFFFFFF;
+ m_tx->tx.stats.num_bursts = 0xFFFFFFFF;
+ m_tx->tx.stats.num_sacks = 0xFFFFFFFF;
+
+ test_case_begin (t, "link_stats_req valid tx link reset");
+ test_begin (t, "ok")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_link_stats_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_req_receive, .ok = true,
+ .req_type = CM_LINK_STATS_REQTYPE_RESET, .req_id = 9,
+ .nid = our_nid, .lid = lid_tx,
+ .transmit = CM_LINK_STATS_TLFLAG_TRANSMIT,
+ .mgmt_flag = CM_LINK_STATS_MGMT_NOT_MGMT, .mac = mac_1),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_begin,
+ .peer = peer, .req_id = 9,
+ .res_type = CM_LINK_STATS_RESTYPE_SUCCESS),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+
+ test_fail_unless (m_tx->tx.stats.statistics_start_rtc_date == 0);
+ test_fail_unless (m_tx->tx.stats.num_msdus == 0);
+ test_fail_unless (m_tx->tx.stats.octets == 0);
+ test_fail_unless (m_tx->tx.stats.num_segs == 0);
+ test_fail_unless (m_tx->tx.stats.num_segs_suc == 0);
+ test_fail_unless (m_tx->tx.stats.num_segs_dropped == 0);
+ test_fail_unless (m_tx->tx.stats.num_pbs == 0);
+ test_fail_unless (m_tx->tx.stats.num_mpdus == 0);
+ test_fail_unless (m_tx->tx.stats.num_bursts == 0);
+ test_fail_unless (m_tx->tx.stats.num_sacks == 0);
+ } test_end;
+
+ /* Force rx stats value with non-zero values */
+ m_rx->rx.stats.statistics_start_rtc_date = 0xFFFFFFFF;
+ m_rx->rx.stats.num_msdus = 0xFFFFFFFF;
+ m_rx->rx.stats.octets = 0xFFFFFFFF;
+ m_rx->rx.stats.num_segs_suc = 0xFFFFFFFF;
+ m_rx->rx.stats.num_segs_missed = 0xFFFFFFFF;
+ m_rx->rx.stats.num_pbs = 0xFFFFFFFF;
+ m_rx->rx.stats.num_mpdus = 0xFFFFFFFF;
+ m_rx->rx.stats.num_bursts = 0xFFFFFFFF;
+ m_rx->rx.stats.num_icv_fails = 0xFFFFFFFF;
+
+ test_case_begin (t, "link_stats_req valid rx link get and reset");
+ test_begin (t, "ok")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_link_stats_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_req_receive, .ok = true,
+ .req_type = CM_LINK_STATS_REQTYPE_GET_AND_RESET,
+ .req_id = 6, .nid = our_nid, .lid = lid_rx,
+ .transmit = CM_LINK_STATS_TLFLAG_RECEIVE,
+ .mgmt_flag = CM_LINK_STATS_MGMT_NOT_MGMT, .mac = mac_1),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_begin,
+ .peer = peer, .req_id = 6,
+ .res_type = CM_LINK_STATS_RESTYPE_SUCCESS),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send,
+ .mfs = m_rx, .transmit = CM_LINK_STATS_TLFLAG_RECEIVE),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+
+ test_fail_unless (m_rx->rx.stats.statistics_start_rtc_date == 0);
+ test_fail_unless (m_rx->rx.stats.num_msdus == 0);
+ test_fail_unless (m_rx->rx.stats.octets == 0);
+ test_fail_unless (m_rx->rx.stats.num_segs_suc == 0);
+ test_fail_unless (m_rx->rx.stats.num_segs_missed == 0);
+ test_fail_unless (m_rx->rx.stats.num_pbs == 0);
+ test_fail_unless (m_rx->rx.stats.num_mpdus == 0);
+ test_fail_unless (m_rx->rx.stats.num_bursts == 0);
+ test_fail_unless (m_rx->rx.stats.num_icv_fails == 0);
+ } test_end;
+
+ /* Force rx stats value with non-zero values */
+ m_rx->rx.stats.statistics_start_rtc_date = 0xFFFFFFFF;
+ m_rx->rx.stats.num_msdus = 0xFFFFFFFF;
+ m_rx->rx.stats.octets = 0xFFFFFFFF;
+ m_rx->rx.stats.num_segs_suc = 0xFFFFFFFF;
+ m_rx->rx.stats.num_segs_missed = 0xFFFFFFFF;
+ m_rx->rx.stats.num_pbs = 0xFFFFFFFF;
+ m_rx->rx.stats.num_mpdus = 0xFFFFFFFF;
+ m_rx->rx.stats.num_bursts = 0xFFFFFFFF;
+ m_rx->rx.stats.num_icv_fails = 0xFFFFFFFF;
+
+ test_case_begin (t, "link_stats_req valid rx link reset");
+ test_begin (t, "ok")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_link_stats_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_req_receive, .ok = true,
+ .req_type = CM_LINK_STATS_REQTYPE_RESET, .req_id = 7,
+ .nid = our_nid, .lid = lid_rx,
+ .transmit = CM_LINK_STATS_TLFLAG_RECEIVE,
+ .mgmt_flag = CM_LINK_STATS_MGMT_NOT_MGMT, .mac = mac_1),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_begin,
+ .peer = peer, .req_id = 7,
+ .res_type = CM_LINK_STATS_RESTYPE_SUCCESS),
+ SCENARIO_EVENT (cp_msg_cm_link_stats_cnf_send_end),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+
+ test_fail_unless (m_rx->rx.stats.statistics_start_rtc_date == 0);
+ test_fail_unless (m_rx->rx.stats.num_msdus == 0);
+ test_fail_unless (m_rx->rx.stats.octets == 0);
+ test_fail_unless (m_rx->rx.stats.num_segs_suc == 0);
+ test_fail_unless (m_rx->rx.stats.num_segs_missed == 0);
+ test_fail_unless (m_rx->rx.stats.num_pbs == 0);
+ test_fail_unless (m_rx->rx.stats.num_mpdus == 0);
+ test_fail_unless (m_rx->rx.stats.num_bursts == 0);
+ test_fail_unless (m_rx->rx.stats.num_icv_fails == 0);
+ } test_end;
+ /* Cleanup. */
+ mac_store_mfs_remove (cp->mac_store, m_rx);
+ blk_release (m_rx);
+ mac_store_mfs_remove (cp->mac_store, m_tx);
+ blk_release (m_tx);
+ cp_sta_mgr_sta_remove (cp, sta_1);
+ slab_release (sta_1);
+ test_sta_action_uninit (&ctx);
+}
+
+void
+misc_link_stats_test_case_all_lids (test_t t)
+{
+ test_case_begin (t, "All possible values");
+ misc_link_stats_test_case_common (t, CM_LINK_STATS_TLFLAG_TRANSMIT);
+ misc_link_stats_test_case_common (t, CM_LINK_STATS_TLFLAG_RECEIVE);
+}
+
+
+void
+misc_sta_cap_test_case (test_t t)
+{
+ /* init test context */
+ test_sta_action_t ctx;
+ cp_t *cp = &ctx.cp;
+
+ /* init globals */
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+ const mac_t mac = 0x111111111111ull;
+ cp_mme_peer_t peer = CP_MME_PEER (0x112233445577ull, 5);
+ cp_mme_tx_t mme_to_send;
+ globals.mme = &mme_to_send;
+
+ test_sta_action_init (&ctx);
+ cp_sta_own_data_set_mac_address (cp, mac);
+
+ test_case_begin (t, "cm_sta_cap_req invalid message");
+ test_begin (t, "ok")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_sta_cap_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_sta_cap_req_receive, .ok = false),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+
+ test_case_begin (t, "valid cm_sta_cap_req");
+ test_begin (t, "ok")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_sta_cap_req, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cm_sta_cap_req_receive, .ok = true),
+ SCENARIO_EVENT (cp_msg_cm_sta_cap_cnf_send, .peer = peer,
+ .av_version = CP_AV_VERSION,
+ .mac = mac, .oui = SPC_OUI, .auto_connect = CP_ACS_CAP,
+ .smoothing = CP_SMOOTHING_CAP, .cco_cap = CP_CCO_LEVEL,
+ .proxy_cap = CP_PCO_CAP,
+ .backup_cco_cap = CP_BACKUP_CCO_CAP,
+ .soft_handover = CP_SOFT_HANDOVER_CAP,
+ .two_sym_fc = CP_TWO_SYM_FC_CAP,
+ .max_fl_av = MAC_MAX_FL_MAX_FL,
+ .homeplug_11_cap = CP_HOMEPLUG_AV11,
+ .homeplug_101_int = CP_HOMEPLUG_AV101,
+ .regulatory_cap = CP_REGULATORY_CAP,
+ .bidir_burst = CP_BIDIRECTIONAL_BURSTING_CAP,
+ .implementation_version = BUILD_INFO_IMPLEMENTATION),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ /* Cleanup. */
+ test_sta_action_uninit (&ctx);
+}
+
+void
+misc_test_suite (test_t t)
+{
+ test_suite_begin (t, "misc");
+ misc_whoru_test_case (t);
+ misc_cc_discover_list_test_case (t);
+ misc_relay_test_case (t);
+ misc_hfid_test_case (t);
+ misc_mme_error_test_case (t);
+ misc_nw_stats_test_case (t);
+ misc_nw_info_test_case (t);
+ misc_link_stats_test_case (t);
+ misc_link_stats_test_case_all_lids (t);
+ misc_sta_cap_test_case (t);
+ test_case_begin (t, "memory");
+ test_begin (t, "memory")
+ {
+ test_fail_unless (blk_check_memory ());
+ } test_end;
+}
+
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/src/msg_stub.c b/cesar/cp/eoc/sta/action/test/utest_eoc/src/msg_stub.c
new file mode 100644
index 0000000000..83e56bcf84
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/src/msg_stub.c
@@ -0,0 +1,421 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/msg_stub.c
+ * \brief cp/msg module stub.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "lib/scenario/scenario.h"
+#include "mac/common/tonemap.h"
+
+#include "cp/inc/context.h"
+#include "cp/msg/msg.h"
+#include "hal/phy/defs.h"
+#include "cp/msg/inc/vs_get_tonemap.h"
+#include "cp/msg/inc/cc_discover_list.h"
+
+#include <string.h>
+
+#define __ptr_(TYPE) PASTE_EXPAND (__ptr__, TYPE)
+#define __ptr__assign *
+#define __ptr__string
+#define __ptr__array
+#define __ptr__string_or_null
+#define __ptr__tonemask
+#define __ptr__hash_key
+
+#define __dim_(TYPE, DIM...) PASTE_EXPAND (__dim__, TYPE) (DIM)
+#define __dim__assign()
+#define __dim__string()
+#define __dim__array(DIM) DIM
+#define __dim__string_or_null()
+#define __dim__tonemask()
+#define __dim__hash_key()
+
+/* 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) \
+}
+
+/* Code for MME transmission complex with a begin. */
+#define __mscb(EVENT, PARAMS...) \
+cp_mme_tx_t * \
+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, global); \
+ PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __ms_test_, ## PARAMS) \
+ return global->mme; \
+}
+
+/* Code for MME transmission complex (with or without an end). */
+#define __msc(EVENT, PARAMS...) \
+void \
+EVENT (cp_t *ctx, cp_mme_tx_t *mme \
+ PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __ms_pdecl_, ## PARAMS)) \
+{ \
+ dbg_assert (ctx); \
+ dbg_assert (mme); \
+ scenario_event (EVENT, param); \
+ test_fail_unless (param); \
+ PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __ms_test_, ## PARAMS) \
+}
+
+#define __msdc(EVENT, DATA, PARAMS...) \
+void \
+EVENT (cp_t *ctx, cp_mme_tx_t *mme, const DATA *data) \
+{ \
+ dbg_assert (ctx); \
+ dbg_assert (mme); \
+ dbg_assert (data); \
+ scenario_event (EVENT, param); \
+ PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __msd_test_, ## PARAMS) \
+}
+
+#define __ms_pdecl_(TYPE, PARAM, KIND) , TYPE PARAM
+#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_test__ignore_pointer(PARAM)
+#define __ms_test__string(PARAM) \
+ test_fail_unless (strcmp (PARAM, param->PARAM) == 0);
+#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); \
+
+/* Code for MME transmission with a data structure. */
+#define __msd(EVENT, DATA, PARAMS...) \
+void \
+EVENT (cp_t *ctx, cp_mme_peer_t *peer, const DATA *data) \
+{ \
+ dbg_assert (ctx); \
+ dbg_assert (peer); \
+ dbg_assert (data); \
+ scenario_event (EVENT, param); \
+ __ms_test_peer \
+ PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __msd_test_, ## PARAMS) \
+}
+
+#define __msd_test_(TYPE, PARAM, KIND) \
+ PASTE_EXPAND (__msd_test__, KIND) (PARAM)
+#define __msd_test__assign(PARAM) \
+ test_fail_unless (data->PARAM == param->PARAM);
+#define __msd_test__string(PARAM) \
+ test_fail_unless (strcmp (data->PARAM, param->PARAM) == 0);
+#define __msd_test__hash_key(PARAM) \
+ test_fail_unless (!param->PARAM || memcmp (data->PARAM, param->PARAM, \
+ CP_HASH_KEY_SIZE) == 0);
+#define __msd_test__key(PARAM) \
+ test_fail_unless (memcmp (&data->PARAM, &param->PARAM, \
+ sizeof (cp_key_t)) == 0);
+#define __ms_test__key(PARAM) \
+ test_fail_unless (memcmp (&PARAM, &param->PARAM, \
+ sizeof (cp_key_t)) == 0);
+#define __msd_test__sub_assign(PARAM) \
+ __msd_test__sub_assign_ PARAM
+#define __msd_test__sub_assign_(PARAM, SUBNAME) \
+ test_fail_unless (data->SUBNAME.PARAM == param->PARAM);
+#define __msd_test__ignore_pointer(PARAM) ;
+
+#define __msd_test__array(PARAM) \
+ __msd_test__array_ PARAM
+#define __msd_test__array_(PARAM, SIZE) \
+ test_fail_unless (memcmp (data->PARAM, param->PARAM, SIZE) == 0);
+
+/* Code for MME transmission with a data structure with encryption
+ * information. */
+#define __msk(EVENT, DATA, PARAMS...) \
+void \
+EVENT (cp_t *ctx, cp_mme_peer_t *peer, cp_mme_peks_t peks, \
+ const cp_secu_protocol_run_t *prun, const DATA *data) \
+{ \
+ dbg_assert (ctx); \
+ dbg_assert (peer); \
+ dbg_assert (data); \
+ scenario_event (EVENT, param, global); \
+ __ms_test_peer \
+ test_fail_unless (peks == param->peks); \
+ test_fail_unless (prun->pid == param->pid); \
+ test_fail_unless (prun->pmn == param->pmn); \
+ global->prn = prun->prn; \
+ global->my_nonce = prun->my_nonce; \
+ PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __msd_test_, ## PARAMS) \
+}
+
+/* Code for MME transmission for CC_RELAY.IND. */
+#define __msr(EVENT, PARAMS...) \
+void \
+EVENT (cp_t *ctx, cp_mme_rx_t *mme \
+ PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __ms_pdecl_, ## PARAMS)) \
+{ \
+ dbg_assert (ctx); \
+ dbg_assert (mme); \
+ scenario_event (EVENT, param); \
+ test_fail_unless (mme->relay.mac_fa == param->mac_fa); \
+ test_fail_unless (mme->relay.ftei == param->ftei); \
+ PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __ms_test_, ## PARAMS) \
+}
+
+
+/* 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; \
+}
+
+#define __mr_pdecl_(TYPE, PARAM, KIND, DIM...) \
+ , TYPE __ptr_ (KIND) PARAM __dim_ (KIND, ## DIM)
+#define __mr_assert_(TYPE, PARAM, KIND, DIM...) dbg_assert_ptr (PARAM);
+#define __mr_copy_(TYPE, PARAM, KIND, DIM...) \
+ PASTE_EXPAND (__mr_copy__, KIND) (PARAM, TYPE, ## DIM)
+
+#define __mr_copy__assign(PARAM, TYPE) *PARAM = param->PARAM;
+#define __mr_copy__string(PARAM, TYPE) strcpy (PARAM, param->PARAM);
+#define __mr_copy__string_or_null(PARAM, TYPE) \
+ if (param->PARAM) strcpy (PARAM, param->PARAM);
+#define __mr_copy__tonemask(PARAM, TYPE) \
+ memcpy (PARAM, param->PARAM, PHY_TONEMASK_SIZE);
+#define __mr_copy__array(PARAM, TYPE, DIM) \
+ memcpy (PARAM, param->PARAM, sizeof(TYPE DIM));
+
+/* Code for MME reception with a data structure. */
+#define __mrd(EVENT, DATA, PARAMS...) \
+bool \
+EVENT (cp_t *ctx, cp_mme_rx_t *mme, DATA *data) \
+{ \
+ dbg_assert (ctx); \
+ dbg_assert (mme); \
+ dbg_assert (data); \
+ scenario_event (EVENT, param); \
+ if (param->ok) \
+ { \
+ PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __mrd_copy_, PARAMS) \
+ return true; \
+ } \
+ else \
+ return false; \
+}
+
+#define __mrd_copy_(TYPE, PARAM, KIND) \
+ PASTE_EXPAND (__mrd_copy__, KIND) (PARAM)
+
+#define __mrd_copy__assign(PARAM) data->PARAM = param->PARAM;
+#define __mrd_copy__string(PARAM) strcpy (data->PARAM, param->PARAM);
+#define __mrd_copy__tonemask(PARAM) \
+ memcpy (data->PARAM, param->PARAM, PHY_TONEMASK_SIZE);
+#define __mrd_copy__hash_key(PARAM) \
+ if (param->PARAM) memcpy (data->PARAM, param->PARAM, CP_HASH_KEY_SIZE);
+#define __mrd_copy__assign_deref(PARAM) \
+ if (param->PARAM) data->PARAM = *param->PARAM;
+
+/* Code for MME reception with a data structure with encryption
+ * information. */
+#define __mrk(EVENT, DATA, PARAMS...) \
+bool \
+EVENT (cp_t *ctx, cp_mme_rx_t *mme, DATA *data) \
+{ \
+ dbg_assert (ctx); \
+ dbg_assert (mme); \
+ dbg_assert (data); \
+ scenario_event (EVENT, param, g); \
+ if (param->ok) \
+ { \
+ mme->peks = param->peks; \
+ if (param->new_prn) g->prn = lib_rnd32 (&ctx->rnd) & 0xffff; \
+ if (param->new_my_nonce) g->my_nonce = lib_rnd32 (&ctx->rnd); \
+ if (param->new_your_nonce) g->your_nonce = lib_rnd32 (&ctx->rnd); \
+ mme->prun.pid = param->pid; \
+ mme->prun.pmn = param->pmn; \
+ mme->prun.prn = g->prn; \
+ mme->prun.my_nonce = g->my_nonce; \
+ mme->prun.your_nonce = g->your_nonce; \
+ PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __mrd_copy_, PARAMS) \
+ return true; \
+ } \
+ else \
+ return false; \
+}
+
+/* Code for MME reception for CC_RELAY.REQ. */
+#define __mrr(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) \
+ { \
+ mme->relay.mac_fa = param->mac_fa; \
+ mme->relay.ftei = param->ftei; \
+ PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __mr_copy_, ## PARAMS) \
+ return true; \
+ } \
+ else \
+ return false; \
+}
+
+__mr (cp_msg_drv_sta_set_mac_addr_req_receive, (mac_t, mac, assign))
+__mr (cp_msg_drv_sta_set_cco_pref_req_receive, (bool, cco_pref, assign))
+__mr (cp_msg_drv_sta_set_was_cco_req_receive, (bool, was_cco, assign))
+__mr (cp_msg_drv_sta_set_npw_req_receive, (char *, npw, string))
+__mr (cp_msg_drv_sta_set_dpw_req_receive, (char *, dpw, string))
+__mr (cp_msg_drv_sta_set_sl_req_receive, (cp_security_level_t, sl, assign))
+__mr (cp_msg_drv_sta_set_nid_req_receive, (cp_nid_t, nid, assign))
+__mr (cp_msg_drv_sta_set_m_sta_hfid_req_receive, (char *, m_sta_hfid, string))
+__mr (cp_msg_drv_sta_set_u_sta_hfid_req_receive, (char *, u_sta_hfid, string))
+__mr (cp_msg_drv_sta_set_avln_hfid_req_receive, (char *, avln_hfid, string))
+__mr (cp_msg_drv_sta_set_tonemask_req_receive, (u32 *, tonemask, tonemask))
+__mr (cp_msg_drv_sta_mac_start_req_receive)
+__mr (cp_msg_drv_sta_mac_stop_req_receive)
+__mr (cp_msg_drv_sta_sc_req_receive, (bool, sc_join, assign))
+__mr (cp_msg_drv_sta_set_key_req_receive, (cp_key_t, nmk, assign),
+ (enum cp_msg_drv_sta_set_key_type_t, type, assign),
+ (cp_nid_t, nid, assign),
+ (cp_security_level_t, sl, assign))
+__ms (cp_msg_drv_sta_set_key_ind_send,
+ (cp_key_t, nmk, key),
+ (enum cp_msg_drv_sta_set_key_type_t, type, assign),
+ (cp_nid_t, nid, assign),
+ (cp_security_level_t, sl, assign))
+__mr (cp_msg_drv_sta_set_dak_req_receive, (cp_key_t, dak, assign))
+__ms (cp_msg_drv_any_cnf_send,
+ (mmtype_t, mmtype, assign),
+ (cp_msg_drv_result_t, result, assign))
+__mr (cp_msg_drv_sta_get_key_req_receive)
+__msd (cp_msg_drv_sta_get_key_cnf_send, cp_msg_drv_sta_get_key_t,
+ (uint, result, assign),
+ (cp_key_t, nmk, key),
+ (cp_nid_t, nid, assign),
+ (cp_security_level_t, sl, assign))
+__mr (cp_msg_drv_sta_status_req_receive)
+__msd (cp_msg_drv_sta_status_cnf_send, cp_msg_drv_sta_status_cnf_t,
+ (uint, result, assign),
+ (cp_msg_drv_sta_status_status_t, (status, status), sub_assign),
+ (cp_msg_drv_sta_status_cco_t, (cco, status), sub_assign),
+ (bool, (preferred_cco, status), sub_assign),
+ (bool, (backup_cco, status), sub_assign),
+ (bool, (simple_connect, status), sub_assign),
+ (bsu_aclf_frequency_t, (pwl_sync_frequency, status), sub_assign))
+__msd (cp_msg_drv_sta_status_ind_send, cp_msg_drv_sta_status_t,
+ (cp_msg_drv_sta_status_status_t, status, assign),
+ (cp_msg_drv_sta_status_cco_t, cco, assign),
+ (bool, preferred_cco, assign),
+ (bool, backup_cco, assign),
+ (bool, simple_connect, assign),
+ (bsu_aclf_frequency_t, pwl_sync_frequency, assign))
+__mr (cp_msg_drv_sta_set_config_req_receive,
+ (char *, config, string))
+__msd (cp_msg_cc_assoc_req_send, cp_msg_cc_assoc_req_t,
+ (enum cp_msg_cc_assoc_req_type_t, request_type, assign),
+ (cp_nid_t, nid, assign),
+ (u8, cco_cap, assign),
+ (u8, proxy_cap, assign))
+__mrd (cp_msg_cc_assoc_cnf_receive, cp_msg_cc_assoc_cnf_t,
+ (enum cp_msg_cc_assoc_cnf_result_t *, result, assign),
+ (cp_nid_t, nid, assign),
+ (cp_snid_t, snid, assign),
+ (cp_tei_t, sta_tei, assign),
+ (u16, lease_time_min, assign))
+__mr (cp_msg_cc_leave_ind_receive,
+ (enum cp_msg_cc_leave_ind_reason_t, reason, assign),
+ (cp_nid_t, nid, assign))
+__ms (cp_msg_cc_leave_rsp_send)
+__msk (cp_msg_cm_get_key_req_send, cp_msg_cm_get_key_req_t,
+ (bool, relayed, assign),
+ (enum cp_msg_key_type_t, key_type, assign),
+ (cp_nid_t, nid, assign),
+ (u32 *, hash_key, hash_key))
+__mrk (cp_msg_cm_get_key_cnf_receive, cp_msg_cm_get_key_cnf_t,
+ (enum cp_msg_cm_get_key_cnf_result_t, result, assign),
+ (enum cp_msg_key_type_t, key_type, assign),
+ (cp_nid_t, nid, assign),
+ (u8, eks, assign),
+ (u32 *, hash_key, hash_key),
+ (cp_key_t, key, assign_deref))
+__mr (cp_msg_vs_eoc_cco_get_info_req_receive,
+ (u8, internal_eoc_index, assign),
+ (u8, control, assign))
+__ms (cp_msg_vs_eoc_cco_get_info_cnf_send,
+ (cp_msg_vs_eoc_get_info_req_result_t, status, assign),
+ (u16, tei, assign),
+ (s8, attenuation, assign),
+ (u8, snr, assign),
+ (u16, phy_uplink_speed, assign),
+ (u16, phy_downlink_speed, assign),
+ (u8, output_power, assign),
+ (u32, tx_success_counter, assign),
+ (u32, tx_crc_error_counter, assign),
+ (u32, tx_other_error_counter, assign),
+ (u32, rx_success_counter, assign),
+ (u32, rx_crc_error_counter, assign),
+ (u32, rx_other_error_counter, assign))
+__mr (cp_msg_vs_eoc_cco_diagnostic_info_req_receive,
+ (u8, internal_eoc_index, assign),
+ (u8, control, assign))
+__ms (cp_msg_vs_eoc_cco_diagnostict_info_cnf_send,
+ (cp_msg_vs_eoc_diagnostic_info_req_result_t, status, assign),
+ (u8, assoc_stat, assign),
+ (u64, nid, assign),
+ (u8, num_slots, assign),
+ (mac_t, he_mac_address, assign),
+ (u16, est_avg_phy_rate, assign),
+ (u8, num_good_assoc_auth, assign),
+ (u16, num_bad_could_not_assoc, assign),
+ (u32, num_bad_assoc_failure, assign),
+ (u32, num_bad_could_not_auth, assign),
+ (u32, num_leave, assign))
+__mr (cp_msg_vs_eoc_cco_get_real_time_stats_req_receive,
+ (u8, control, assign))
+__ms (cp_msg_vs_eoc_cco_get_real_time_stats_cnf_send,
+ (cp_msg_vs_eoc_get_real_time_statistics_req_result_t, status, assign),
+ (real_time_stats_t *, rt_stats, assign))
+__mr (cp_msg_eoc_sta_vs_set_out_lev_ind_receive,
+ (uint, output_level, assign))
+__ms (cp_msg_vs_eoc_cco_set_out_lev_ind_send,
+ (uint, output_level, assign))
+
+__mr (cp_msg_vs_get_attenuation_list_req_receive)
+__mscb (cp_msg_vs_get_attenuation_list_cnf_send_begin,
+ (uint, nb, assign))
+__msc (cp_msg_vs_get_attenuation_list_cnf_send_entry,
+ (mac_t, mac, assign),
+ (cp_tei_t, tei, assign),
+ (vs_get_attenuation_list_att_status_t, status, assign),
+ (s8, attenuation_db, assign))
+__msc (cp_msg_vs_get_attenuation_list_cnf_send_end)
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/src/scenario_actions.c b/cesar/cp/eoc/sta/action/test/utest_eoc/src/scenario_actions.c
new file mode 100644
index 0000000000..94e2d9ced6
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/src/scenario_actions.c
@@ -0,0 +1,171 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/scenario_actions.c
+ * \brief Scenario actions.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "cp/eoc/sta/action/action.h"
+
+#include "lib/scenario/scenario.h"
+
+#define __m(ACTION) \
+void \
+scenario_action_ ## ACTION ## _cb (scenario_globals_t *globals, \
+ scenario_params_t *params) \
+{ \
+ static cp_mme_rx_t mme; \
+ mme.peer = params->action_ ## ACTION.peer; \
+ mme.peks = CP_MME_PEKS_SPC_NOT_EMBEDDED; \
+ cp_sta_action_ ## ACTION (globals->cp, &mme); \
+}
+
+#define __m_av(ACTION) \
+void \
+scenario_action_ ## ACTION ## _cb (scenario_globals_t *globals, \
+ scenario_params_t *params) \
+{ \
+ static cp_mme_rx_t mme; \
+ mme.peer = params->action_ ## ACTION.peer; \
+ mme.peks = CP_MME_PEKS_SPC_NOT_EMBEDDED; \
+ cp_av_sta_action_ ## ACTION (globals->cp, &mme); \
+}
+
+#define __m_eoc(ACTION) \
+void \
+scenario_action_ ## ACTION ## _cb (scenario_globals_t *globals, \
+ scenario_params_t *params) \
+{ \
+ static cp_mme_rx_t mme; \
+ mme.peer = params->action_ ## ACTION.peer; \
+ mme.peks = CP_MME_PEKS_SPC_NOT_EMBEDDED; \
+ cp_eoc_sta_action_ ## ACTION (globals->cp, &mme); \
+}
+
+#define __mp(ACTION) \
+void \
+scenario_action_ ## ACTION ## _cb (scenario_globals_t *globals, \
+ scenario_params_t *params) \
+{ \
+ static cp_mme_rx_t mme; \
+ mme.peer = params->action_ ## ACTION.peer; \
+ mme.prun.pid = params->action_ ## ACTION.pid; \
+ mme.peks = CP_MME_PEKS_SPC_NOT_EMBEDDED; \
+ cp_sta_action_ ## ACTION (globals->cp, &mme); \
+}
+
+#define __me(ACTION) \
+void \
+scenario_action_ ## ACTION ## _cb (scenario_globals_t *globals, \
+ scenario_params_t *params) \
+{ \
+ static cp_mme_rx_t mme; \
+ mme.peer = params->action_ ## ACTION.peer; \
+ mme.encrypt = params->action_ ## ACTION.encrypt; \
+ cp_sta_action_ ## ACTION (globals->cp, &mme); \
+}
+
+#define __0(ACTION) \
+void \
+scenario_action_ ## ACTION ## _cb (scenario_globals_t *globals, \
+ scenario_params_t *params) \
+{ \
+ cp_sta_action_ ## ACTION (globals->cp); \
+}
+
+#define __0_av(ACTION) \
+void \
+scenario_action_ ## ACTION ## _cb (scenario_globals_t *globals, \
+ scenario_params_t *params) \
+{ \
+ cp_av_sta_action_ ## ACTION (globals->cp); \
+}
+
+#define __0_eoc(ACTION) \
+ void \
+scenario_action_ ## ACTION ## _cb (scenario_globals_t *globals, \
+ scenario_params_t *params) \
+{ \
+ cp_eoc_sta_action_ ## ACTION (globals->cp); \
+}
+
+#define __n(ACTION, PARAMS...) \
+void \
+scenario_action_ ## ACTION ## _cb (scenario_globals_t *globals, \
+ scenario_params_t *params) \
+{ \
+ scenario_action_ ## ACTION ## _t *p = &params->action_ ## ACTION; \
+ cp_sta_action_ ## ACTION (globals->cp \
+ PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, \
+ __n_args, ## PARAMS) \
+ ); \
+}
+
+#define __n_av(ACTION, PARAMS...) \
+void \
+scenario_action_ ## ACTION ## _cb (scenario_globals_t *globals, \
+ scenario_params_t *params) \
+{ \
+ scenario_action_ ## ACTION ## _t *p = &params->action_ ## ACTION; \
+ cp_av_sta_action_ ## ACTION (globals->cp \
+ PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, \
+ __n_args, ## PARAMS) \
+ ); \
+}
+
+#define __n_eoc(ACTION, PARAMS...) \
+void \
+scenario_action_ ## ACTION ## _cb (scenario_globals_t *globals, \
+ scenario_params_t *params) \
+{ \
+ scenario_action_ ## ACTION ## _t *p = &params->action_ ## ACTION; \
+ cp_eoc_sta_action_ ## ACTION (globals->cp \
+ PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, \
+ __n_args, ## PARAMS) \
+ ); \
+}
+
+#define __n_args(TYPE, PARAM) \
+ , p->PARAM
+
+__m (drv__stopped__drv_sta_set_mac_addr_req)
+__m (drv__stopped__drv_sta_set_cco_pref_req)
+__m (drv__stopped__drv_sta_set_was_cco_req)
+__m (drv__stopped__drv_sta_set_dpw_req)
+__m (drv__stopped__drv_sta_set_npw_req)
+__m (drv__stopped__drv_sta_set_sl_req)
+__m (drv__stopped__drv_sta_set_nid_req)
+__m (drv__stopped__drv_sta_set_m_sta_hfid_req)
+__m (drv__stopped__drv_sta_set_u_sta_hfid_req)
+__m (drv__stopped__drv_sta_set_avln_hfid_req)
+__m (drv__stopped__drv_sta_set_tonemask_req)
+__m (drv__stopped__drv_sta_mac_start_req)
+__m (drv__started__drv_sta_mac_stop_req)
+__m (drv__stopped__drv_sta_set_key_req)
+__m (drv__stopped__drv_sta_set_dak_req)
+__0 (drv__stopping__stopped)
+__m (drv__drv_sta_get_key_req)
+__m (drv__drv_sta_status_req)
+__m (drv__drv_sta_set_config_req)
+
+__n_eoc (detect__beacon_received,
+ (bsu_beacon_t *, beacon),
+ (cp_net_t *, net),
+ (cp_sta_t *, sta))
+__0_eoc (assoc__detecting_no_beacons)
+__0_eoc (assoc__detecting_detected)
+__m_eoc (assoc__associating_cnf)
+__0_eoc (assoc__associating_timeout)
+__0_eoc (assoc__associating_no_beacons)
+__m_eoc (assoc__associated_key_cnf)
+__0_eoc (assoc__associated_no_beacons)
+__0_eoc (assoc__associated_timeout)
+__m_eoc (assoc__associated_leave)
+__m_eoc (auth__authenticated_key_cnf)
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/src/secu.c b/cesar/cp/eoc/sta/action/test/utest_eoc/src/secu.c
new file mode 100644
index 0000000000..d053072477
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/src/secu.c
@@ -0,0 +1,52 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2009 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/secu.c
+ * \brief Secu stubs.
+ * \ingroup cp_eoc_sta_action
+ */
+#include "common/std.h"
+#include "cp/secu/secu.h"
+
+void
+cp_secu_protocol_run_new (cp_secu_protocol_run_t *prun, u8 pid,
+ lib_rnd_t *rnd)
+{
+ memset (prun, 0, sizeof (cp_secu_protocol_run_t));
+ prun->pmn = 1;
+ prun->pid = pid;
+ prun->prn = lib_rnd32 (rnd);
+ prun->my_nonce = lib_rnd32 (rnd);
+}
+
+void
+cp_secu_protocol_next (cp_secu_protocol_run_t *prun, lib_rnd_t *rnd,
+ bool last)
+{
+ dbg_assert (prun);
+ dbg_assert (rnd);
+ if (prun->pmn == 1)
+ prun->my_nonce = lib_rnd32 (rnd);
+ if (last)
+ prun->pmn = 0xff;
+ else
+ {
+ dbg_assert (prun->pmn != 0xff);
+ prun->pmn++;
+ }
+}
+
+bool
+cp_secu_protocol_check (const cp_secu_protocol_run_t *prun,
+ const cp_secu_protocol_run_t *prun_recv,
+ const cp_secu_protocol_run_check_result_t expected_result)
+{
+ dbg_assert (prun_recv);
+ return true;
+}
+
diff --git a/cesar/cp/eoc/sta/action/test/utest_eoc/src/test_sta_action.c b/cesar/cp/eoc/sta/action/test/utest_eoc/src/test_sta_action.c
new file mode 100644
index 0000000000..3481cb0e37
--- /dev/null
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/src/test_sta_action.c
@@ -0,0 +1,123 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/test_sta_action.c
+ * \brief Test sta/action.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "inc/test_sta_action.h"
+
+#include "lib/test.h"
+
+#include "mac/common/store.h"
+
+blk_t nsr_block;
+
+void
+assoc_test_suite (test_t t);
+
+void
+drv_test_suite (test_t t);
+
+void
+test_sta_action_init (test_sta_action_t *ctx)
+{
+#if CONFIG_TRACE
+ static trace_namespace_t namespace;
+ trace_buffer_add (&ctx->cp.trace, "cp", 8, 1, false, &namespace);
+#endif
+ memset (ctx, 0, sizeof (test_sta_action_t));
+ lib_rnd_init (&ctx->cp.rnd, 1234);
+ ctx->cp.mac_config = &ctx->mac_config;
+ ctx->cp.mac_store = mac_store_init ();
+ ctx->cp.sar = (void *) &ctx->cp;
+ ctx->cp.pbproc = NULL;
+ ctx->cp.cl = INVALID_PTR;
+ ctx->cp.bsu_aclf = &ctx->bsu_aclf;
+ cp_sta_mgr_init (&ctx->cp);
+}
+
+void
+test_sta_action_mfs_remove (mac_store_t *mac_store, mfs_t *mfs, void *user)
+{
+ mac_store_mfs_remove (mac_store, mfs);
+}
+
+void
+test_sta_action_uninit (test_sta_action_t *ctx)
+{
+ cp_sta_mgr_uninit (&ctx->cp);
+ /* Remove all the stations from the store. */
+ uint tei;
+ for (tei = MAC_TEI_STA_MIN; tei <= MAC_TEI_STA_MAX; tei++)
+ {
+ sta_t *sta = mac_store_sta_get (ctx->cp.mac_store, tei);
+ if (sta)
+ {
+ mac_store_mfs_travel_by_tei (ctx->cp.mac_store, tei,
+ test_sta_action_mfs_remove,
+ ctx);
+ dbg_check (mac_store_sta_remove (ctx->cp.mac_store, tei));
+ }
+ }
+ mac_store_mfs_travel (ctx->cp.mac_store, test_sta_action_mfs_remove, ctx);
+ mac_store_uninit (ctx->cp.mac_store);
+#if CONFIG_TRACE
+ trace_buffer_remove (&ctx->cp.trace);
+#endif
+}
+
+void
+test_sta_action_reset (test_sta_action_t *ctx)
+{
+ cp_sta_mgr_uninit (&ctx->cp);
+ cp_sta_mgr_init (&ctx->cp);
+}
+
+void
+test_sta_action_create_our_net (test_sta_action_t *ctx, cp_nid_t nid,
+ cp_snid_t snid)
+{
+ cp_t *cp = &ctx->cp;
+ cp_sta_own_data_set_nid (cp, nid);
+ cp_sta_own_data_set_snid (cp, snid);
+ cp_net_t *our_net = cp_sta_mgr_add_avln (cp, snid, nid);
+ cp_sta_mgr_set_our_avln (cp, our_net);
+}
+
+void
+test_sta_action_beacon_create (
+ bsu_beacon_t *beacon, cp_nid_t nid, cp_snid_t snid, cp_tei_t stei,
+ mac_t mac)
+{
+ memset (beacon, 0, sizeof (bsu_beacon_t));
+ beacon->vf.bt = BSU_BEACON_TYPE_CENTRAL;
+ beacon->vf.nid = nid;
+ beacon->params.rx_parameters.snid = snid;
+ beacon->vf.stei = stei;
+ beacon->bmis.mac_address.present = MAC_IS_VALID (mac);
+ beacon->bmis.mac_address.mac_address = mac;
+}
+
+int
+main (int argc, char **argv)
+{
+ test_t t;
+ test_init (t, argc, argv);
+ trace_init ();
+ lib_stats_init ();
+ drv_test_suite (t);
+ assoc_test_suite (t);
+ lib_stats_uninit ();
+ trace_uninit ();
+ test_result (t);
+ return test_nb_failed (t) == 0 ? 0 : 1;
+}
+
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/mgr/Config b/cesar/cp/eoc/sta/mgr/Config
new file mode 100644
index 0000000000..b61f26f167
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/Config
@@ -0,0 +1 @@
+CONFIG_CP_STA_MGR_CCO_EOC = n
diff --git a/cesar/cp/eoc/sta/mgr/Module b/cesar/cp/eoc/sta/mgr/Module
new file mode 100644
index 0000000000..ae884c7de9
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/Module
@@ -0,0 +1,3 @@
+SOURCES := sta_mgr.c sta_own_data.c
+
+MODULES := cp/sta/mgr
diff --git a/cesar/cp/eoc/sta/mgr/doc/sta_manager.odt b/cesar/cp/eoc/sta/mgr/doc/sta_manager.odt
new file mode 100644
index 0000000000..63c28efa0f
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/doc/sta_manager.odt
Binary files differ
diff --git a/cesar/cp/eoc/sta/mgr/doc/sta_mgr.xmi b/cesar/cp/eoc/sta/mgr/doc/sta_mgr.xmi
new file mode 100644
index 0000000000..000727a5bc
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/doc/sta_mgr.xmi
@@ -0,0 +1,1832 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<XMI xmlns:UML="http://schema.omg.org/spec/UML/1.3" verified="false" timestamp="2008-11-13T17:12:40" xmi.version="1.2" >
+ <XMI.header>
+ <XMI.documentation>
+ <XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
+ <XMI.exporterVersion>1.5.5</XMI.exporterVersion>
+ <XMI.exporterEncoding>UnicodeUTF8</XMI.exporterEncoding>
+ </XMI.documentation>
+ <XMI.metamodel xmi.name="UML" href="UML.xml" xmi.version="1.3" />
+ </XMI.header>
+ <XMI.content>
+ <UML:Model isSpecification="false" isLeaf="false" isRoot="false" xmi.id="m1" isAbstract="false" name="Modèle UML" >
+ <UML:Namespace.ownedElement>
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="folder" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="datatype" isRoot="false" isAbstract="false" name="datatype" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="enum" isRoot="false" isAbstract="false" name="enum" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="folder" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="datatype" isRoot="false" isAbstract="false" name="datatype" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="enum" isRoot="false" isAbstract="false" name="enum" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="folder" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="datatype" isRoot="false" isAbstract="false" name="datatype" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="enum" isRoot="false" isAbstract="false" name="enum" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="folder" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="datatype" isRoot="false" isAbstract="false" name="datatype" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="enum" isRoot="false" isAbstract="false" name="enum" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="folder" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="datatype" isRoot="false" isAbstract="false" name="datatype" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="enum" isRoot="false" isAbstract="false" name="enum" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="folder" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="datatype" isRoot="false" isAbstract="false" name="datatype" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="enum" isRoot="false" isAbstract="false" name="enum" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="folder" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="datatype" isRoot="false" isAbstract="false" name="datatype" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="enum" isRoot="false" isAbstract="false" name="enum" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="folder" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="datatype" isRoot="false" isAbstract="false" name="datatype" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="enum" isRoot="false" isAbstract="false" name="enum" />
+ <UML:Model stereotype="2" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Logical View" isRoot="false" isAbstract="false" name="Logical View" >
+ <UML:Namespace.ownedElement>
+ <UML:Package stereotype="2" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Datatypes" isRoot="false" isAbstract="false" name="Datatypes" >
+ <UML:Namespace.ownedElement>
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="WHsGhr6cL3qV" isRoot="false" isAbstract="false" name="int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="1lLAIoXrLdtJ" isRoot="false" isAbstract="false" name="char" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="BsXuVmQldfSS" isRoot="false" isAbstract="false" name="bool" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="l2nnsImcbvsP" isRoot="false" isAbstract="false" name="float" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Shk6a1xmtUeN" isRoot="false" isAbstract="false" name="double" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="G46rjYKTY5EP" isRoot="false" isAbstract="false" name="short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="O01xtrLMY3S6" isRoot="false" isAbstract="false" name="long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="5NqwrUH5XNxE" isRoot="false" isAbstract="false" name="unsigned int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="tFhSKvrguqen" isRoot="false" isAbstract="false" name="unsigned short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="hz7D2ZH5u80l" isRoot="false" isAbstract="false" name="unsigned long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="aHp7fmMY11yJ" isRoot="false" isAbstract="false" name="string" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="vntVp1gw0ZB8" isRoot="false" isAbstract="false" name="cp_reassembly_ctx_t *" elementReference="nyW3ZjsRDxWm" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="oZHHg64PKBaq" isRoot="false" isAbstract="false" name="uint" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="DcaQZXHCYAUY" isRoot="false" isAbstract="false" name="cp_sta_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="nnvOyvzkSE17" isRoot="false" isAbstract="false" name="u8" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="J5WdE6USg2qD" isRoot="false" isAbstract="false" name="u16" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="X7Q5Iud3fXPb" isRoot="false" isAbstract="false" name="u32" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="QPMsbNxuTUYh" isRoot="false" isAbstract="false" name="u64" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="TRzc3eNXqLr1" isRoot="false" isAbstract="false" name="cp_net_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Q4TYO2bRfXJq" isRoot="false" isAbstract="false" name="mac_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="RTeIWtKTDaZV" isRoot="false" isAbstract="false" name="cp_reassembly_ctx_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="yVCl3jm3PB1C" isRoot="false" isAbstract="false" name="cp_sta_own_data_t *" />
+ <UML:DataType stereotype="datatype" comment="This value is equal to 8 bytes." isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="sXqfrqwPid2x" isRoot="false" isAbstract="false" name="NPW_MIN_SIZE" />
+ <UML:DataType stereotype="datatype" comment="NPW max size. 64 bytes." isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ZsN7qO5uod0W" isRoot="false" isAbstract="false" name="NPW_MAX_SIZE" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="LyzcKuBtjfar" isRoot="false" isAbstract="false" name="u8 *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="2TKfUnESr7J6" isRoot="false" isAbstract="false" name="const u8 *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="bdvfq1CcRFQV" isRoot="false" isAbstract="false" name="const u8" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="cignRXiUIpXF" isRoot="false" isAbstract="false" name="cp_net_list_t *" elementReference="nyW3ZjsRDxWm" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="nyW3ZjsRDxWm" isRoot="false" isAbstract="false" name="undef" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="OF2Sin3o242W" isRoot="false" isAbstract="false" name="set_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="6agIp7Rg7jXE" isRoot="false" isAbstract="false" name="cp_sta_mgr_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="EhNquCdzHTzv" isRoot="false" isAbstract="false" name="cp_key_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="GXVTJzZt05VA" isRoot="false" isAbstract="false" name="cp_key_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="F0y42ZDGGZ49" isRoot="false" isAbstract="false" name="const cp_key_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="NMq7yPI15TF8" isRoot="false" isAbstract="false" name="const char" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="8MlMJZOa2gQQ" isRoot="false" isAbstract="false" name="const char *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="m7hYSy5qW7Uv" isRoot="false" isAbstract="false" name="cp_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="0mEev7QHu3Xw" isRoot="false" isAbstract="false" name="cp_snid_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="f1lxWwdNwvpr" isRoot="false" isAbstract="false" name="cp_nid_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="emAuInlIaxvV" isRoot="false" isAbstract="false" name="cp_tei_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="15653" isRoot="false" isAbstract="false" name="cp_mme_peer_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="12443" isRoot="false" isAbstract="false" name="list_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="21195" isRoot="false" isAbstract="false" name="const cp_key_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="33858" isRoot="false" isAbstract="false" name="set_t" />
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Class comment="Station own data." isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="dQQc692tOFUS" isRoot="false" isAbstract="false" name="cp_sta_own_data_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="station's TEI." isSpecification="false" visibility="private" xmi.id="hcbUh4JlIu5E" type="emAuInlIaxvV" name="tei" />
+ <UML:Attribute comment="Station's Mac address." isSpecification="false" visibility="private" xmi.id="MyhwT7zZG8oO" type="Q4TYO2bRfXJq" name="mac_addr" />
+ <UML:Attribute comment="Network Password, use by the station to crypt MMEs." isSpecification="false" visibility="private" xmi.id="x5HJsnaGxZDg" type="1lLAIoXrLdtJ" name="npw [NPW_MAX_SIZE + 1]" />
+ <UML:Attribute comment="AVLN's NMK." isSpecification="false" visibility="private" xmi.id="RrbeL3wI6BZy" type="EhNquCdzHTzv" name="nmk" />
+ <UML:Attribute comment="Device password." isSpecification="false" visibility="private" xmi.id="I16y7R8xSEes" type="1lLAIoXrLdtJ" name="dpw [DPW_MAX_SIZE + 1]" />
+ <UML:Attribute comment="Indicate if the station was CCo during the last use." isSpecification="false" visibility="private" xmi.id="VZjK8y2Pz9L4" type="BsXuVmQldfSS" name="was_cco" />
+ <UML:Attribute comment="Indicate if the station is CCo." isSpecification="false" visibility="private" xmi.id="20601" type="BsXuVmQldfSS" name="is_cco" />
+ <UML:Attribute comment="Security level. It can be changed by a specific message or by the HLE. See section 7.10.3.1.3 and section 13.3" isSpecification="false" visibility="private" xmi.id="0grlCK0Zd2kv" type="SsuRPlPUGZjG" name="security_level" />
+ <UML:Attribute comment="The PCO Glid." isSpecification="false" visibility="private" xmi.id="roOeP5mqSzsY" type="nnvOyvzkSE17" name="pco_glid" />
+ <UML:Attribute comment="Indicate if the station is authenticated or not." isSpecification="false" visibility="private" xmi.id="20651" type="1lLAIoXrLdtJ" name="authenticated" />
+ <UML:Attribute comment="The Station NID." isSpecification="false" visibility="private" xmi.id="20701" type="f1lxWwdNwvpr" name="nid" />
+ <UML:Attribute comment="The station SNID." isSpecification="false" visibility="private" xmi.id="20751" type="0mEev7QHu3Xw" name="snid" />
+ <UML:Attribute comment="Indicate if the station was CCo prefered." isSpecification="false" visibility="public" xmi.id="TO2c4YFuL4qQ" type="BsXuVmQldfSS" name="cco_prefered" />
+ <UML:Attribute comment="The user HFID." isSpecification="false" visibility="public" xmi.id="Rxzl1nBWMvpT" type="NMq7yPI15TF8" name="hfid_user [HFID_SIZE + 1]" />
+ <UML:Attribute comment="The manufacturer HFID." isSpecification="false" visibility="public" xmi.id="gBfRCRdglWVE" type="NMq7yPI15TF8" name="hfid_manufacturer [HFID_SIZE + 1]" />
+ <UML:Attribute comment="The AVLN HFID." isSpecification="false" visibility="public" xmi.id="3951" type="NMq7yPI15TF8" name="hfid_avln[HFID_SIZE + 1]" />
+ <UML:Attribute comment="Current hybrid mode." isSpecification="false" visibility="public" xmi.id="xAmypZKxOlvo" type="nnvOyvzkSE17" name="hybrid_mode" />
+ <UML:Attribute comment="The current snid being tracked for the ntb synchronization." isSpecification="false" visibility="public" xmi.id="919bTPKjqxKs" type="0mEev7QHu3Xw" name="snid_track" />
+ <UML:Attribute comment="The current nid being track for the ntb synchronization." isSpecification="false" visibility="public" xmi.id="MW7N3XqbJLli" type="f1lxWwdNwvpr" name="nid_track" />
+ <UML:Attribute comment="The PCo to discuss with." isSpecification="false" visibility="public" xmi.id="aTEnETRcBPSB" type="DcaQZXHCYAUY" name="pco" />
+ <UML:Operation comment="Initialise the station own data to default values." isSpecification="false" isLeaf="false" visibility="public" xmi.id="l9iApQ5k7p4V" isRoot="false" isAbstract="false" isQuery="false" name="init" />
+ <UML:Operation comment="Unitialise the station own data to default values." isSpecification="false" isLeaf="false" visibility="public" xmi.id="20899" isRoot="false" isAbstract="false" isQuery="false" name="uninit" />
+ <UML:Operation comment="Set the TEI of the station." isSpecification="false" isLeaf="false" visibility="public" xmi.id="PNzGVGMN7IZO" isRoot="false" isAbstract="false" isQuery="false" name="set_tei" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The the TEI station." isSpecification="false" visibility="private" xmi.id="IChxmt614D8Y" value="" type="emAuInlIaxvV" name="tei" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of the constante TEI." isSpecification="false" isLeaf="false" visibility="public" xmi.id="oS3q3CNSaLg5" isRoot="false" isAbstract="false" isQuery="false" name="get_tei" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36644" type="emAuInlIaxvV" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the station Mac address." isSpecification="false" isLeaf="false" visibility="public" xmi.id="9tv3PTcwJuk2" isRoot="false" isAbstract="false" isQuery="false" name="set_mac_address" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The Mac address of the station." isSpecification="false" visibility="private" xmi.id="GmJdTFwP5LIE" value="" type="Q4TYO2bRfXJq" name="mac_addr" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the station mac address." isSpecification="false" isLeaf="false" visibility="public" xmi.id="DbAcS8Pc1KdP" isRoot="false" isAbstract="false" isQuery="false" name="get_mac_address" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36645" type="Q4TYO2bRfXJq" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the Station NPW." isSpecification="false" isLeaf="false" visibility="public" xmi.id="lEJ2633MpMzJ" isRoot="false" isAbstract="false" isQuery="false" name="set_npw" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The new npw." isSpecification="false" visibility="private" xmi.id="99dfWsqi6SFH" value="" type="8MlMJZOa2gQQ" name="npw" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Return the pointer to the NPW as a constante data. The user shall call the set_npw function to modify the NPW." isSpecification="false" isLeaf="false" visibility="public" xmi.id="bLozAc1Tby5t" isRoot="false" isAbstract="false" isQuery="false" name="get_npw" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36646" type="8MlMJZOa2gQQ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the station NMK." isSpecification="false" isLeaf="false" visibility="public" xmi.id="QacAXGqLr88z" isRoot="false" isAbstract="false" isQuery="false" name="set_nmk" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The nmk to set." isSpecification="false" visibility="private" xmi.id="V67Yq0lvqWek" value="" type="21195" name="nmk" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the NMK of the AVLN." isSpecification="false" isLeaf="false" visibility="public" xmi.id="XBpdlbprByih" isRoot="false" isAbstract="false" isQuery="false" name="get_nmk" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36647" type="F0y42ZDGGZ49" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the device password." isSpecification="false" isLeaf="false" visibility="public" xmi.id="x2pgMFGxFwzE" isRoot="false" isAbstract="false" isQuery="false" name="set_dpw" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The new device password." isSpecification="false" visibility="private" xmi.id="K4OvTT41dteO" value="" type="8MlMJZOa2gQQ" name="dpw" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Return the Device password." isSpecification="false" isLeaf="false" visibility="public" xmi.id="YWiBOMZqmmSC" isRoot="false" isAbstract="false" isQuery="false" name="get_dpw" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36648" type="8MlMJZOa2gQQ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the security level. And send a message to the HLE." isSpecification="false" isLeaf="false" visibility="public" xmi.id="gkXbpZt9r3e4" isRoot="false" isAbstract="false" isQuery="false" name="set_security_level" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The security level." isSpecification="false" visibility="private" xmi.id="DPaRU282XpEv" value="" type="SsuRPlPUGZjG" name="sl" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Return the security level." isSpecification="false" isLeaf="false" visibility="public" xmi.id="Cgo2iS6vpgKJ" isRoot="false" isAbstract="false" isQuery="false" name="get_security_level" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36649" type="SsuRPlPUGZjG" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the CCo status of the station. It shall send a message to the Linux Driver." isSpecification="false" isLeaf="false" visibility="public" xmi.id="4vv3FEH8vlii" isRoot="false" isAbstract="false" isQuery="false" name="set_was_cco" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The current CCo status of the station." isSpecification="false" visibility="private" xmi.id="ZoePxqjuXWU6" value="" type="BsXuVmQldfSS" name="status" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the the CCo status of the station after a reboot." isSpecification="false" isLeaf="false" visibility="public" xmi.id="h933zRw1Mr2a" isRoot="false" isAbstract="false" isQuery="false" name="get_was_cco" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36650" type="BsXuVmQldfSS" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the HFID value." isSpecification="false" isLeaf="false" visibility="public" xmi.id="Z2pjniRb4U5p" isRoot="false" isAbstract="false" isQuery="false" name="set_hfid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The HFID to set (user or manufacturer)." isSpecification="false" visibility="private" xmi.id="EuSjWJa3LNm8" value="" type="8MlMJZOa2gQQ" name="hfid" />
+ <UML:Parameter comment="The new HFID value to set." isSpecification="false" visibility="private" xmi.id="VAPcPDExC4vS" value="" type="8MlMJZOa2gQQ" name="data" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set thenew User HFID in the station own data." isSpecification="false" isLeaf="false" visibility="public" xmi.id="6Di8flw9tLlH" isRoot="false" isAbstract="true" isQuery="false" name="set_hfid_user" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Set the new User HFID." isSpecification="false" visibility="private" xmi.id="YxEj17BGzexV" value="" type="8MlMJZOa2gQQ" name="data" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the new manufacturer HFID." isSpecification="false" isLeaf="false" visibility="public" xmi.id="xXWGuINyU377" isRoot="false" isAbstract="true" isQuery="false" name="set_hfid_manufacturer" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The new Manufacturer HFID." isSpecification="false" visibility="private" xmi.id="m3GgO0xwx9fz" value="" type="8MlMJZOa2gQQ" name="data" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the GLID to send proxy data." isSpecification="false" isLeaf="false" visibility="public" xmi.id="b2NRxvTAG4Im" isRoot="false" isAbstract="false" isQuery="false" name="set_pco_glid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The glid to use when a proxy beacon shall be sent." isSpecification="false" visibility="private" xmi.id="QRFWIDV91tnP" value="" type="nnvOyvzkSE17" name="glid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the PCO GLID." isSpecification="false" isLeaf="false" visibility="public" xmi.id="wXFOX5u66GX3" isRoot="false" isAbstract="false" isQuery="false" name="get_pco_glid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36651" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the PCO status." isSpecification="false" isLeaf="false" visibility="public" xmi.id="4DPM1C2ZHS5c" isRoot="false" isAbstract="false" isQuery="false" name="get_pco_status" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36652" type="BsXuVmQldfSS" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the PCO status." isSpecification="false" isLeaf="false" visibility="public" xmi.id="tS98bISnuM92" isRoot="false" isAbstract="false" isQuery="false" name="set_pco_status" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The PCO status." isSpecification="false" visibility="private" xmi.id="es20nPIqcgCb" value="" type="BsXuVmQldfSS" name="pco" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the CCo status of the station." isSpecification="false" isLeaf="false" visibility="public" xmi.id="21441" isRoot="false" isAbstract="false" isQuery="false" name="set_cco_status" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The status." isSpecification="false" visibility="private" xmi.id="21442" value="" type="BsXuVmQldfSS" name="cco" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the CCo status of the station." isSpecification="false" isLeaf="false" visibility="public" xmi.id="21541" isRoot="false" isAbstract="false" isQuery="false" name="get_cco_status" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36653" type="BsXuVmQldfSS" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the authenticated status." isSpecification="false" isLeaf="false" visibility="public" xmi.id="4536" isRoot="false" isAbstract="false" isQuery="false" name="set_authenticated_status" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The authenfication status." isSpecification="false" visibility="private" xmi.id="4537" value="" type="BsXuVmQldfSS" name="authenticated" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the authentication status." isSpecification="false" isLeaf="false" visibility="public" xmi.id="4636" isRoot="false" isAbstract="false" isQuery="false" name="get_authenticated_status" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36654" type="BsXuVmQldfSS" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Update the station NID." isSpecification="false" isLeaf="false" visibility="public" xmi.id="21592" isRoot="false" isAbstract="false" isQuery="false" name="set_nid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The station NID." isSpecification="false" visibility="private" xmi.id="21593" value="" type="f1lxWwdNwvpr" name="nid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the sstation NID." isSpecification="false" isLeaf="false" visibility="public" xmi.id="21694" isRoot="false" isAbstract="false" isQuery="false" name="get_nid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36655" type="f1lxWwdNwvpr" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Update the station SNID." isSpecification="false" isLeaf="false" visibility="public" xmi.id="21746" isRoot="false" isAbstract="false" isQuery="false" name="set_snid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The station NID." isSpecification="false" visibility="private" xmi.id="21747" value="" type="0mEev7QHu3Xw" name="snid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the station SNID." isSpecification="false" isLeaf="false" visibility="public" xmi.id="21851" isRoot="false" isAbstract="false" isQuery="false" name="get_snid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36656" type="0mEev7QHu3Xw" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="L2ASUCoHdFZ0" isRoot="false" isAbstract="false" name="cp_sta_mgr_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="List of released station. Use to keep the TEI and the connection to finalise the leave of the station." isSpecification="false" visibility="private" xmi.id="12890" type="12443" name="release_sta_list" />
+ <UML:Attribute comment="A set containing all the stations added to the station manager sorted by the mac addresses." isSpecification="false" visibility="private" xmi.id="33908" type="OF2Sin3o242W" name="stas" />
+ <UML:Operation comment="Add a AVLN to the manager list." isSpecification="false" isLeaf="false" visibility="public" xmi.id="QXnrJp4mc3nZ" isRoot="false" isAbstract="false" isQuery="false" name="add_avln" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36657" type="TRzc3eNXqLr1" />
+ <UML:Parameter comment="The AVLN's SNID to add." isSpecification="false" visibility="private" xmi.id="xXla9cfmTC0K" value="" type="0mEev7QHu3Xw" name="snid" />
+ <UML:Parameter comment="The AVLN's nid to add." isSpecification="false" visibility="private" xmi.id="Dq4iCYzb5lSM" value="" type="f1lxWwdNwvpr" name="nid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Remove an AVLN," isSpecification="false" isLeaf="false" visibility="public" xmi.id="bxBBvbAGs7Q5" isRoot="false" isAbstract="false" isQuery="false" name="remove_avln" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The AVLN's snid to remove." isSpecification="false" visibility="private" xmi.id="CwB2Bb8CvUZS" value="" type="0mEev7QHu3Xw" name="snid" />
+ <UML:Parameter comment="The AVLN's nid to remove." isSpecification="false" visibility="private" xmi.id="c8bNpTbQOlcJ" value="" type="f1lxWwdNwvpr" name="nid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get an AVLN from the net_list." isSpecification="false" isLeaf="false" visibility="public" xmi.id="vk7FSeQIaeIS" isRoot="false" isAbstract="false" isQuery="false" name="get_avln" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36658" type="TRzc3eNXqLr1" />
+ <UML:Parameter comment="The AVLN's snid to get." isSpecification="false" visibility="private" xmi.id="5KU6Vjz8WLNP" value="" type="0mEev7QHu3Xw" name="snid" />
+ <UML:Parameter comment="The AVLN's nid to get." isSpecification="false" visibility="private" xmi.id="Jy7i8GX3ycIR" value="" type="f1lxWwdNwvpr" name="nid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Initialise the sta manager." isSpecification="false" isLeaf="false" visibility="public" xmi.id="qHxkg2dtESUh" isRoot="false" isAbstract="false" isQuery="false" name="init" />
+ <UML:Operation comment="Uninitialise the sta manager." isSpecification="false" isLeaf="false" visibility="public" xmi.id="2gQknmKqTzYm" isRoot="false" isAbstract="false" isQuery="false" name="uninit" />
+ <UML:Operation comment="Lookup and return all the snids already in use in the different AVLN. The return data is a flag of 16 bits. The bit0 corresponds to the the snid 0, the bit1 to the snid 1 and so on." isSpecification="false" isLeaf="false" visibility="public" xmi.id="DC8mABArXbfX" isRoot="false" isAbstract="false" isQuery="false" name="get_present_snids" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36659" type="J5WdE6USg2qD" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Call all the sub garbage functions." isSpecification="false" isLeaf="false" visibility="public" xmi.id="MulJvMHR2JsJ" isRoot="false" isAbstract="false" isQuery="false" name="garbage" />
+ <UML:Operation comment="Returns a reference on our own station data." isSpecification="false" isLeaf="false" visibility="public" xmi.id="i2znmIk8bVQ3" isRoot="false" isAbstract="false" isQuery="false" name="get_sta_own_data" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36660" type="yVCl3jm3PB1C" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the network slot usage." isSpecification="false" isLeaf="false" visibility="public" xmi.id="o7bH8l102RHc" isRoot="false" isAbstract="false" isQuery="false" name="get_slot_usage" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36661" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the number of discovered stations." isSpecification="false" isLeaf="false" visibility="public" xmi.id="NDGrlwJSDY8B" isRoot="false" isAbstract="false" isQuery="false" name="get_num_discovered_sta" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36662" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the number of discovered networks." isSpecification="false" isLeaf="false" visibility="public" xmi.id="HwdXOmbaswch" isRoot="false" isAbstract="false" isQuery="false" name="get_num_discovered_net" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36663" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get our AVLN network." isSpecification="false" isLeaf="false" visibility="public" xmi.id="5SqO4seTjRSa" isRoot="false" isAbstract="false" isQuery="false" name="get_our_avln" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36664" type="TRzc3eNXqLr1" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set our network." isSpecification="false" isLeaf="false" visibility="public" xmi.id="7000" isRoot="false" isAbstract="false" isQuery="false" name="set_our_avln" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The network to be considered as our." isSpecification="false" visibility="private" xmi.id="7001" value="" type="TRzc3eNXqLr1" name="net" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Move the station to the release list." isSpecification="false" isLeaf="false" visibility="public" xmi.id="7802" isRoot="false" isAbstract="false" isQuery="false" name="release_station" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The station's TEI." isSpecification="false" visibility="private" xmi.id="7803" value="" type="emAuInlIaxvV" name="tei" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Add a station to the station manager." isSpecification="false" isLeaf="false" visibility="public" xmi.id="34154" isRoot="false" isAbstract="false" isQuery="false" name="sta_add" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The station's AVLN." isSpecification="false" visibility="private" xmi.id="34255" value="" type="TRzc3eNXqLr1" name="net" />
+ <UML:Parameter comment="The station TEI." isSpecification="false" visibility="private" xmi.id="34155" value="" type="emAuInlIaxvV" name="tei" />
+ <UML:Parameter comment="The station mac address." isSpecification="false" visibility="private" xmi.id="34205" value="" type="Q4TYO2bRfXJq" name="mac_addr" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Removes the station." isSpecification="false" isLeaf="false" visibility="public" xmi.id="34599" isRoot="false" isAbstract="false" isQuery="false" name="sta_remove" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The station to remove." isSpecification="false" visibility="private" xmi.id="34847" value="" type="DcaQZXHCYAUY" name="sta" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Remove a station from the net by its TEI." isSpecification="false" isLeaf="false" visibility="public" xmi.id="34897" isRoot="false" isAbstract="false" isQuery="false" name="sta_remove_assoc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The station's AVLN." isSpecification="false" visibility="private" xmi.id="34898" value="" type="TRzc3eNXqLr1" name="net" />
+ <UML:Parameter comment="The station's TEI." isSpecification="false" visibility="private" xmi.id="34948" value="" type="emAuInlIaxvV" name="tei" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Removes a station by its mac address.
+The commit to dataplane function shall be called if the station is in our AVLN." isSpecification="false" isLeaf="false" visibility="public" xmi.id="35047" isRoot="false" isAbstract="false" isQuery="false" name="sta_remove_from_mac" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The station mac address." isSpecification="false" visibility="private" xmi.id="35048" value="" type="Q4TYO2bRfXJq" name="mac_addr" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the associated station by its TEI in the net." isSpecification="false" isLeaf="false" visibility="public" xmi.id="35147" isRoot="false" isAbstract="false" isQuery="false" name="sta_get_assoc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36665" type="DcaQZXHCYAUY" />
+ <UML:Parameter comment="The station's Network." isSpecification="false" visibility="private" xmi.id="35148" value="" type="TRzc3eNXqLr1" name="net" />
+ <UML:Parameter comment="The station's TEI." isSpecification="false" visibility="private" xmi.id="35198" value="" type="emAuInlIaxvV" name="tei" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the station using its mac address.
+If no station found, NULL value returned." isSpecification="false" isLeaf="false" visibility="public" xmi.id="35298" isRoot="false" isAbstract="false" isQuery="false" name="sta_get_from_mac" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36666" type="DcaQZXHCYAUY" />
+ <UML:Parameter comment="The station's mac address." isSpecification="false" visibility="private" xmi.id="35299" value="" type="Q4TYO2bRfXJq" name="mac_addr" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Verify the net list status." isSpecification="false" isLeaf="false" visibility="public" xmi.id="35605" isRoot="false" isAbstract="false" isQuery="false" name="net_list_is_empty" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36667" type="BsXuVmQldfSS" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Commit the modification of our AVLN to the dataplane." isSpecification="false" isLeaf="false" visibility="public" xmi.id="35866" isRoot="false" isAbstract="false" isQuery="false" name="commit_to_dataplane" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="Control plane station." isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="tftTuiZXSv4R" isRoot="false" isAbstract="false" name="cp_sta_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="Station's tei." isSpecification="false" visibility="private" xmi.id="w2lpqlcRNBky" type="emAuInlIaxvV" name="tei" />
+ <UML:Attribute comment="Station's mac address." isSpecification="false" visibility="private" xmi.id="KjxDjNipVmH6" type="Q4TYO2bRfXJq" name="mac_address" />
+ <UML:Attribute comment="Indicate if the station is Visible by our station." isSpecification="false" visibility="private" xmi.id="nJw1e6ulB8mV" type="BsXuVmQldfSS" name="visible" />
+ <UML:Attribute comment="Indicate if the station is CCo." isSpecification="false" visibility="private" xmi.id="9SydFFh3ENAt" type="BsXuVmQldfSS" name="is_cco" />
+ <UML:Attribute comment="GLID provided to the PCO to transmit a proxy beacon." isSpecification="false" visibility="private" xmi.id="76E3M1i7iJGy" type="nnvOyvzkSE17" name="pco_glid" />
+ <UML:Attribute comment="Indicate the state of the station." isSpecification="false" visibility="private" xmi.id="njbBHkqZRmmB" type="pBzpcllJMdsq" name="station_state" />
+ <UML:Attribute comment="The network whithin the station is associatied." isSpecification="false" visibility="private" xmi.id="30115" type="TRzc3eNXqLr1" name="net" />
+ <UML:Attribute comment="Indicate if the station is Backup CCo." isSpecification="false" visibility="public" xmi.id="15VSrGbyiZbv" type="BsXuVmQldfSS" name="is_backup_cco" />
+ <UML:Attribute comment="Last date seen in the AVLN." isSpecification="false" visibility="public" xmi.id="7SdojrmkwHBl" type="oZHHg64PKBaq" name="last_seen_ms" />
+ <UML:Attribute comment="The Reassembly context for the cl_interf." isSpecification="false" visibility="public" xmi.id="61vH7gnD8O1s" type="RTeIWtKTDaZV" name="reassembly_ctx" />
+ <UML:Attribute comment="The tei expiration date." isSpecification="false" visibility="public" xmi.id="O3jgPKW1znfn" type="oZHHg64PKBaq" name="tei_lease_ms" />
+ <UML:Attribute comment="The station CCo capability." isSpecification="false" visibility="public" xmi.id="uZ2PRCIQqOal" type="nnvOyvzkSE17" name="cco_cap" />
+ <UML:Attribute comment="Indicate if the station can be PCo." isSpecification="false" visibility="public" xmi.id="SKPVcXpzB5Y4" type="BsXuVmQldfSS" name="pco_cap" />
+ <UML:Attribute comment="Indicate if the stations can be backup CCo." isSpecification="false" visibility="public" xmi.id="FcAqRxkJWmhw" type="BsXuVmQldfSS" name="backup_cco_cap" />
+ <UML:Attribute comment="Number of discover stations." isSpecification="false" visibility="public" xmi.id="R3na9McOwmEN" type="nnvOyvzkSE17" name="numDisSta" />
+ <UML:Attribute comment="Number of discover networks." isSpecification="false" visibility="public" xmi.id="jwhEhOAeLWRh" type="nnvOyvzkSE17" name="numDisNet" />
+ <UML:Attribute comment="The Average BLE." isSpecification="false" visibility="public" xmi.id="27448" type="nnvOyvzkSE17" name="average_ble" />
+ <UML:Operation comment="Return a station object initialised." isSpecification="false" isLeaf="false" visibility="private" xmi.id="AaNPCwE5GYpL" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36668" type="DcaQZXHCYAUY" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Uninitialise the station." isSpecification="false" isLeaf="false" visibility="private" xmi.id="1HLA3MQK09Yr" isRoot="false" isAbstract="false" isQuery="false" name="uninit" />
+ <UML:Operation comment="Get the station's TEI." isSpecification="false" isLeaf="false" visibility="public" xmi.id="BxTRzdcxFOCK" isRoot="false" isAbstract="false" isQuery="false" name="get_tei" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36669" type="emAuInlIaxvV" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the station's mac address." isSpecification="false" isLeaf="false" visibility="public" xmi.id="feEeHoZUCjo5" isRoot="false" isAbstract="false" isQuery="false" name="get_mac_address" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36670" type="Q4TYO2bRfXJq" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the station's cco status." isSpecification="false" isLeaf="false" visibility="public" xmi.id="MEr8fhvtbOQD" isRoot="false" isAbstract="false" isQuery="false" name="get_cco_status" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36671" type="BsXuVmQldfSS" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the Proxy CCo status of the station." isSpecification="false" isLeaf="false" visibility="public" xmi.id="aCtLsOAUOvwU" isRoot="false" isAbstract="false" isQuery="false" name="get_pco_status" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36672" type="BsXuVmQldfSS" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the visible status." isSpecification="false" isLeaf="false" visibility="public" xmi.id="28593" isRoot="false" isAbstract="false" isQuery="false" name="set_visible" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The visible status." isSpecification="false" visibility="private" xmi.id="28594" value="" type="7PSrs3lMwQVn" name="status" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the visible status of the station on the medium." isSpecification="false" isLeaf="false" visibility="public" xmi.id="OSlCnQfCxj2t" isRoot="false" isAbstract="false" isQuery="false" name="get_visible_status" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36673" type="7PSrs3lMwQVn" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Return the PCO GLID." isSpecification="false" isLeaf="false" visibility="public" xmi.id="H29zTi1CMn0S" isRoot="false" isAbstract="false" isQuery="false" name="get_pco_glid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36674" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the station GLID to use as PCO." isSpecification="false" isLeaf="false" visibility="public" xmi.id="xjmXt0pRpbh7" isRoot="false" isAbstract="false" isQuery="false" name="set_pco_glid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The station GLID." isSpecification="false" visibility="private" xmi.id="SNF25bArqwZ3" value="" type="nnvOyvzkSE17" name="glid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Fill peer structure with station TEI and MAC address." isSpecification="false" isLeaf="false" visibility="public" xmi.id="19160" isRoot="false" isAbstract="false" isQuery="false" name="get_peer" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="peer structure to fill." isSpecification="false" visibility="private" xmi.id="19161" value="" type="15653" name="peer" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the authenticated status." isSpecification="false" isLeaf="false" visibility="public" xmi.id="28699" isRoot="false" isAbstract="false" isQuery="false" name="set_authenticated" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The authentication status." isSpecification="false" visibility="private" xmi.id="28700" value="" type="BsXuVmQldfSS" name="auth" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Return the authenticated status of the station." isSpecification="false" isLeaf="false" visibility="public" xmi.id="28805" isRoot="false" isAbstract="false" isQuery="false" name="get_authenticated" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36675" type="BsXuVmQldfSS" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="QCdiA5hU9IAb" isRoot="false" isAbstract="false" name="cp_net_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="AVLN's SNID." isSpecification="false" visibility="private" xmi.id="9PZYdnDFOfZz" type="0mEev7QHu3Xw" name="snid" />
+ <UML:Attribute comment="AVLN's NID." isSpecification="false" visibility="private" xmi.id="I2w0DZg3Mq2z" type="f1lxWwdNwvpr" name="nid" />
+ <UML:Attribute comment="The pointer to the CCo station." isSpecification="false" visibility="private" xmi.id="HiveU00Ud1Ud" type="DcaQZXHCYAUY" name="cco" />
+ <UML:Attribute comment="the pointer to the Pco station." isSpecification="false" visibility="private" xmi.id="tVZmk23YSl2D" type="DcaQZXHCYAUY" name="pco" />
+ <UML:Attribute comment="The pointer to the UCCo." isSpecification="false" visibility="private" xmi.id="4144" type="DcaQZXHCYAUY" name="ucco" />
+ <UML:Attribute comment="The expiration date at the one this AVLN should be removed from the list. This will be verified in the garbage function." isSpecification="false" visibility="private" xmi.id="fU07vNLGT9Ie" type="oZHHg64PKBaq" name="expiration_ms" />
+ <UML:Attribute comment="The list of associated stations in the AVLN." isSpecification="false" visibility="private" xmi.id="bJPnIIOxkO2f" type="OF2Sin3o242W" name="associated_stas" />
+ <UML:Attribute comment="The list of unassociated stations in the AVLN." isSpecification="false" visibility="private" xmi.id="kNvDWBsghjTC" type="OF2Sin3o242W" name="unassociated_stas" />
+ <UML:Attribute comment="AVLN slot id." isSpecification="false" visibility="private" xmi.id="AqQWPXxzCapd" type="nnvOyvzkSE17" name="avln_slot_id" />
+ <UML:Attribute comment="The slot usage read in the AVLN's central beacon." isSpecification="false" visibility="private" xmi.id="p8FRmwBNLQgP" type="nnvOyvzkSE17" name="avln_slot_usage" />
+ <UML:Attribute comment="Number of visible stations in the AVLN, correspond to the station visible or discovered by the station." isSpecification="false" visibility="private" xmi.id="kr6KLUaiRjIH" type="nnvOyvzkSE17" name="num_visible_stas" />
+ <UML:Attribute comment="The number of stations contained in the network." isSpecification="false" visibility="private" xmi.id="0qvffRz2S8ru" type="nnvOyvzkSE17" name="num_stas" />
+ <UML:Attribute comment="The network mode." isSpecification="false" visibility="private" xmi.id="S6pIWhJZQV41" type="cxkkcPlqeSGi" name="network_mode" />
+ <UML:Attribute comment="Present flag" isSpecification="false" visibility="private" xmi.id="17196" type="BsXuVmQldfSS" name="present" />
+ <UML:Attribute comment="The access status of the Network." isSpecification="false" visibility="private" xmi.id="29018" type="27023" name="access" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="L8nWSpKOxfIH" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Indicate if it corresponds to the station's avln." isSpecification="false" visibility="private" xmi.id="GVgAWD6b5uCt" value="" type="BsXuVmQldfSS" name="station_avln" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Unitialise the network." isSpecification="false" isLeaf="false" visibility="public" xmi.id="025OblSx0TOi" isRoot="false" isAbstract="false" isQuery="false" name="uninit" />
+ <UML:Operation comment="Set the CCo in the Network list.
+Shall update the data bases." isSpecification="false" isLeaf="false" visibility="public" xmi.id="3UBqgc2KKU2C" isRoot="false" isAbstract="false" isQuery="false" name="set_cco" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The Station's TEI which is the CCo." isSpecification="false" visibility="private" xmi.id="tUrReG3DLDos" value="" type="emAuInlIaxvV" name="tei" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the CCo of this AVLN." isSpecification="false" isLeaf="false" visibility="public" xmi.id="3ABOLzFXlfcB" isRoot="false" isAbstract="false" isQuery="false" name="get_cco" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36676" type="DcaQZXHCYAUY" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the peer structure of the CCo of this AVLN." isSpecification="false" isLeaf="false" visibility="public" xmi.id="15942" isRoot="false" isAbstract="false" isQuery="false" name="get_cco_peer" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="peer structure pointer." isSpecification="false" visibility="private" xmi.id="15943" value="" type="15653" name="peer" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the PCo for this station." isSpecification="false" isLeaf="false" visibility="public" xmi.id="3tINqVucAXnG" isRoot="false" isAbstract="false" isQuery="false" name="set_pco" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="PCo's tei." isSpecification="false" visibility="private" xmi.id="nQGtNqOhHcnd" value="" type="emAuInlIaxvV" name="tei" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the PCo of the AVLN." isSpecification="false" isLeaf="false" visibility="public" xmi.id="iaLbV3XXwoul" isRoot="false" isAbstract="false" isQuery="false" name="get_pco" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36677" type="DcaQZXHCYAUY" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get eh perr structure of the PCo of the AVLN." isSpecification="false" isLeaf="false" visibility="public" xmi.id="16040" isRoot="false" isAbstract="false" isQuery="false" name="get_pco_peer" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Peer structure pointer." isSpecification="false" visibility="private" xmi.id="16041" value="" type="15653" name="peer" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Returns the first station of an AVLN. The user has the responsibility to release the reference on the returned station." isSpecification="false" isLeaf="false" visibility="public" xmi.id="W8rOQJZys2Nh" isRoot="false" isAbstract="false" isQuery="false" name="sta_get_first" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36678" type="DcaQZXHCYAUY" />
+ <UML:Parameter comment="to search in the associated stations or unassociated STAs." isSpecification="false" visibility="private" xmi.id="uegtnCaW6HvZ" value="" type="pBzpcllJMdsq" name="assoc" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the next station from the AVLN stating by the previous one already request. This function shall be call after get_first.
+The user have the responsibility to release the reference on both stations i.e. prev_sta and the returned sta." isSpecification="false" isLeaf="false" visibility="public" xmi.id="LSNW129OipWM" isRoot="false" isAbstract="false" isQuery="false" name="sta_get_next" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36679" type="DcaQZXHCYAUY" />
+ <UML:Parameter comment="The previous station requested." isSpecification="false" visibility="private" xmi.id="QpgFnJlzqGcm" value="" type="DcaQZXHCYAUY" name="prev_sta" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the network SNID." isSpecification="false" isLeaf="false" visibility="public" xmi.id="ihLtnkq61iHr" isRoot="false" isAbstract="false" isQuery="false" name="get_snid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36680" type="0mEev7QHu3Xw" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Garbage function for the unassociated station list and the associated station list." isSpecification="false" isLeaf="false" visibility="public" xmi.id="17437" isRoot="false" isAbstract="false" isQuery="false" name="garbage_stations" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The current date in milliseconds." isSpecification="false" visibility="private" xmi.id="17438" value="" type="X7Q5Iud3fXPb" name="date_ms" />
+ <UML:Parameter comment="The station status." isSpecification="false" visibility="private" xmi.id="17487" value="" type="pBzpcllJMdsq" name="assoc" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the AVLN NID." isSpecification="false" isLeaf="false" visibility="public" xmi.id="ljJ5Ao4US5yj" isRoot="false" isAbstract="false" isQuery="false" name="get_nid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36681" type="f1lxWwdNwvpr" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the AVLN slot id." isSpecification="false" isLeaf="false" visibility="public" xmi.id="Nsj0r8ybFTqj" isRoot="false" isAbstract="false" isQuery="false" name="set_slot_id_and_usage" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The AVLN Slot id." isSpecification="false" visibility="private" xmi.id="YBDZ7f07dRHq" value="" type="nnvOyvzkSE17" name="slot_id" />
+ <UML:Parameter comment="The slot usage mask." isSpecification="false" visibility="private" xmi.id="A9M6Rbk9UhsU" value="" type="nnvOyvzkSE17" name="slot_usage" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the slot identifier of the network." isSpecification="false" isLeaf="false" visibility="public" xmi.id="tXX7yCe6ABln" isRoot="false" isAbstract="false" isQuery="false" name="get_slot_id" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36682" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Return the slot usage mask of the AVLN read in the central beacon of the AVLN." isSpecification="false" isLeaf="false" visibility="public" xmi.id="po8WMv8qvmgP" isRoot="false" isAbstract="false" isQuery="false" name="get_slot_usage_mask" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36683" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the number of station discovered in this AVLN." isSpecification="false" isLeaf="false" visibility="public" xmi.id="eOkr2PyKZULL" isRoot="false" isAbstract="false" isQuery="false" name="get_num_discovered_stas" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36684" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the number of station of the AVLN." isSpecification="false" isLeaf="false" visibility="public" xmi.id="pq6Gp6gvxZjX" isRoot="false" isAbstract="false" isQuery="false" name="get_num_stas" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36685" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the current network mode of the network." isSpecification="false" isLeaf="false" visibility="public" xmi.id="EQSO9Nrh7vtl" isRoot="false" isAbstract="false" isQuery="false" name="set_nm" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The current network mode of the network." isSpecification="false" visibility="private" xmi.id="0k5Hjgz6Os8M" value="" type="cxkkcPlqeSGi" name="nm" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the current network mode of the AVLN." isSpecification="false" isLeaf="false" visibility="public" xmi.id="z1wK2LaEl0as" isRoot="false" isAbstract="false" isQuery="false" name="get_nm" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36686" type="cxkkcPlqeSGi" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the status of the network." isSpecification="false" isLeaf="false" visibility="public" xmi.id="16667" isRoot="false" isAbstract="false" isQuery="false" name="is_empty" />
+ <UML:Operation comment="Set the UCCo of the AVLN." isSpecification="false" isLeaf="false" visibility="public" xmi.id="16715" isRoot="false" isAbstract="false" isQuery="false" name="set_ucco" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The sation which is Ucco." isSpecification="false" visibility="private" xmi.id="16716" value="" type="DcaQZXHCYAUY" name="sta" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the UCCo of the AVLN." isSpecification="false" isLeaf="false" visibility="public" xmi.id="16811" isRoot="false" isAbstract="false" isQuery="false" name="get_ucco" />
+ <UML:Operation comment="Set the access of the AVLN," isSpecification="false" isLeaf="false" visibility="public" xmi.id="29723" isRoot="false" isAbstract="false" isQuery="false" name="set_access" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The access state of the station." isSpecification="false" visibility="private" xmi.id="29724" value="" type="27023" name="access" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the access type of the AVLN." isSpecification="false" isLeaf="false" visibility="public" xmi.id="29869" isRoot="false" isAbstract="false" isQuery="false" name="get_access" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36687" type="27023" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="qIWnFzBd9oKJ" isRoot="false" isAbstract="false" name="cp_net_list_t" >
+ <UML:Classifier.feature>
+ <UML:Operation comment="Inititliase the network list." isSpecification="false" isLeaf="false" visibility="public" xmi.id="Qd9Ie0K9YadK" isRoot="false" isAbstract="false" isQuery="false" name="init" />
+ <UML:Operation comment="Unitialise the network list." isSpecification="false" isLeaf="false" visibility="public" xmi.id="fhhadu0Xv5sq" isRoot="false" isAbstract="false" isQuery="false" name="uninit" />
+ <UML:Operation comment="Calls the sub modules garbage to remove old data." isSpecification="false" isLeaf="false" visibility="public" xmi.id="qF2AzTzTvsRh" isRoot="false" isAbstract="false" isQuery="false" name="garbage_net" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The current date in milliseconds." isSpecification="false" visibility="private" xmi.id="YBhJPHujWWR7" value="" type="X7Q5Iud3fXPb" name="date_ms" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Add an AVLN to the list." isSpecification="false" isLeaf="false" visibility="public" xmi.id="dvGudEhkvNbD" isRoot="false" isAbstract="false" isQuery="false" name="add_avln" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36688" type="TRzc3eNXqLr1" />
+ <UML:Parameter comment="The AVLN's SNID to add." isSpecification="false" visibility="private" xmi.id="k5UOGYbYkzwv" value="" type="0mEev7QHu3Xw" name="snid" />
+ <UML:Parameter comment="The AVLN's NID to add." isSpecification="false" visibility="private" xmi.id="WkkbSbh3Uxx8" value="" type="f1lxWwdNwvpr" name="nid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Removes an AVLN from the sta manager." isSpecification="false" isLeaf="false" visibility="public" xmi.id="Ads5yTHiXj5l" isRoot="false" isAbstract="false" isQuery="false" name="remove_avln" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The AVLN's SNID to remove." isSpecification="false" visibility="private" xmi.id="FgKxfGs90bkR" value="" type="0mEev7QHu3Xw" name="snid" />
+ <UML:Parameter comment="The AVLN's NID to remove." isSpecification="false" visibility="private" xmi.id="5rhaamLoQfl3" value="" type="f1lxWwdNwvpr" name="nid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Returns the AVLN corresponding to the snid and nid." isSpecification="false" isLeaf="false" visibility="public" xmi.id="vcDuDxLNPn0k" isRoot="false" isAbstract="false" isQuery="false" name="get_avln" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36689" type="TRzc3eNXqLr1" />
+ <UML:Parameter comment="The AVLN's snid to get." isSpecification="false" visibility="private" xmi.id="DlHEPrDSht2F" value="" type="0mEev7QHu3Xw" name="snid" />
+ <UML:Parameter comment="The AVLN's NID to get." isSpecification="false" visibility="private" xmi.id="dN341p7uPKoa" value="" type="f1lxWwdNwvpr" name="nid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Verify if the network list is empty and return true if it is." isSpecification="false" isLeaf="false" visibility="public" xmi.id="thTkEhFFV82W" isRoot="false" isAbstract="false" isQuery="false" name="is_empty" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36690" type="BsXuVmQldfSS" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Create a 16 bits flag indicating which SNID are in use." isSpecification="false" isLeaf="false" visibility="public" xmi.id="fEG2VdimBUrx" isRoot="false" isAbstract="false" isQuery="false" name="get_snid_present" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36691" type="J5WdE6USg2qD" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the slot usage of the AVLNs computed on the slots IDs of each AVLN present.
+It corresponds to a 8 bits field." isSpecification="false" isLeaf="false" visibility="public" xmi.id="dEIri7aEIlnP" isRoot="false" isAbstract="false" isQuery="false" name="get_slot_usage" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36692" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the number of discovered station on all AVLNs." isSpecification="false" isLeaf="false" visibility="public" xmi.id="0swcx8FCE83L" isRoot="false" isAbstract="false" isQuery="false" name="get_num_discover_stas" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36693" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the quantity of network discovered." isSpecification="false" isLeaf="false" visibility="public" xmi.id="iz4t8GAcZAqw" isRoot="false" isAbstract="false" isQuery="false" name="get_num_discovered_net" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36694" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="pBzpcllJMdsq" isRoot="false" isAbstract="false" name="cp_net_sta_status_t" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="pBzpcllJMdsq" xmi.id="AYBjv2FiBCYl" isRoot="false" isAbstract="false" name="UNASSOC" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="pBzpcllJMdsq" xmi.id="TS9huSQ4zbmu" isRoot="false" isAbstract="false" name="ASSOCIATED" />
+ </UML:Enumeration>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="SsuRPlPUGZjG" isRoot="false" isAbstract="false" name="cp_security_level_t" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="SsuRPlPUGZjG" xmi.id="YGOeDlDfb740" isRoot="false" isAbstract="false" name="CP_SECURITY_LEVEL_SC" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="SsuRPlPUGZjG" xmi.id="8rMiHZwnqIP3" isRoot="false" isAbstract="false" name="CP_SECURITY_LEVEL_HS" />
+ </UML:Enumeration>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="cxkkcPlqeSGi" isRoot="false" isAbstract="false" name="cp_net_network_mode_t" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="cxkkcPlqeSGi" xmi.id="7AfLHTarQIb0" isRoot="false" isAbstract="false" name="CP_NET_NM_UNCOORDINATED" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="cxkkcPlqeSGi" xmi.id="1IbnbOCiWr4l" isRoot="false" isAbstract="false" name="CP_NET_NM_COORDINATED" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="cxkkcPlqeSGi" xmi.id="UsJ25EL4Uwr6" isRoot="false" isAbstract="false" name="CP_NET_NM_CSMA_ONLY" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="cxkkcPlqeSGi" xmi.id="MWptygBQWUQa" isRoot="false" isAbstract="false" name="CP_NET_NM_ASSERT" />
+ </UML:Enumeration>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="7PSrs3lMwQVn" isRoot="false" isAbstract="false" name="cp_sta_visible_state_t" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="7PSrs3lMwQVn" xmi.id="200XB2ebUTRX" isRoot="false" isAbstract="false" name="CP_STA_VISIBLE_STATE_HIDDEN" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="7PSrs3lMwQVn" xmi.id="v7wHq2ss2qNB" isRoot="false" isAbstract="false" name="CP_STA_VISIBLE_STATE_VISIBLE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="7PSrs3lMwQVn" xmi.id="VkDZ8Ke4QYJG" isRoot="false" isAbstract="false" name="CP_STA_VISIBLE_STATE_ASSERT" />
+ </UML:Enumeration>
+ <UML:Package stereotype="2" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="rLUcIo7kRV6u" isRoot="false" isAbstract="false" name="sequences" >
+ <UML:Namespace.ownedElement/>
+ </UML:Package>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="22789" isRoot="false" isAbstract="false" name="sta_mgr" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="22946" isRoot="false" isAbstract="false" name="net_list" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="22999" isRoot="false" isAbstract="false" name="sta_own_data" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="23052" isRoot="false" isAbstract="false" name="net" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="23105" isRoot="false" isAbstract="false" name="sta" />
+ <UML:Package stereotype="2" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="25613" isRoot="false" isAbstract="false" name="Classes" >
+ <UML:Namespace.ownedElement/>
+ <XMI.extension xmi.extender="umbrello" >
+ <diagrams>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="972" snapy="10" showatts="1" xmi.id="25666" documentation="" type="1" showops="1" showpackage="0" name="manager" localid="900000" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="842" >
+ <widgets>
+ <classwidget usesdiagramfillcolour="0" width="352" showattsigs="601" usesdiagramusefillcolour="0" x="201" y="76" showopsigs="601" linewidth="none" fillcolour="#ffffc0" height="375" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="L2ASUCoHdFZ0" showoperations="1" showpackage="0" showscope="1" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages/>
+ <associations/>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="972" snapy="10" showatts="1" xmi.id="25979" documentation="" type="1" showops="1" showpackage="0" name="own_data" localid="900000" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="842" >
+ <widgets>
+ <classwidget usesdiagramfillcolour="1" width="296" showattsigs="601" usesdiagramusefillcolour="1" x="281" y="19" showopsigs="601" linewidth="none" fillcolour="none" height="780" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="dQQc692tOFUS" showoperations="1" showpackage="0" showscope="1" font="Sans Serif,9,-1,5,50,1,0,0,0,0" linecolor="none" />
+ </widgets>
+ <messages/>
+ <associations/>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="972" snapy="10" showatts="1" xmi.id="26240" documentation="" type="1" showops="1" showpackage="0" name="net_list" localid="900000" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="842" >
+ <widgets>
+ <classwidget usesdiagramfillcolour="1" width="324" showattsigs="601" usesdiagramusefillcolour="1" x="250" y="177" showopsigs="601" linewidth="none" fillcolour="none" height="187" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="qIWnFzBd9oKJ" showoperations="1" showpackage="0" showscope="1" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="none" />
+ </widgets>
+ <messages/>
+ <associations/>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="972" snapy="10" showatts="1" xmi.id="26501" documentation="" type="1" showops="1" showpackage="0" name="net" localid="900000" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="842" >
+ <widgets>
+ <classwidget usesdiagramfillcolour="0" width="397" showattsigs="601" usesdiagramusefillcolour="0" x="179" y="30" showopsigs="601" linewidth="none" fillcolour="#ffffc0" height="615" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="QCdiA5hU9IAb" showoperations="1" showpackage="0" showscope="1" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages/>
+ <associations/>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="972" snapy="10" showatts="1" xmi.id="26710" documentation="" type="1" showops="1" showpackage="0" name="sta" localid="900000" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="842" >
+ <widgets>
+ <classwidget usesdiagramfillcolour="0" width="271" showattsigs="601" usesdiagramusefillcolour="0" x="317" y="139" showopsigs="601" linewidth="none" fillcolour="#ffffc0" height="465" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="tftTuiZXSv4R" showoperations="1" showpackage="0" showscope="1" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages/>
+ <associations/>
+ </diagram>
+ </diagrams>
+ </XMI.extension>
+ </UML:Package>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="27023" isRoot="false" isAbstract="false" name="hpav_access_t" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="27023" xmi.id="27076" isRoot="false" isAbstract="false" name="HPAV_IN_HOME" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="27023" xmi.id="27129" isRoot="false" isAbstract="false" name="HPAV_ACCESS" />
+ </UML:Enumeration>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="BzDeGrof35i3" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="lQBEo3VLdIiB" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="yIVQyeIGHNsQ" aggregation="none" type="QCdiA5hU9IAb" name="" multiplicity="8" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="DWwHbcINxulG" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="L3waWG7FgHRS" aggregation="aggregate" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="KwlxER9BkcZg" aggregation="none" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="UODsawo5TGgC" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="EqxWDnuWpq6J" aggregation="aggregate" type="QCdiA5hU9IAb" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="4BZiS08nxui9" aggregation="none" type="tftTuiZXSv4R" name="" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="c6v3mGeXVqXR" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="LpI3SskggfAt" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="S4PFsTZuc8c5" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="T1xzpUO46GR3" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="8lq3fWDyKT2m" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="LkQ1PZspdF5U" aggregation="none" type="tftTuiZXSv4R" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="rvcDZX0ujXxy" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="g5L0YLks59tS" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ikIJzLnexCvh" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5IZpnXnsVu7G" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="BHXvPRI3Ud43" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="zmv2vmVbWlvU" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5eDSOP8QymCv" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="6i63s1i3IFyh" aggregation="composite" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="fGk9smCpX5rQ" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="10345" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="10346" aggregation="composite" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="10347" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="BzDeGrof35i3" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="lQBEo3VLdIiB" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="yIVQyeIGHNsQ" aggregation="none" type="QCdiA5hU9IAb" name="" multiplicity="8" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="DWwHbcINxulG" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="L3waWG7FgHRS" aggregation="aggregate" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="KwlxER9BkcZg" aggregation="none" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="UODsawo5TGgC" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="EqxWDnuWpq6J" aggregation="aggregate" type="QCdiA5hU9IAb" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="4BZiS08nxui9" aggregation="none" type="tftTuiZXSv4R" name="" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="c6v3mGeXVqXR" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="LpI3SskggfAt" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="S4PFsTZuc8c5" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="T1xzpUO46GR3" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="8lq3fWDyKT2m" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="LkQ1PZspdF5U" aggregation="none" type="tftTuiZXSv4R" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="rvcDZX0ujXxy" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="g5L0YLks59tS" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ikIJzLnexCvh" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5IZpnXnsVu7G" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="BHXvPRI3Ud43" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="zmv2vmVbWlvU" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5eDSOP8QymCv" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="6i63s1i3IFyh" aggregation="composite" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="fGk9smCpX5rQ" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="10345" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="10346" aggregation="composite" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="10347" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="12189" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="12190" aggregation="composite" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="12191" aggregation="none" type="dQQc692tOFUS" name="sta_own_data" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="13891" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="13892" aggregation="composite" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="13893" aggregation="none" type="qIWnFzBd9oKJ" name="network_list" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="14924" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="14925" aggregation="composite" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="14926" aggregation="none" type="QCdiA5hU9IAb" name="networks" multiplicity="8" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="18563" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="18564" aggregation="none" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="18565" aggregation="none" type="QCdiA5hU9IAb" name="our_net" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="BzDeGrof35i3" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="lQBEo3VLdIiB" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="yIVQyeIGHNsQ" aggregation="none" type="QCdiA5hU9IAb" name="" multiplicity="8" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="DWwHbcINxulG" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="L3waWG7FgHRS" aggregation="aggregate" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="KwlxER9BkcZg" aggregation="none" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="UODsawo5TGgC" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="EqxWDnuWpq6J" aggregation="aggregate" type="QCdiA5hU9IAb" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="4BZiS08nxui9" aggregation="none" type="tftTuiZXSv4R" name="" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="c6v3mGeXVqXR" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="LpI3SskggfAt" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="S4PFsTZuc8c5" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="T1xzpUO46GR3" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="8lq3fWDyKT2m" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="LkQ1PZspdF5U" aggregation="none" type="tftTuiZXSv4R" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="rvcDZX0ujXxy" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="g5L0YLks59tS" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ikIJzLnexCvh" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5IZpnXnsVu7G" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="BHXvPRI3Ud43" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="zmv2vmVbWlvU" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5eDSOP8QymCv" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="6i63s1i3IFyh" aggregation="composite" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="fGk9smCpX5rQ" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="10345" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="10346" aggregation="composite" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="10347" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="BzDeGrof35i3" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="lQBEo3VLdIiB" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="yIVQyeIGHNsQ" aggregation="none" type="QCdiA5hU9IAb" name="" multiplicity="8" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="DWwHbcINxulG" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="L3waWG7FgHRS" aggregation="aggregate" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="KwlxER9BkcZg" aggregation="none" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="UODsawo5TGgC" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="EqxWDnuWpq6J" aggregation="aggregate" type="QCdiA5hU9IAb" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="4BZiS08nxui9" aggregation="none" type="tftTuiZXSv4R" name="" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="c6v3mGeXVqXR" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="LpI3SskggfAt" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="S4PFsTZuc8c5" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="T1xzpUO46GR3" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="8lq3fWDyKT2m" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="LkQ1PZspdF5U" aggregation="none" type="tftTuiZXSv4R" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="rvcDZX0ujXxy" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="g5L0YLks59tS" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ikIJzLnexCvh" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5IZpnXnsVu7G" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="BHXvPRI3Ud43" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="zmv2vmVbWlvU" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5eDSOP8QymCv" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="6i63s1i3IFyh" aggregation="composite" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="fGk9smCpX5rQ" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="10345" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="10346" aggregation="composite" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="10347" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="12189" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="12190" aggregation="composite" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="12191" aggregation="none" type="dQQc692tOFUS" name="sta_own_data" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="13891" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="13892" aggregation="composite" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="13893" aggregation="none" type="qIWnFzBd9oKJ" name="network_list" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="14924" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="14925" aggregation="composite" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="14926" aggregation="none" type="QCdiA5hU9IAb" name="networks" multiplicity="8" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="18563" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="18564" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="18565" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="19407" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="19408" aggregation="aggregate" type="QCdiA5hU9IAb" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="19409" aggregation="none" type="tftTuiZXSv4R" name="associated_stas" multiplicity="254" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="19563" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="19564" aggregation="aggregate" type="QCdiA5hU9IAb" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="19565" aggregation="none" type="tftTuiZXSv4R" name="unassociated_stas" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="23366" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="23367" aggregation="composite" type="22789" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="23368" aggregation="none" type="22946" name="network_list" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="23473" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="23474" aggregation="composite" type="22789" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="23475" aggregation="none" type="22999" name="sta_own_data" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="23580" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="23581" aggregation="composite" type="22946" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="23582" aggregation="none" type="23052" name="networks" multiplicity="8" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="23687" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="23688" aggregation="aggregate" type="23052" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="23689" aggregation="none" type="23105" name="associated_stas" multiplicity="254" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="24650" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="24651" aggregation="aggregate" type="23052" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="24652" aggregation="none" type="23105" name="unassociated_stas" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="24913" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="24914" aggregation="composite" type="22946" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="24915" aggregation="none" type="23052" name="networks" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="25292" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="25293" aggregation="aggregate" type="23052" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="25294" aggregation="none" type="23105" name="associated_stas" multiplicity="254" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="BzDeGrof35i3" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="lQBEo3VLdIiB" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="yIVQyeIGHNsQ" aggregation="none" type="QCdiA5hU9IAb" name="" multiplicity="8" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="DWwHbcINxulG" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="L3waWG7FgHRS" aggregation="aggregate" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="KwlxER9BkcZg" aggregation="none" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="UODsawo5TGgC" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="EqxWDnuWpq6J" aggregation="aggregate" type="QCdiA5hU9IAb" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="4BZiS08nxui9" aggregation="none" type="tftTuiZXSv4R" name="" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="c6v3mGeXVqXR" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="LpI3SskggfAt" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="S4PFsTZuc8c5" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="T1xzpUO46GR3" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="8lq3fWDyKT2m" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="LkQ1PZspdF5U" aggregation="none" type="tftTuiZXSv4R" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="rvcDZX0ujXxy" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="g5L0YLks59tS" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ikIJzLnexCvh" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5IZpnXnsVu7G" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="BHXvPRI3Ud43" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="zmv2vmVbWlvU" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5eDSOP8QymCv" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="6i63s1i3IFyh" aggregation="composite" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="fGk9smCpX5rQ" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="10345" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="10346" aggregation="composite" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="10347" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="BzDeGrof35i3" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="lQBEo3VLdIiB" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="yIVQyeIGHNsQ" aggregation="none" type="QCdiA5hU9IAb" name="" multiplicity="8" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="DWwHbcINxulG" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="L3waWG7FgHRS" aggregation="aggregate" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="KwlxER9BkcZg" aggregation="none" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="UODsawo5TGgC" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="EqxWDnuWpq6J" aggregation="aggregate" type="QCdiA5hU9IAb" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="4BZiS08nxui9" aggregation="none" type="tftTuiZXSv4R" name="" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="c6v3mGeXVqXR" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="LpI3SskggfAt" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="S4PFsTZuc8c5" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="T1xzpUO46GR3" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="8lq3fWDyKT2m" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="LkQ1PZspdF5U" aggregation="none" type="tftTuiZXSv4R" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="rvcDZX0ujXxy" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="g5L0YLks59tS" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ikIJzLnexCvh" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5IZpnXnsVu7G" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="BHXvPRI3Ud43" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="zmv2vmVbWlvU" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5eDSOP8QymCv" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="6i63s1i3IFyh" aggregation="composite" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="fGk9smCpX5rQ" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="10345" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="10346" aggregation="composite" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="10347" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="12189" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="12190" aggregation="composite" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="12191" aggregation="none" type="dQQc692tOFUS" name="sta_own_data" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="13891" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="13892" aggregation="composite" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="13893" aggregation="none" type="qIWnFzBd9oKJ" name="network_list" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="14924" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="14925" aggregation="composite" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="14926" aggregation="none" type="QCdiA5hU9IAb" name="networks" multiplicity="8" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="18563" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="18564" aggregation="none" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="18565" aggregation="none" type="QCdiA5hU9IAb" name="our_net" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="BzDeGrof35i3" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="lQBEo3VLdIiB" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="yIVQyeIGHNsQ" aggregation="none" type="QCdiA5hU9IAb" name="" multiplicity="8" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="DWwHbcINxulG" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="L3waWG7FgHRS" aggregation="aggregate" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="KwlxER9BkcZg" aggregation="none" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="UODsawo5TGgC" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="EqxWDnuWpq6J" aggregation="aggregate" type="QCdiA5hU9IAb" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="4BZiS08nxui9" aggregation="none" type="tftTuiZXSv4R" name="" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="c6v3mGeXVqXR" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="LpI3SskggfAt" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="S4PFsTZuc8c5" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="T1xzpUO46GR3" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="8lq3fWDyKT2m" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="LkQ1PZspdF5U" aggregation="none" type="tftTuiZXSv4R" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="rvcDZX0ujXxy" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="g5L0YLks59tS" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ikIJzLnexCvh" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5IZpnXnsVu7G" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="BHXvPRI3Ud43" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="zmv2vmVbWlvU" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5eDSOP8QymCv" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="6i63s1i3IFyh" aggregation="composite" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="fGk9smCpX5rQ" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="10345" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="10346" aggregation="composite" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="10347" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="BzDeGrof35i3" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="lQBEo3VLdIiB" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="yIVQyeIGHNsQ" aggregation="none" type="QCdiA5hU9IAb" name="" multiplicity="8" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="DWwHbcINxulG" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="L3waWG7FgHRS" aggregation="aggregate" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="KwlxER9BkcZg" aggregation="none" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="UODsawo5TGgC" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="EqxWDnuWpq6J" aggregation="aggregate" type="QCdiA5hU9IAb" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="4BZiS08nxui9" aggregation="none" type="tftTuiZXSv4R" name="" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="c6v3mGeXVqXR" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="LpI3SskggfAt" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="S4PFsTZuc8c5" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="T1xzpUO46GR3" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="8lq3fWDyKT2m" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="LkQ1PZspdF5U" aggregation="none" type="tftTuiZXSv4R" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="rvcDZX0ujXxy" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="g5L0YLks59tS" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ikIJzLnexCvh" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5IZpnXnsVu7G" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="BHXvPRI3Ud43" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="zmv2vmVbWlvU" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5eDSOP8QymCv" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="6i63s1i3IFyh" aggregation="composite" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="fGk9smCpX5rQ" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="10345" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="10346" aggregation="composite" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="10347" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="12189" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="12190" aggregation="composite" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="12191" aggregation="none" type="dQQc692tOFUS" name="sta_own_data" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="13891" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="13892" aggregation="composite" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="13893" aggregation="none" type="qIWnFzBd9oKJ" name="network_list" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="14924" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="14925" aggregation="composite" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="14926" aggregation="none" type="QCdiA5hU9IAb" name="networks" multiplicity="8" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="18563" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="18564" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="18565" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="19407" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="19408" aggregation="aggregate" type="QCdiA5hU9IAb" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="19409" aggregation="none" type="tftTuiZXSv4R" name="associated_stas" multiplicity="254" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="19563" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="19564" aggregation="aggregate" type="QCdiA5hU9IAb" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="19565" aggregation="none" type="tftTuiZXSv4R" name="unassociated_stas" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="23366" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="23367" aggregation="composite" type="22789" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="23368" aggregation="none" type="22946" name="network_list" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="23473" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="23474" aggregation="composite" type="22789" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="23475" aggregation="none" type="22999" name="sta_own_data" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="23580" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="23581" aggregation="composite" type="22946" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="23582" aggregation="none" type="23052" name="networks" multiplicity="8" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="23687" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="23688" aggregation="aggregate" type="23052" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="23689" aggregation="none" type="23105" name="associated_stas" multiplicity="254" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="24650" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="24651" aggregation="aggregate" type="23052" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="24652" aggregation="none" type="23105" name="unassociated_stas" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="24913" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="24914" aggregation="composite" type="22946" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="24915" aggregation="none" type="23052" name="networks" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="25292" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="25293" aggregation="aggregate" type="23052" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="25294" aggregation="none" type="23105" name="associated_stas" multiplicity="254" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="32027" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="32028" aggregation="aggregate" type="22789" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="32029" aggregation="none" type="23105" name="stas" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="32575" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="32576" aggregation="none" type="23105" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="private" changeability="changeable" isNavigable="true" xmi.id="32577" aggregation="none" type="23052" name="net" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ </UML:Namespace.ownedElement>
+ <XMI.extension xmi.extender="umbrello" >
+ <diagrams>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="972" snapy="10" showatts="1" xmi.id="22684" documentation="" type="1" showops="1" showpackage="0" name="Package_class" localid="900000" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="842" >
+ <widgets>
+ <classwidget usesdiagramfillcolour="0" width="71" showattsigs="601" usesdiagramusefillcolour="0" x="402" y="86" showopsigs="601" linewidth="none" fillcolour="#ffffc0" height="29" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="22789" showoperations="1" showpackage="0" showscope="1" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolour="1" width="57" showattsigs="601" usesdiagramusefillcolour="1" x="275" y="170" showopsigs="601" linewidth="none" fillcolour="none" height="29" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="22946" showoperations="1" showpackage="0" showscope="1" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="none" />
+ <classwidget usesdiagramfillcolour="1" width="98" showattsigs="601" usesdiagramusefillcolour="1" x="552" y="173" showopsigs="601" linewidth="none" fillcolour="none" height="29" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="22999" showoperations="1" showpackage="0" showscope="1" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="none" />
+ <classwidget usesdiagramfillcolour="1" width="32" showattsigs="601" usesdiagramusefillcolour="1" x="458" y="271" showopsigs="601" linewidth="none" fillcolour="none" height="32" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="23052" showoperations="1" showpackage="0" showscope="1" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="none" />
+ <classwidget usesdiagramfillcolour="1" width="30" showattsigs="601" usesdiagramusefillcolour="1" x="459" y="378" showopsigs="601" linewidth="none" fillcolour="none" height="29" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="23105" showoperations="1" showpackage="0" showscope="1" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="none" />
+ </widgets>
+ <messages/>
+ <associations>
+ <assocwidget totalcounta="3" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="22946" widgetaid="22789" xmi.id="23366" linecolor="none" >
+ <linepath>
+ <startpoint startx="425" starty="115" />
+ <endpoint endx="303" endy="170" />
+ </linepath>
+ <floatingtext usesdiagramfillcolour="1" width="32" usesdiagramusefillcolour="1" x="411" y="115" linewidth="none" posttext="" role="701" fillcolour="none" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="209" showstereotype="1" text="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolour="1" width="32" usesdiagramusefillcolour="1" x="284" y="138" linewidth="none" posttext="" role="702" fillcolour="none" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="210" showstereotype="1" text="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolour="1" width="85" usesdiagramusefillcolour="1" x="305" y="149" linewidth="none" posttext="" role="710" fillcolour="none" height="19" usefillcolor="1" pretext="-" isinstance="0" xmi.id="209" showstereotype="1" text="network_list" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="2" totalcountb="2" indexb="1" linewidth="none" widgetbid="22999" widgetaid="22789" xmi.id="23473" linecolor="none" >
+ <linepath>
+ <startpoint startx="449" starty="115" />
+ <endpoint endx="601" endy="173" />
+ </linepath>
+ <floatingtext usesdiagramfillcolour="1" width="32" usesdiagramusefillcolour="1" x="431" y="115" linewidth="none" posttext="" role="701" fillcolour="none" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="212" text="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolour="1" width="32" usesdiagramusefillcolour="1" x="587" y="140" linewidth="none" posttext="" role="702" fillcolour="none" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="213" showstereotype="1" text="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolour="1" width="95" usesdiagramusefillcolour="1" x="504" y="152" linewidth="none" posttext="" role="710" fillcolour="none" height="19" usefillcolor="1" pretext="-" isinstance="0" xmi.id="211" text="sta_own_data" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="23105" widgetaid="23052" xmi.id="24650" linecolor="none" >
+ <linepath>
+ <startpoint startx="490" starty="287" />
+ <endpoint endx="489" endy="392" />
+ <point x="555" y="287" />
+ <point x="555" y="392" />
+ </linepath>
+ <floatingtext usesdiagramfillcolour="1" width="32" usesdiagramusefillcolour="1" x="492" y="253" linewidth="none" posttext="" role="701" fillcolour="none" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="215" showstereotype="1" text="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolour="1" width="32" usesdiagramusefillcolour="1" x="491" y="358" linewidth="none" posttext="" role="702" fillcolour="none" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="216" showstereotype="1" text="*" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolour="1" width="124" usesdiagramusefillcolour="1" x="491" y="394" linewidth="none" posttext="" role="710" fillcolour="none" height="19" usefillcolor="1" pretext="-" isinstance="0" xmi.id="214" text="unassociated_stas" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="3" indexb="1" linewidth="none" widgetbid="23052" widgetaid="22946" xmi.id="24913" linecolor="none" >
+ <linepath>
+ <startpoint startx="303" starty="199" />
+ <endpoint endx="458" endy="281" />
+ </linepath>
+ <floatingtext usesdiagramfillcolour="1" width="32" usesdiagramusefillcolour="1" x="282" y="202" linewidth="none" posttext="" role="701" fillcolour="none" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="218" text="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolour="1" width="32" usesdiagramusefillcolour="1" x="446" y="246" linewidth="none" posttext="" role="702" fillcolour="none" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="219" text="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolour="1" width="69" usesdiagramusefillcolour="1" x="387" y="260" linewidth="none" posttext="" role="710" fillcolour="none" height="19" usefillcolor="1" pretext="-" isinstance="0" xmi.id="217" text="networks" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="2" totalcountb="3" indexb="1" linewidth="none" widgetbid="23105" widgetaid="23052" xmi.id="25292" linecolor="none" >
+ <linepath>
+ <startpoint startx="458" starty="292" />
+ <endpoint endx="459" endy="387" />
+ <point x="392" y="292" />
+ <point x="392" y="387" />
+ </linepath>
+ <floatingtext usesdiagramfillcolour="1" width="32" usesdiagramusefillcolour="1" x="424" y="258" linewidth="none" posttext="" role="701" fillcolour="none" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="221" showstereotype="1" text="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolour="1" width="32" usesdiagramusefillcolour="1" x="437" y="355" linewidth="none" posttext="" role="702" fillcolour="none" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="222" showstereotype="1" text="254" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolour="1" width="110" usesdiagramusefillcolour="1" x="334" y="364" linewidth="none" posttext="" role="710" fillcolour="none" height="19" usefillcolor="1" pretext="-" isinstance="0" xmi.id="220" text="associated_stas" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="3" indexb="2" linewidth="none" widgetbid="23105" widgetaid="22789" xmi.id="32027" linecolor="none" >
+ <linepath>
+ <startpoint startx="402" starty="100" />
+ <endpoint endx="459" endy="397" />
+ <point x="225" y="100" />
+ <point x="225" y="397" />
+ </linepath>
+ <floatingtext usesdiagramfillcolour="1" width="32" usesdiagramusefillcolour="1" x="368" y="66" linewidth="none" posttext="" role="701" fillcolour="none" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="224" text="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolour="1" width="32" usesdiagramusefillcolour="1" x="425" y="407" linewidth="none" posttext="" role="702" fillcolour="none" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="225" text="*" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolour="1" width="42" usesdiagramusefillcolour="1" x="228" y="343" linewidth="none" posttext="" role="710" fillcolour="none" height="19" usefillcolor="1" pretext="-" isinstance="0" xmi.id="223" text="stas" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="23052" widgetaid="23105" xmi.id="32575" linecolor="none" >
+ <linepath>
+ <startpoint startx="474" starty="378" />
+ <endpoint endx="474" endy="303" />
+ </linepath>
+ <floatingtext usesdiagramfillcolour="1" width="32" usesdiagramusefillcolour="1" x="476" y="344" linewidth="none" posttext="" role="701" fillcolour="none" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="227" text="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolour="1" width="32" usesdiagramusefillcolour="1" x="476" y="305" linewidth="none" posttext="" role="702" fillcolour="none" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="228" text="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolour="1" width="35" usesdiagramusefillcolour="1" x="437" y="305" linewidth="none" posttext="" role="710" fillcolour="none" height="19" usefillcolor="1" pretext="-" isinstance="0" xmi.id="226" text="net" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ </associations>
+ </diagram>
+ </diagrams>
+ </XMI.extension>
+ </UML:Model>
+ <UML:Model stereotype="2" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Use Case View" isRoot="false" isAbstract="false" name="Use Case View" >
+ <UML:Namespace.ownedElement>
+ <UML:Actor isSpecification="false" isLeaf="false" visibility="public" namespace="Use Case View" xmi.id="g2RmQlkG6CqM" isRoot="false" isAbstract="false" name="CP" />
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ <UML:Model stereotype="2" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Component View" isRoot="false" isAbstract="false" name="Component View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="2" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Deployment View" isRoot="false" isAbstract="false" name="Deployment View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="2" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Entity Relationship Model" isRoot="false" isAbstract="false" name="Entity Relationship Model" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ </XMI.content>
+ <XMI.extensions xmi.extender="umbrello" >
+ <docsettings viewid="26710" documentation="" uniqueid="36694" />
+ <listview>
+ <listitem open="1" type="800" label="Views" >
+ <listitem open="1" type="801" id="Logical View" >
+ <listitem open="1" type="803" id="25613" >
+ <listitem open="0" type="807" id="25666" label="manager" />
+ <listitem open="0" type="807" id="26501" label="net" />
+ <listitem open="0" type="807" id="26240" label="net_list" />
+ <listitem open="0" type="807" id="25979" label="own_data" />
+ <listitem open="0" type="807" id="26710" label="sta" />
+ </listitem>
+ <listitem open="0" type="803" id="rLUcIo7kRV6u" >
+ <listitem open="0" type="810" id="AP5TiteE7LRQ" label="add_avln" />
+ <listitem open="0" type="810" id="7H0owQzfSQY2" label="add_one_sta" />
+ <listitem open="0" type="810" id="RSnHUDavlWhS" label="add_some_stas" />
+ <listitem open="0" type="810" id="neR6JQh9hknw" label="get_avln" />
+ <listitem open="0" type="810" id="fx8vI9va2Fiw" label="get_sta" />
+ <listitem open="0" type="810" id="poqwIOBuIxHD" label="remove_avln" />
+ <listitem open="0" type="810" id="TXHwr69BCMDJ" label="remove_some_stas" />
+ <listitem open="0" type="810" id="m64ppNaUHAGt" label="remove_sta" />
+ </listitem>
+ <listitem open="0" type="807" id="22684" label="Package_class" />
+ <listitem open="0" type="807" id="bZ62yFKbgidF" label="diagramme de classes" />
+ <listitem open="0" type="813" id="qIWnFzBd9oKJ" >
+ <listitem open="0" type="815" id="Qd9Ie0K9YadK" />
+ <listitem open="0" type="815" id="fhhadu0Xv5sq" />
+ <listitem open="0" type="815" id="qF2AzTzTvsRh" />
+ <listitem open="0" type="815" id="dvGudEhkvNbD" />
+ <listitem open="0" type="815" id="Ads5yTHiXj5l" />
+ <listitem open="0" type="815" id="vcDuDxLNPn0k" />
+ <listitem open="0" type="815" id="thTkEhFFV82W" />
+ <listitem open="0" type="815" id="fEG2VdimBUrx" />
+ <listitem open="0" type="815" id="dEIri7aEIlnP" />
+ <listitem open="0" type="815" id="0swcx8FCE83L" />
+ <listitem open="0" type="815" id="iz4t8GAcZAqw" />
+ </listitem>
+ <listitem open="0" type="813" id="QCdiA5hU9IAb" >
+ <listitem open="0" type="814" id="9PZYdnDFOfZz" />
+ <listitem open="0" type="814" id="I2w0DZg3Mq2z" />
+ <listitem open="0" type="814" id="HiveU00Ud1Ud" />
+ <listitem open="0" type="814" id="tVZmk23YSl2D" />
+ <listitem open="0" type="814" id="4144" />
+ <listitem open="0" type="814" id="fU07vNLGT9Ie" />
+ <listitem open="0" type="814" id="bJPnIIOxkO2f" />
+ <listitem open="0" type="814" id="kNvDWBsghjTC" />
+ <listitem open="0" type="814" id="AqQWPXxzCapd" />
+ <listitem open="0" type="814" id="p8FRmwBNLQgP" />
+ <listitem open="0" type="814" id="kr6KLUaiRjIH" />
+ <listitem open="0" type="814" id="0qvffRz2S8ru" />
+ <listitem open="0" type="814" id="S6pIWhJZQV41" />
+ <listitem open="0" type="814" id="17196" />
+ <listitem open="0" type="814" id="29018" />
+ <listitem open="0" type="815" id="L8nWSpKOxfIH" />
+ <listitem open="0" type="815" id="025OblSx0TOi" />
+ <listitem open="0" type="815" id="3UBqgc2KKU2C" />
+ <listitem open="0" type="815" id="3ABOLzFXlfcB" />
+ <listitem open="0" type="815" id="15942" />
+ <listitem open="0" type="815" id="3tINqVucAXnG" />
+ <listitem open="0" type="815" id="iaLbV3XXwoul" />
+ <listitem open="0" type="815" id="16040" />
+ <listitem open="0" type="815" id="W8rOQJZys2Nh" />
+ <listitem open="0" type="815" id="LSNW129OipWM" />
+ <listitem open="0" type="815" id="ihLtnkq61iHr" />
+ <listitem open="0" type="815" id="17437" />
+ <listitem open="0" type="815" id="ljJ5Ao4US5yj" />
+ <listitem open="0" type="815" id="Nsj0r8ybFTqj" />
+ <listitem open="0" type="815" id="tXX7yCe6ABln" />
+ <listitem open="0" type="815" id="po8WMv8qvmgP" />
+ <listitem open="0" type="815" id="eOkr2PyKZULL" />
+ <listitem open="0" type="815" id="pq6Gp6gvxZjX" />
+ <listitem open="0" type="815" id="EQSO9Nrh7vtl" />
+ <listitem open="0" type="815" id="z1wK2LaEl0as" />
+ <listitem open="0" type="815" id="16667" />
+ <listitem open="0" type="815" id="16715" />
+ <listitem open="0" type="815" id="16811" />
+ <listitem open="0" type="815" id="29723" />
+ <listitem open="0" type="815" id="29869" />
+ </listitem>
+ <listitem open="1" type="813" id="L2ASUCoHdFZ0" >
+ <listitem open="0" type="814" id="12890" />
+ <listitem open="0" type="814" id="33908" />
+ <listitem open="0" type="815" id="QXnrJp4mc3nZ" />
+ <listitem open="0" type="815" id="bxBBvbAGs7Q5" />
+ <listitem open="0" type="815" id="vk7FSeQIaeIS" />
+ <listitem open="0" type="815" id="qHxkg2dtESUh" />
+ <listitem open="0" type="815" id="2gQknmKqTzYm" />
+ <listitem open="0" type="815" id="DC8mABArXbfX" />
+ <listitem open="0" type="815" id="MulJvMHR2JsJ" />
+ <listitem open="0" type="815" id="i2znmIk8bVQ3" />
+ <listitem open="0" type="815" id="o7bH8l102RHc" />
+ <listitem open="0" type="815" id="NDGrlwJSDY8B" />
+ <listitem open="0" type="815" id="HwdXOmbaswch" />
+ <listitem open="0" type="815" id="5SqO4seTjRSa" />
+ <listitem open="0" type="815" id="7000" />
+ <listitem open="0" type="815" id="7802" />
+ <listitem open="0" type="815" id="34154" />
+ <listitem open="0" type="815" id="34599" />
+ <listitem open="0" type="815" id="34897" />
+ <listitem open="0" type="815" id="35047" />
+ <listitem open="0" type="815" id="35147" />
+ <listitem open="0" type="815" id="35298" />
+ <listitem open="0" type="815" id="35605" />
+ <listitem open="0" type="815" id="35866" />
+ </listitem>
+ <listitem open="0" type="813" id="dQQc692tOFUS" >
+ <listitem open="0" type="814" id="hcbUh4JlIu5E" />
+ <listitem open="0" type="814" id="MyhwT7zZG8oO" />
+ <listitem open="0" type="814" id="x5HJsnaGxZDg" />
+ <listitem open="0" type="814" id="RrbeL3wI6BZy" />
+ <listitem open="0" type="814" id="I16y7R8xSEes" />
+ <listitem open="0" type="814" id="VZjK8y2Pz9L4" />
+ <listitem open="0" type="814" id="20601" />
+ <listitem open="0" type="814" id="0grlCK0Zd2kv" />
+ <listitem open="0" type="814" id="roOeP5mqSzsY" />
+ <listitem open="0" type="814" id="20651" />
+ <listitem open="0" type="814" id="20701" />
+ <listitem open="0" type="814" id="20751" />
+ <listitem open="0" type="814" id="TO2c4YFuL4qQ" />
+ <listitem open="0" type="814" id="Rxzl1nBWMvpT" />
+ <listitem open="0" type="814" id="gBfRCRdglWVE" />
+ <listitem open="0" type="814" id="3951" />
+ <listitem open="0" type="814" id="xAmypZKxOlvo" />
+ <listitem open="0" type="814" id="919bTPKjqxKs" />
+ <listitem open="0" type="814" id="MW7N3XqbJLli" />
+ <listitem open="0" type="814" id="aTEnETRcBPSB" />
+ <listitem open="0" type="815" id="l9iApQ5k7p4V" />
+ <listitem open="0" type="815" id="20899" />
+ <listitem open="0" type="815" id="PNzGVGMN7IZO" />
+ <listitem open="0" type="815" id="oS3q3CNSaLg5" />
+ <listitem open="0" type="815" id="9tv3PTcwJuk2" />
+ <listitem open="0" type="815" id="DbAcS8Pc1KdP" />
+ <listitem open="0" type="815" id="lEJ2633MpMzJ" />
+ <listitem open="0" type="815" id="bLozAc1Tby5t" />
+ <listitem open="0" type="815" id="QacAXGqLr88z" />
+ <listitem open="0" type="815" id="XBpdlbprByih" />
+ <listitem open="0" type="815" id="x2pgMFGxFwzE" />
+ <listitem open="0" type="815" id="YWiBOMZqmmSC" />
+ <listitem open="0" type="815" id="gkXbpZt9r3e4" />
+ <listitem open="0" type="815" id="Cgo2iS6vpgKJ" />
+ <listitem open="0" type="815" id="4vv3FEH8vlii" />
+ <listitem open="0" type="815" id="h933zRw1Mr2a" />
+ <listitem open="0" type="815" id="Z2pjniRb4U5p" />
+ <listitem open="0" type="815" id="6Di8flw9tLlH" />
+ <listitem open="0" type="815" id="xXWGuINyU377" />
+ <listitem open="0" type="815" id="b2NRxvTAG4Im" />
+ <listitem open="0" type="815" id="wXFOX5u66GX3" />
+ <listitem open="0" type="815" id="4DPM1C2ZHS5c" />
+ <listitem open="0" type="815" id="tS98bISnuM92" />
+ <listitem open="0" type="815" id="21441" />
+ <listitem open="0" type="815" id="21541" />
+ <listitem open="0" type="815" id="4536" />
+ <listitem open="0" type="815" id="4636" />
+ <listitem open="0" type="815" id="21592" />
+ <listitem open="0" type="815" id="21694" />
+ <listitem open="0" type="815" id="21746" />
+ <listitem open="0" type="815" id="21851" />
+ </listitem>
+ <listitem open="0" type="813" id="tftTuiZXSv4R" >
+ <listitem open="0" type="814" id="w2lpqlcRNBky" />
+ <listitem open="0" type="814" id="KjxDjNipVmH6" />
+ <listitem open="0" type="814" id="nJw1e6ulB8mV" />
+ <listitem open="0" type="814" id="9SydFFh3ENAt" />
+ <listitem open="0" type="814" id="76E3M1i7iJGy" />
+ <listitem open="0" type="814" id="njbBHkqZRmmB" />
+ <listitem open="0" type="814" id="30115" />
+ <listitem open="0" type="814" id="15VSrGbyiZbv" />
+ <listitem open="0" type="814" id="7SdojrmkwHBl" />
+ <listitem open="0" type="814" id="61vH7gnD8O1s" />
+ <listitem open="0" type="814" id="O3jgPKW1znfn" />
+ <listitem open="0" type="814" id="uZ2PRCIQqOal" />
+ <listitem open="0" type="814" id="SKPVcXpzB5Y4" />
+ <listitem open="0" type="814" id="FcAqRxkJWmhw" />
+ <listitem open="0" type="814" id="R3na9McOwmEN" />
+ <listitem open="0" type="814" id="jwhEhOAeLWRh" />
+ <listitem open="0" type="814" id="27448" />
+ <listitem open="0" type="815" id="AaNPCwE5GYpL" />
+ <listitem open="0" type="815" id="1HLA3MQK09Yr" />
+ <listitem open="0" type="815" id="BxTRzdcxFOCK" />
+ <listitem open="0" type="815" id="feEeHoZUCjo5" />
+ <listitem open="0" type="815" id="MEr8fhvtbOQD" />
+ <listitem open="0" type="815" id="aCtLsOAUOvwU" />
+ <listitem open="0" type="815" id="28593" />
+ <listitem open="0" type="815" id="OSlCnQfCxj2t" />
+ <listitem open="0" type="815" id="H29zTi1CMn0S" />
+ <listitem open="0" type="815" id="xjmXt0pRpbh7" />
+ <listitem open="0" type="815" id="19160" />
+ <listitem open="0" type="815" id="28699" />
+ <listitem open="0" type="815" id="28805" />
+ </listitem>
+ <listitem open="1" type="813" id="23052" />
+ <listitem open="1" type="813" id="22946" />
+ <listitem open="1" type="813" id="23105" />
+ <listitem open="1" type="813" id="22789" />
+ <listitem open="1" type="813" id="22999" />
+ <listitem open="1" type="830" id="Datatypes" >
+ <listitem open="1" type="829" id="ZsN7qO5uod0W" />
+ <listitem open="1" type="829" id="sXqfrqwPid2x" />
+ <listitem open="1" type="829" id="BsXuVmQldfSS" />
+ <listitem open="1" type="829" id="1lLAIoXrLdtJ" />
+ <listitem open="1" type="829" id="NMq7yPI15TF8" />
+ <listitem open="1" type="829" id="8MlMJZOa2gQQ" />
+ <listitem open="0" type="829" id="21195" />
+ <listitem open="1" type="829" id="F0y42ZDGGZ49" />
+ <listitem open="1" type="829" id="bdvfq1CcRFQV" />
+ <listitem open="1" type="829" id="2TKfUnESr7J6" />
+ <listitem open="1" type="829" id="EhNquCdzHTzv" />
+ <listitem open="1" type="829" id="GXVTJzZt05VA" />
+ <listitem open="0" type="829" id="15653" />
+ <listitem open="0" type="829" id="cignRXiUIpXF" />
+ <listitem open="1" type="829" id="TRzc3eNXqLr1" />
+ <listitem open="1" type="829" id="f1lxWwdNwvpr" />
+ <listitem open="1" type="829" id="RTeIWtKTDaZV" />
+ <listitem open="0" type="829" id="vntVp1gw0ZB8" />
+ <listitem open="1" type="829" id="0mEev7QHu3Xw" />
+ <listitem open="1" type="829" id="6agIp7Rg7jXE" />
+ <listitem open="1" type="829" id="yVCl3jm3PB1C" />
+ <listitem open="1" type="829" id="DcaQZXHCYAUY" />
+ <listitem open="1" type="829" id="m7hYSy5qW7Uv" />
+ <listitem open="1" type="829" id="emAuInlIaxvV" />
+ <listitem open="1" type="829" id="Shk6a1xmtUeN" />
+ <listitem open="1" type="829" id="l2nnsImcbvsP" />
+ <listitem open="1" type="829" id="WHsGhr6cL3qV" />
+ <listitem open="0" type="829" id="12443" />
+ <listitem open="1" type="829" id="O01xtrLMY3S6" />
+ <listitem open="1" type="829" id="Q4TYO2bRfXJq" />
+ <listitem open="0" type="829" id="33858" />
+ <listitem open="1" type="829" id="OF2Sin3o242W" />
+ <listitem open="1" type="829" id="G46rjYKTY5EP" />
+ <listitem open="1" type="829" id="aHp7fmMY11yJ" />
+ <listitem open="1" type="829" id="J5WdE6USg2qD" />
+ <listitem open="1" type="829" id="X7Q5Iud3fXPb" />
+ <listitem open="1" type="829" id="QPMsbNxuTUYh" />
+ <listitem open="1" type="829" id="nnvOyvzkSE17" />
+ <listitem open="1" type="829" id="LyzcKuBtjfar" />
+ <listitem open="1" type="829" id="oZHHg64PKBaq" />
+ <listitem open="0" type="829" id="nyW3ZjsRDxWm" />
+ <listitem open="1" type="829" id="5NqwrUH5XNxE" />
+ <listitem open="1" type="829" id="hz7D2ZH5u80l" />
+ <listitem open="1" type="829" id="tFhSKvrguqen" />
+ </listitem>
+ <listitem open="0" type="831" id="cxkkcPlqeSGi" >
+ <listitem open="0" type="839" id="7AfLHTarQIb0" />
+ <listitem open="0" type="839" id="1IbnbOCiWr4l" />
+ <listitem open="0" type="839" id="UsJ25EL4Uwr6" />
+ <listitem open="0" type="839" id="MWptygBQWUQa" />
+ </listitem>
+ <listitem open="0" type="831" id="pBzpcllJMdsq" >
+ <listitem open="0" type="839" id="AYBjv2FiBCYl" />
+ <listitem open="0" type="839" id="TS9huSQ4zbmu" />
+ </listitem>
+ <listitem open="0" type="831" id="SsuRPlPUGZjG" >
+ <listitem open="0" type="839" id="YGOeDlDfb740" />
+ <listitem open="0" type="839" id="8rMiHZwnqIP3" />
+ </listitem>
+ <listitem open="0" type="831" id="7PSrs3lMwQVn" >
+ <listitem open="0" type="839" id="200XB2ebUTRX" />
+ <listitem open="0" type="839" id="v7wHq2ss2qNB" />
+ <listitem open="0" type="839" id="VkDZ8Ke4QYJG" />
+ </listitem>
+ <listitem open="1" type="831" id="27023" >
+ <listitem open="0" type="839" id="27076" />
+ <listitem open="0" type="839" id="27129" />
+ </listitem>
+ </listitem>
+ <listitem open="1" type="802" id="Use Case View" >
+ <listitem open="1" type="811" id="g2RmQlkG6CqM" />
+ </listitem>
+ <listitem open="1" type="821" id="Component View" />
+ <listitem open="1" type="827" id="Deployment View" />
+ <listitem open="1" type="836" id="Entity Relationship Model" />
+ </listitem>
+ </listview>
+ <codegeneration>
+ <codegenerator language="Java" />
+ </codegeneration>
+ </XMI.extensions>
+</XMI>
diff --git a/cesar/cp/eoc/sta/mgr/src/sta_mgr.c b/cesar/cp/eoc/sta/mgr/src/sta_mgr.c
new file mode 100644
index 0000000000..b329855d21
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/src/sta_mgr.c
@@ -0,0 +1,572 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008-2009 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eoc/sta/mgr/src/sta_mgr.c
+ * \brief Station manager source.
+ * \ingroup cp_eoc_sta_mgr
+ *
+ */
+#include "common/std.h"
+#include "common/defs/eoc.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/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 "cl/cl_eoc_mactotei.h"
+#include "mac/sar/sar.h"
+
+/* Config headers. */
+#include "config/cp/sta/mgr/cco/eoc.h"
+
+/**
+ * Add a station to the associated or unassociated list.
+ * \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.
+ * \param sta the station.
+ */
+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 (!((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_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. */
+ if (tei == MAC_TEI_UNASSOCIATED)
+ {
+ if (cp_eoc_sta_mgr_sta_is_assoc (ctx, net, sta->tei))
+ {
+ set_remove (&net->associated_stas, &sta->public_data.node_net);
+ if (MAC_TEI_IS_STA (sta->tei))
+ sta->net->num_associated_stas--;
+ }
+
+ 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. */
+ else
+ {
+ 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);
+
+ mac_store_sta_add (ctx->mac_store, tei);
+ state = set_insert (&net->associated_stas, &sta->public_data.node_net);
+ dbg_check (state);
+ cp_sta_set_assoc_confirmed (ctx, (cp_sta_t *) sta, true);
+ cp_sta_mgr_commit_to_dataplane (ctx);
+ }
+}
+
+void
+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,
+ &station->public_data.node_sta_mgr);
+ dbg_check (state);
+}
+
+
+void
+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. */
+ cp_sta_own_data_init (ctx);
+
+ /* Initialise the list of releasing stations. */
+ list_init (&ctx->sta_mgr.release_sta_list);
+
+ /* 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. */
+ set_init (&ctx->sta_mgr.stas, cp_sta_mgr_sta_mac_address_less);
+
+ lib_stats_set_stat_value_notype ("OUTPUT_LEVEL_ALL",
+ &ctx->sta_mgr.sta_own_data.output_level,
+ LIB_STATS_ACCESS_READ_WRITE,
+ LIB_STATS_DEBUG);
+}
+
+void
+cp_eoc_sta_mgr_garbage (cp_t *ctx)
+{
+ cp_sta_t *sta;
+ cp_net_t *net;
+ dbg_assert (ctx);
+ u32 now = cp_sta_core_get_date_ms (ctx);
+ 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)
+ cp_net_garbage_stations (ctx, net, now);
+ /* Release the release stations if possible. */
+ while ((sta = cp_sta_mgr_release_sta_get_first (ctx))
+ && (less_mod2p32 (sta->tei_lease_date_ms, now)))
+ {
+ /* remove the station from the list. */
+ list_remove (&ctx->sta_mgr.release_sta_list,
+ &sta->release_node);
+
+ sar_sta_remove (ctx->sar, cp_sta_get_tei (sta));
+
+ if (cp_sta_own_data_get_cco_status (ctx))
+ {
+ /* Clear EoC specific cl information. */
+ cl_eoc_mactotei_entry_remove (ctx->cl, cp_sta_get_tei (sta));
+ /* Request the CCo to release the TEI. */
+ cp_cco_action_tei_release (ctx, cp_sta_get_tei (sta));
+ }
+ slab_release (sta);
+ }
+ cp_sta_mgr_elects_sta_partial_ack (ctx);
+}
+
+void
+cp_eoc_sta_mgr_release_station (cp_t *ctx, cp_tei_t tei)
+{
+ cp_sta_t *sta;
+ cp_net_t *net;
+
+ dbg_assert (ctx);
+ dbg_assert (tei);
+ dbg_assert (cp_sta_own_data_get_cco_status (ctx));
+
+ net = cp_sta_mgr_get_our_avln (ctx);
+ sta = cp_sta_mgr_sta_get_assoc (ctx, net, tei);
+ dbg_assert (sta);
+
+ /* 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 --;
+ /* Remove the station from the sta mgr set. */
+ 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_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;
+
+ dbg_assert (ctx);
+ dbg_assert (net);
+ dbg_assert ((tei && mac_address == MAC_BROADCAST)
+ || (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);
+
+ if (!sta)
+ {
+ sta = (cp_sta_private_t *) cp_sta_mgr_sta_add_realy (
+ ctx, net, tei, mac_address);
+ }
+ else
+ {
+ /* Last case. The network change. */
+ if (sta->net != net)
+ {
+ 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);
+ }
+ /* First case only the TEI change from the previous state. */
+ else if ((sta->tei == MAC_TEI_UNASSOCIATED)
+ && (tei != MAC_TEI_UNASSOCIATED)
+ && (sta->mac_address == mac_address))
+ {
+ /* Remove the station. */
+ cp_sta_mgr_sta_remove (ctx, (cp_sta_t *) sta);
+ 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);
+ if (net == ctx->sta_mgr.our_avln)
+ mac_store_sta_add (ctx->mac_store, tei);
+ }
+ /* Second case,
+ * - station's TEI != TEI and != MAC_TEI_UNASSOCIATED.
+ * - station's Mac address was broadcast. */
+ else if ((sta->tei == tei)
+ && (tei != MAC_TEI_UNASSOCIATED)
+ && (sta->mac_address != mac_address)
+ && (sta->mac_address == MAC_BROADCAST))
+ {
+ /* Add the station mgr node to the set. */
+ sta->mac_address = mac_address;
+ set_insert (&ctx->sta_mgr.stas,
+ &sta->public_data.node_sta_mgr);
+ }
+ /* Third case, only the station's TEI change. */
+ else if ((sta->tei != tei)
+ && (tei != MAC_TEI_UNASSOCIATED)
+ && (sta->mac_address == mac_address)
+ && (mac_address != MAC_BROADCAST))
+ {
+ /* Only change the station's TEI. */
+ sta->tei = tei;
+ }
+ /* Fourth case, only the station's TEI change from a associated tei to
+ * the unassociated TEI.. */
+ else if ((sta->tei != tei)
+ && (tei == MAC_TEI_UNASSOCIATED)
+ && (sta->mac_address == mac_address)
+ && (mac_address != MAC_BROADCAST))
+ {
+ 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. */
+ else if ((sta->mac_address != mac_address)
+ && (mac_address != MAC_BROADCAST)
+ && (mac_address != 0))
+ {
+ 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);
+ }
+ /* Sixth case, Same TEI, same mac address,
+ * but the sta is not in the associated list. First ASSOC_REQ. */
+ else if ((sta->mac_address == mac_address)
+ && (sta->tei == tei)
+ && (tei != MAC_TEI_UNASSOCIATED))
+ {
+ 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);
+ }
+ }
+
+ /* Update the last seen value. */
+ if (CONFIG_CP_AV)
+ {
+ sta->public_data.expired_date_ms = cp_sta_core_get_date_ms (ctx)
+ + HPAV_STA_PRESENCE_TIMEOUT_INSIDE_AVLN_MS;
+ }
+ else if (CONFIG_CP_EOC)
+ {
+ sta->public_data.expired_date_ms = cp_sta_core_get_date_ms (ctx)
+ + EOC_STA_PRESENCE_TIMEOUT_INSIDE_AVLN_MS;
+ }
+ return &sta->public_data;
+}
+
+void
+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;
+ cp_net_t *net;
+
+ dbg_assert (ctx);
+ dbg_assert (sta);
+ dbg_assert (sta->net);
+
+ net = sta->net;
+
+ /* 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 (net->pco == station)
+ net->pco = NULL;
+
+ if ((net == ctx->sta_mgr.our_avln)
+ && (MAC_TEI_IS_STA (sta->tei)))
+ sar_sta_remove (ctx->sar, sta->tei);
+
+ /* Remove the station from its net. */
+ if (cp_sta_get_tei (&sta->public_data))
+ {
+ 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_stas --;
+ }
+ 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);
+ sta->net->num_stas --;
+ }
+ }
+ else
+ {
+ set = &sta->net->unassociated_stas;
+ 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 --;
+ }
+ }
+
+ /* Remove the station from the station manager. If the mac address of the
+ * station is broadcast, the station is not in the set. */
+ if ((sta->mac_address != MAC_BROADCAST) && (!station->sta_in_wl))
+ set_remove (&ctx->sta_mgr.stas, &sta->public_data.node_sta_mgr);
+
+ /* decrease the visible counter. */
+ if (sta->visible)
+ sta->net->num_visible_stas --;
+
+ cp_sta_mgr_elects_sta_partial_ack (ctx);
+
+ /* Release the station if it was removed from the station manager. */
+ if ((sta->mac_address != MAC_BROADCAST) && (!station->sta_in_wl))
+ slab_release (sta);
+}
+
+bool
+cp_eoc_sta_mgr_sta_is_assoc (cp_t *ctx, cp_net_t *net, cp_tei_t tei)
+{
+ set_node_t *node = NULL;
+
+ dbg_assert (ctx);
+ dbg_assert (net);
+ dbg_assert (tei);
+
+ if (!set_empty (&net->associated_stas))
+ {
+ cp_sta_private_t sta_cmp;
+ 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);
+ }
+
+ return (node);
+}
+
+bool
+cp_eoc_sta_mgr_sta_is_unassoc (cp_t *ctx, cp_net_t *net, mac_t mac)
+{
+ set_node_t *node = NULL;
+
+ dbg_assert (ctx);
+ dbg_assert (net);
+ dbg_assert (mac);
+
+ if (!set_empty (&net->unassociated_stas))
+ {
+ cp_sta_private_t sta_cmp;
+ memset (&sta_cmp, 0, sizeof (cp_sta_private_t));
+ sta_cmp.mac_address = mac;
+
+ node = set_find (&net->unassociated_stas,
+ &sta_cmp.public_data.node_net);
+ }
+
+ return (node);
+}
+
+void
+cp_eoc_sta_mgr_commit_to_dataplane (cp_t *ctx)
+{
+ cp_sta_t *sta;
+ cl_mactotei_blk_t *mactotei;
+
+ dbg_assert (ctx);
+ dbg_assert (ctx->cl);
+
+ /* 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. */
+ 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. */
+ 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_sta_private_t *sta_private = (cp_sta_private_t *) sta;
+ /* 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. */
+ cl_mactotei_addr_add (mactotei, sta_private->mac_address,
+ sta_private->tei, MAC_TEI_UNASSOCIATED);
+
+ }
+
+ /* Request the CL to use the table. */
+ cl_mactotei_use_table (ctx->cl, mactotei);
+ }
+}
+
+#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)
+{
+ dbg_assert (ctx);
+ dbg_assert (numStas);
+ dbg_assert (stas_teis);
+ dbg_assert (stas_macs);
+ dbg_assert (stas_authorizations);
+ dbg_assert (stas_output_levels);
+ dbg_assert (stas_start_times);
+ dbg_assert (stas_end_times);
+ dbg_assert (stas_daks);
+ dbg_assert (stas_actions);
+
+ set_node_t *node;
+ cp_sta_t *sta = NULL;
+ uint i = 0;
+ (*numStas) = 0;
+
+ if (!set_empty (&ctx->sta_mgr.stas))
+ {
+ node = set_begin(&ctx->sta_mgr.stas);
+ while (node)
+ {
+ sta = PARENT_OF (cp_sta_t, node_sta_mgr, node);
+ if (((cp_sta_private_t *)sta)->tei != 0)
+ {
+ stas_authorizations[i] = sta->multi_sta.allowed;
+ stas_output_levels[i] = sta->multi_sta.output_level;
+ stas_start_times[i] = sta->multi_sta.start_time;
+ stas_end_times[i] = sta->multi_sta.end_time;
+ stas_daks[i] = sta->multi_sta.dak;
+ stas_dpws[i] = ((cp_sta_private_t *)sta)->dpw;
+ stas_actions[i] = sta->multi_sta.action;
+ stas_teis[i] = ((cp_sta_private_t *)sta)->tei;
+ stas_macs[i] = ((cp_sta_private_t *)sta)->mac_address;
+ i++;
+ }
+ node = set_next(&ctx->sta_mgr.stas, node);
+ }
+ (*numStas) = i;
+ }
+}
+
+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])
+{
+ dbg_assert (ctx);
+ dbg_assert (numStas);
+ dbg_assert (stas_macs);
+ dbg_assert (stas_port_ed);
+ dbg_assert (stas_port_service);
+
+ set_node_t *node;
+ cp_sta_t *sta = NULL;
+ uint i = 0;
+ uint j = 0;
+ (*numStas) = 0;
+
+ if (!set_empty (&ctx->sta_mgr.stas))
+ {
+ node = set_begin(&ctx->sta_mgr.stas);
+ while (node)
+ {
+ sta = PARENT_OF (cp_sta_t, node_sta_mgr, node);
+ 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++)
+ {
+ 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 ++;
+ }
+ node = set_next(&ctx->sta_mgr.stas, node);
+ }
+ (*numStas) = i;
+
+ }
+}
+
+#endif /* CONFIG_CP_STA_MGR_CCO_EOC */
+
diff --git a/cesar/cp/eoc/sta/mgr/src/sta_own_data.c b/cesar/cp/eoc/sta/mgr/src/sta_own_data.c
new file mode 100644
index 0000000000..cb32182569
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/src/sta_own_data.c
@@ -0,0 +1,89 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008-2009 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eoc/sta/mgr/src/sta_own_data.c
+ * \brief Station data source.
+ * \ingroup cp_eoc_sta_mgr
+ *
+ */
+#include "common/std.h"
+
+/* Private headers. */
+#include "cp/inc/context.h"
+#include "cp/sta/mgr/inc/sta_own_data.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_eoc_sta_own_data_init (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ memset ((u8*) &ctx->sta_mgr.sta_own_data,
+ 0, sizeof (cp_sta_own_data_private_t));
+
+ /* Store the hybrid mode. */
+ ctx->sta_mgr.sta_own_data.public.hybrid_mode =
+ MAC_COEXISTENCE_AV_ONLY_MODE;
+
+ /* Take a random snid. */
+ ctx->sta_mgr.sta_own_data.snid =
+ lib_rnd_uniform (&ctx->rnd, HPAV_SNID_NB);
+
+ /* Debug only. */
+ GPIO_SETUP (LED_IS_CCO_GPIO, GPIO_DIRECTION_OUT);
+ GPIO_SET (LED_IS_CCO_GPIO, 0);
+}
+
+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)
+{
+ dbg_assert (ctx);
+ dbg_assert (type < CP_MSG_DRV_STA_SET_KEY_TYPE_NB);
+
+ uint i;
+ cp_key_t current_key = cp_sta_own_data_get_nmk (ctx);
+
+ for (i = 0; i < COUNT(nmk.key) ;i++)
+ if (nmk.key[i] != current_key.key[i])
+ break;
+
+ if (i < COUNT(nmk.key))
+ {
+ ctx->sta_mgr.sta_own_data.nmk = nmk;
+ return true;
+ }
+
+ return false;
+}
+
+void
+cp_eoc_sta_own_data_set_original_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.original_dak.key[i] = dak.key[i];
+}
+
+cp_key_t
+cp_eoc_sta_own_data_get_original_dak (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ return ctx->sta_mgr.sta_own_data.original_dak;
+}
diff --git a/cesar/cp/eoc/sta/mgr/sta_mgr.h b/cesar/cp/eoc/sta/mgr/sta_mgr.h
new file mode 100644
index 0000000000..574f8e1ebd
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/sta_mgr.h
@@ -0,0 +1,75 @@
+#ifndef cp_eoc_sta_mgr_h
+#define cp_eoc_sta_mgr_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eoc/sta/mgr/sta_mgr.h
+ * \brief Station Manager.
+ * \ingroup cp_eoc_sta_mgr
+ *
+ * Station and AVLN manager.
+ */
+#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_eoc_sta_mgr_sta_insert_into_stas_list (
+ cp_t *ctx, cp_sta_private_t *station);
+
+/**
+ * TODO
+ */
+bool
+cp_eoc_sta_mgr_sta_is_assoc (cp_t *ctx, cp_net_t *net, cp_tei_t tei);
+
+/**
+ * TODO
+ */
+bool
+cp_eoc_sta_mgr_sta_is_unassoc (cp_t *ctx, cp_net_t *net, mac_t mac);
+
+
+#if CONFIG_CP_STA_MGR_CCO_EOC
+/**
+ * TODO
+ */
+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);
+
+/**
+ * TODO
+ */
+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/utest/Config b/cesar/cp/eoc/sta/mgr/test/utest/Config
new file mode 100644
index 0000000000..4f7d8c9cc7
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/test/utest/Config
@@ -0,0 +1,5 @@
+CONFIG_CP_EOC = y
+CONFIG_DEBUG_FATAL_CATCH = y
+CONFIG_RESTRACK = y
+CONFIG_AV_ONLY_MODE = y
+CONFIG_CL_EOC_ROUTE = 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..bb01377d50
--- /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/eoc cl
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/eoc/sta/mgr/test/utest/doc/Makefile b/cesar/cp/eoc/sta/mgr/test/utest/doc/Makefile
new file mode 100644
index 0000000000..25c6b6b03d
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/test/utest/doc/Makefile
@@ -0,0 +1,20 @@
+PAGES= sta_mgr.txt sta.txt net.txt net_list.txt
+
+ODT=$(PAGES:%.txt=%.odt)
+HTML=$(PAGES:%.txt=%.html)
+
+all: $(ODT) $(HTML)
+
+odt: $(ODT)
+
+html: $(HTML)
+
+%.odt: %.txt
+ rst2odt.py $< $@
+
+%.html: %.txt
+ rst2html $< $@
+
+clean:
+ rm -f $(ODT)
+ rm -f $(HTML)
diff --git a/cesar/cp/eoc/sta/mgr/test/utest/doc/net.txt b/cesar/cp/eoc/sta/mgr/test/utest/doc/net.txt
new file mode 100644
index 0000000000..3424c2ba52
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/test/utest/doc/net.txt
@@ -0,0 +1,190 @@
+Network test
+============
+
+Test the APIs available in the cp_net.
+
+sta_add
+-------
+
+Test 1 : Unassociated STAs
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add some station to the net list and verify the data. The STA are added with a
+TEI null and a known mac address.
+
+The Station shall be added as unassociated stations and be added in the set of
+unassociated stations.
+
+Their status shall be equal to CP_STA_STATE_EXISTS.
+The Mac address shall be set.
+
+Test 2 : Associated STAs
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add some stations to the net list and verify the data. The STA are added with
+a TEI different of any one already present in the Net list.
+
+The mac address is not necessary if the TEI is set, the station status shall
+be equal to CP_STA_STATE_ASSOCIATED.
+
+Test 3 : Authenticated STAs
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add some authenticated stations to the net list. The STAs are added with a TEI
+different of any one already present in the Net list.
+
+The stations status shall be equal to CP_STA_STATE_AUTHENTICATED.
+
+Test 4 : Modifying the CCo in the NET
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add a station authenticated and set it as a CCo in the AVLN.
+
+The station shall be in the CP_STA_STATE_AUTHENTICATED, and the AVLN shall
+have a pointer to this station in the cco variable.
+
+Test 5 : Modifying the PCo in the NET
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add a station authenticated and set it as a PCo in the AVLN.
+
+The station shall be in the CP_STA_STATE_AUTHENTICATED, and the AVLN shall
+have a pointer to this station in the pco variable.
+
+Remove Sta
+----------
+
+Test 1 : Removing a Associated station (not CCo, not PCo)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add some station and remove it.
+At the end the list must be empty.
+
+Test 2 : Removing the CCo station of the net.
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add some station in the net list as associated, one of those stations is the
+CCo (TEI = 3 for examples).
+
+At the beginning of the test, the station with the TEI = 3, shall have its
+status cco flag setted and the network has its cco pointer corresponding to
+this station.
+
+At the end, the station shall not exist in the network and the pointer to the
+CCo in the network shall be null.
+The other stations of the AVLN shall remain present.
+
+Test 3 : Removing the PCo Station of the net.
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add some station in the net list as associated, one of those stations is the
+PCo (TEI = 3 for examples).
+
+At the beginning of the test, the station with the TEI = 3, shall have its
+status pco flag setted and the network has its pco pointer corresponding to
+this station.
+
+At the end, the station shall not exist in the network and the pointer to the
+PCo in the network shall be null.
+The other stations of the AVLN shall remain present.
+
+Commit to data plane
+--------------------
+
+Add some station to the list and call the commit to data plane function.
+
+The function of the CL have been overwritten in the cl_stub.c file (see in the
+src directory).
+
+It will normally allocate a block and all the station present in the network
+list will be present in it.
+
++-----+-----+-------+
+| Tag | TEI | MAC @ |
++-----+-----+-------+
+
+Garbage
+-------
+
+Verify the expiration date of all the station in the network. It the network
+is empty it shall post an event in the FSM.
+
+Environment
+~~~~~~~~~~~
+
+Add an AVLN and some station with different status.
+
+Three associated and three not associated stations.
+
++-----+-------+-----+-------+-----------+
+| sta | assoc | tei | mac @ | last seen |
++-----+-------+-----+-------+-----------+
+| 1 | false | 0 | 1 | 5 |
++-----+-------+-----+-------+-----------+
+| 2 | false | 0 | 2 | 7 |
++-----+-------+-----+-------+-----------+
+| 3 | false | 0 | 3 | 9 |
++-----+-------+-----+-------+-----------+
+| 4 | true | 1 | 1 | 6 |
++-----+-------+-----+-------+-----------+
+| 5 | true | 2 | 5 | 8 |
++-----+-------+-----+-------+-----------+
+| 6 | true | 3 | 9 | 10 |
++-----+-------+-----+-------+-----------+
+
+Result
+~~~~~~
+
+The station 1 and the station 4 shall be expired and shall not appear in the
+list after the garbage.
+
+The others shall be still present.
+
+Set slot id
+-----------
+
+Add an AVLN and set the slot id to 5.
+
+Result
+ The slot id shall be equal to 5.
+
+Network mode
+------------
+
+This test case shall test the function to set and get the network mode of an
+AVLN.
+
+Net configuration
+ After the initialization of the network the network mode is CSMA-Only.
+ At the second modification the network mode shall be setted to coordinated mode.
+
+Result
+ The network shall be in CSMA only mode at the first read of the network mode.
+ The network shall be in Coordinated mode at the second read.
+
+Set sta visible
+---------------
+
+This function has for job to set the neighbour station as visible allowing to
+increase or decrease the counter of visible stations in the network.
+
+Test 1 : Adding a STA
+~~~~~~~~~~~~~~~~~~~~~
+
+Environment
+ Add a station to the network and set it as visible.
+
+Result
+ The network shall have one station as visible.
+
+Test 2 : Adding two STAs
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+Environment
+ Add two station to the AVLN configured as followed :
+
+ * STA 1 : visible
+ * STA 2 : hidden
+
+Result
+ The network shall have two station and only one visible.
diff --git a/cesar/cp/eoc/sta/mgr/test/utest/doc/net_list.txt b/cesar/cp/eoc/sta/mgr/test/utest/doc/net_list.txt
new file mode 100644
index 0000000000..758b4754b5
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/test/utest/doc/net_list.txt
@@ -0,0 +1,114 @@
+Network list
+============
+
+Initialise
+-----------
+
+Shall initialise all the networks list (index greater than 1, the index 0 corresponds to the station AVLN):
+ - present flag shall be false.
+ - snid = 0
+ - nid = 0
+ - cco = null
+ - pco = null
+ - expiration_ntb = CP_NET_EXPIRATION_DELAY (see defs file in cp)
+ - associated_stas shall be empty.
+ - unssociated_stas shall be empty.
+
+The AVLN with the index 0 (the Stations AVLN) shall be present, i.e. the present flag shall be setted.
+
+Uninitialise
+------------
+
+Shall reset all the networks and call on each one the uninit function.
+
+For that some station will be create in each AVLN.
+
+AVLN 0:
+ - Station 1, TEI = 1, Mac @ = 11, is_cco = true.
+ - Station 2, TEI = 2, Mac @ = 12, is_cco = false, is_pco = true.
+
+AVLN 1:
+ - Station 1, TEI = 1, Mac @ = 21, is_cco = true.
+ - Station 2, TEI = 2, Mac @ = 22, is_cco = false, is_pco = true.
+ - Station 3, TEI = 3, Mac @ = 23.
+ - Station 4, TEI = 4, Mac @ = 24.
+
+AVLN 2:
+ - Station 1, TEI = 1, Mac @ = 31, is_cco = true.
+ - Station 2, TEI = 2, Mac @ = 32.
+ - Station 3, TEI = 3, Mac @ = 33.
+ - Station 4, TEI = 4, Mac @ = 34.
+
+At the end of this test case, all the station list shall be empty and the CCo, PCo pointer reseted.
+
+
+Add an AVLN
+-----------
+
+Create the AVLN and verify that it is possible to get it back using the get
+AVLN function.
+
+AVLN data:
+ - SNID = 1
+ - NID = 1
+
+The AVLN returned by the add function shall be in the following state:
+ - SNID = 1
+ - NID = 1
+ - present = true
+ - station_avln = false
+ - cco = null
+ - pco = null
+ - expiration_ntb = CP_NET_EXPIRATION_DELAY (see cp/defs.h)
+ - associated_stas = empty (use set_empty function).
+ - unassociated_stas = empty (use set_empty function).
+
+Remove an AVLN
+--------------
+
+Same thing as uninitializing an AVLN.
+
+Add an AVLN and remove it only using the SNID and NID.
+
+AVLN Data:
+ - SNID = 1
+ - NID = 1.
+
+At the end of the test this AVLN shall not exists.
+
+Update Station's SNID
+---------------------
+
+Modify the AVLN's SNID.
+
+Is empty
+--------
+
+Verify the presence of others AVLN on the medium.
+
+SNID present
+------------
+
+Return a flag indicating which SNID is currently in use.
+
+Environment 3 AVLNs with SNID 1, 5, 10.
+
+At the end of the test the flag shall contain 0x211.
+
+Get slot usage
+--------------
+
+Environment
+
+Result
+ This function shall return 0x94.
+ Add three AVLN in the station manager configured as followed:
+
+ * AVLN 1 : Slot id = 4;
+ * AVLN 2 : Slot id = 7;
+ * AVLN 3 : Slot id = 2;
+
+ This makes a slot usage equal to 0x94.
+
+Result
+ This function shall return 0x94.
diff --git a/cesar/cp/eoc/sta/mgr/test/utest/doc/sta.txt b/cesar/cp/eoc/sta/mgr/test/utest/doc/sta.txt
new file mode 100644
index 0000000000..e711621277
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/test/utest/doc/sta.txt
@@ -0,0 +1,44 @@
+Station
+=======
+
+Get tei
+-------
+
+Allow any user to get a copy of the station TEI.
+
+Result
+~~~~~~
+
+Returns the correct value.
+
+Get Mac address
+---------------
+
+Allow any user to get a copy of the Station's Mac address.
+
+Result
+~~~~~~
+
+Returns the correct value.
+
+Get CCo status
+--------------
+
+Allow any user to get a copy of the station CCo status.
+
+Result
+~~~~~~
+
+Returns the correct value.
+
+
+Get PCo status
+---------------
+
+Allow any user to get a copy of the Station's Pco.
+
+Result
+~~~~~~
+
+Returns the correct value.
+
diff --git a/cesar/cp/eoc/sta/mgr/test/utest/doc/sta_mgr.txt b/cesar/cp/eoc/sta/mgr/test/utest/doc/sta_mgr.txt
new file mode 100644
index 0000000000..6fcf407725
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/test/utest/doc/sta_mgr.txt
@@ -0,0 +1,14 @@
+Station Manager
+===============
+
+Initialise
+----------
+
+This shall call the function init of the net_list and the init function of the
+STA own data.
+
+Uninitialise
+------------
+
+This will call the uninit function to the net_list and the station own data.
+
diff --git a/cesar/cp/eoc/sta/mgr/test/utest/doc/sta_own_data.txt b/cesar/cp/eoc/sta/mgr/test/utest/doc/sta_own_data.txt
new file mode 100644
index 0000000000..ab302bcdd0
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/test/utest/doc/sta_own_data.txt
@@ -0,0 +1,111 @@
+Sta own data
+============
+
+Test the Sta own data private attributes which shall only be modified by the
+accessors.
+
+Status
+------
+
+Tested : under test.
+
+Initialise
+----------
+
+Initialise the private structure (this structure contains the public
+structure) and verify if all the data are setted to 0.
+
+Result
+~~~~~~
+
+- If all the values are equals to 0, the test succeed.
+- If any value is not equal to 0, the test fail.
+
+TEI
+---
+
+Shall update the STA own data to set the station TEI, and modified the Mac
+config structure data referenced in the CP to update the station TEI.
+
+Result
+~~~~~~
+
+- The mac config contains the correct TEI.
+- The station own data contains the correct TEI.
+
+Mac address
+-----------
+
+Shall update the sta own data to set the mac address and modified the mac
+config structure referenced in the CP to update the mac address.
+
+Result
+~~~~~~
+
+- The mac config contains the correct Mac address
+- The station own data contains the correct mac address.
+
+NPW
+---
+
+Shall set up the NPW in the station own data and request the module MSG to
+send a MME to the PLC Driver to store the modification in the flash memory.
+
+*TODO* : Add the API in the MSG module.
+
+Result
+~~~~~~
+
+- The NPW is stored correctly in the STA own data.
+
+NMK
+---
+
+Shall set up the NMK in the station own data and request the module MSG to
+send a MME to the PLC Driver to store the modification in the flash memory.
+
+*TODO* : Add the API in the MSG module.
+
+Result
+~~~~~~
+
+- The NMK is stored correctly in the STA own data.
+
+DPW
+---
+
+Shall set up the DPW in the station own data and request the module MSG to
+send a MME to the PLC Driver to store the modification in the flash memory.
+
+*TODO* : Add the API in the MSG module.
+
+Result
+~~~~~~
+
+- The DPW is stored correctly in the STA own data.
+
+Security level
+--------------
+
+Shall set the security level of the station and send a message to the PLC
+driver to store the SL in the flash memory.
+
+*TODO* : Add the API in the MSG module.
+
+Result
+~~~~~~
+
+- The security level is setted correctly in the station own data.
+
+Was CCo Status
+--------------
+
+Shall set the was CCo status and send a MME to the PLC driver to store the
+station cco status in the flash memory.
+
+*TODO* : Add the API in the MSG module.
+
+Result
+~~~~~~
+
+- The was_cco status is setted in the station own data.
diff --git a/cesar/cp/eoc/sta/mgr/test/utest/override/cp/cco/action/inc/context.h b/cesar/cp/eoc/sta/mgr/test/utest/override/cp/cco/action/inc/context.h
new file mode 100644
index 0000000000..ca3da3cf61
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/test/utest/override/cp/cco/action/inc/context.h
@@ -0,0 +1,26 @@
+#ifndef overide_cp_cco_action_inc_context_h
+#define overide_cp_cco_action_inc_context_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file overide/cp/cco/action/inc/context.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+
+#define CP_CCO_ACTION_TEI_FLAGS_ROW 8
+
+struct cp_cco_action_t
+{
+ /** TEI in use. */
+ uint tei_flags [CP_CCO_ACTION_TEI_FLAGS_ROW];
+};
+
+#endif /* overide_cp_cco_action_inc_context_h */
diff --git a/cesar/cp/eoc/sta/mgr/test/utest/override/cp/inc/context.h b/cesar/cp/eoc/sta/mgr/test/utest/override/cp/inc/context.h
new file mode 100644
index 0000000000..47d4eea571
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/test/utest/override/cp/inc/context.h
@@ -0,0 +1,57 @@
+#ifndef cp_inc_cp_h
+#define cp_inc_cp_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/inc/cp_private.h
+ * \brief Control plane context.
+ * \ingroup cp
+ *
+ */
+#include "lib/rnd.h"
+
+/* Public interfaces. */
+#include "cp/sta/mgr/sta_mgr.h"
+#include "cp/eoc/cco/action/cco_action.h"
+#include "cl/cl.h"
+#include "mac/common/config.h"
+#include "mac/sar/sar.h"
+
+/* Private interfaces. */
+#include "cp/sta/mgr/inc/sta_mgr.h"
+
+/* Override ones. */
+#include "cp/eoc/cco/action/inc/cco_action.h"
+
+struct cp_t
+{
+ /** station manager context. */
+ cp_sta_mgr_t sta_mgr;
+
+ /** Cl context. */
+ cl_t *cl;
+
+ /** Mac config */
+ mac_config_t *mac_config;
+
+ /** Mac store. */
+ mac_store_t *mac_store;
+
+ /** SAR layer context pointer. */
+ sar_t *sar;
+
+ /** CCo action */
+ cp_cco_action_t cco_action;
+
+ /** Random context. */
+ lib_rnd_t rnd;
+
+ void *bsu;
+};
+
+#endif /* cp_inc_cp_h */
diff --git a/cesar/cp/eoc/sta/mgr/test/utest/override/cp/sta/core/core.h b/cesar/cp/eoc/sta/mgr/test/utest/override/cp/sta/core/core.h
new file mode 100644
index 0000000000..a00e59f744
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/test/utest/override/cp/sta/core/core.h
@@ -0,0 +1,21 @@
+#ifndef overide_cp_sta_core_core_h
+#define overide_cp_sta_core_core_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file overide/cp/sta/core/core.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+
+u32
+cp_sta_core_get_date_ms (cp_t *cp);
+
+#endif /* overide_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/utest/override/mac/sar/inc/context.h b/cesar/cp/eoc/sta/mgr/test/utest/override/mac/sar/inc/context.h
new file mode 100644
index 0000000000..9e7c6f07ca
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/test/utest/override/mac/sar/inc/context.h
@@ -0,0 +1,23 @@
+#ifndef overide_mac_sar_inc_context_h
+#define overide_mac_sar_inc_context_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 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/mgr/test/utest/src/core_stub.c b/cesar/cp/eoc/sta/mgr/test/utest/src/core_stub.c
new file mode 100644
index 0000000000..c2dfaceccb
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/test/utest/src/core_stub.c
@@ -0,0 +1,23 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/core_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+
+u32
+cp_sta_core_get_date_ms (cp_t *cp)
+{
+ return 1;
+}
+
diff --git a/cesar/cp/eoc/sta/mgr/test/utest/src/net_test.c b/cesar/cp/eoc/sta/mgr/test/utest/src/net_test.c
new file mode 100644
index 0000000000..c4ef480f26
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/test/utest/src/net_test.c
@@ -0,0 +1,225 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/net_test.c
+ * \brief Test the net APIs
+ * \ingroup cp_sta_mgr
+ *
+ */
+#include "common/std.h"
+#include "test_sta_mgr.h"
+
+bool
+cp_net_station_assoc_less (set_node_t *left, set_node_t *right);
+
+bool
+cp_net_station_unassoc_less (set_node_t *left, set_node_t *right);
+
+void
+test_case_cp_net_init (test_t test)
+{
+ cp_t ctx;
+ cp_net_t net;
+ test_case_begin (test, "NET init");
+ test_begin (test, "init")
+ {
+ cp_net_init (&ctx, &net);
+ test_fail_unless (net.present == false);
+ }
+ test_end;
+}
+
+void
+test_case_cp_net_uninit (test_t test)
+{
+ cp_t cp;
+ test_sta_mgr_init (&cp);
+ test_case_begin (test, "uninit");
+ test_begin (test, "Net empty")
+ {
+ cp_net_t net;
+ cp_net_init (&cp, &net);
+ cp_net_uninit (&cp, &net);
+ test_fail_unless (set_empty (&net.associated_stas));
+ test_fail_unless (set_empty (&net.unassociated_stas));
+ test_fail_unless (!net.present);
+ }
+ test_end;
+
+ test_begin (test, "NET empty with NID SNID")
+ {
+ cp_net_t *net;
+ /* Initialise the comparison net. */
+ net = cp_sta_mgr_add_avln (&cp, 1, 1);
+ test_fail_unless (net->present);
+ cp_sta_mgr_remove_avln (&cp, net->snid, net->nid);
+ test_fail_unless (set_empty (&net->associated_stas));
+ test_fail_unless (set_empty (&net->unassociated_stas));
+ test_fail_unless (!net->present);
+ }
+ test_end;
+ test_sta_mgr_uninit (&cp);
+}
+
+void
+test_case_cp_net_get_snid_nid (test_t test)
+{
+ test_case_begin (test, "Get snid");
+
+ test_begin (test, "Get snid and nid from a NET")
+ {
+ cp_t cp;
+ cp_net_t net;
+
+ /* Configure the test. */
+ memset (&cp, 0, sizeof (cp_t));
+ memset (&net, 0, sizeof (cp_net_t));
+
+ net.snid = 0x1;
+ net.nid = 0x133456789ABCull;
+
+ test_fail_if (cp_net_get_snid (&cp, &net) != net.snid);
+ test_fail_if (cp_net_get_nid (&cp, &net) != net.nid);
+ }
+ test_end;
+}
+
+void
+test_case_cp_net_slot_usage (test_t test)
+{
+ test_case_begin (test, "Set, get slots and get slot mask");
+
+ test_begin (test, "Set slot id and mask")
+ {
+ cp_t cp;
+ cp_net_t net;
+
+ /* Configure the test. */
+ memset (&cp, 0, sizeof (cp_t));
+ memset (&net, 0, sizeof (cp_net_t));
+
+ cp_net_set_slot_id_and_usage (&cp, &net, 1, 2);
+
+ test_fail_if (cp_net_get_slot_id (&cp, &net) != 1);
+ test_fail_if (cp_net_get_slot_usage_mask (&cp, &net) != 2);
+ }
+ test_end;
+}
+
+void
+test_case_cp_net_nm (test_t test)
+{
+ test_case_begin (test, "Network mode");
+
+ test_begin (test, "Set the NM and GET it.")
+ {
+ cp_t cp;
+ cp_net_t net;
+
+ /* Configure the test. */
+ memset (&cp, 0, sizeof (cp_t));
+ memset (&net, 0, sizeof (cp_net_t));
+
+ 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, MAC_NM_CSMA_ONLY);
+ test_fail_if (cp_net_get_nm (&cp, &net) != MAC_NM_CSMA_ONLY);
+
+ cp_net_set_nm (&cp, &net, MAC_NM_UNCOORDINATED);
+ test_fail_if (cp_net_get_nm (&cp, &net) != MAC_NM_UNCOORDINATED);
+ }
+ test_end;
+}
+
+void
+test_case_cp_net_sta_visible (test_t test)
+{
+ test_case_begin (test, "visible stations");
+
+ test_begin (test, "Set")
+ {
+ cp_t cp;
+ cp_net_t *net;
+ cp_sta_t *sta;
+ /* Configure the test. */
+ test_sta_mgr_init (&cp);
+ net = cp_sta_mgr_add_avln (&cp, 1, 1);
+ sta = cp_sta_mgr_sta_add (&cp, net, 1, 1);
+ cp_sta_mgr_set_our_avln (&cp, net);
+ cp_sta_own_data_set_tei (&cp, 254);
+ /* the test. */
+ cp_sta_set_visible_status (
+ &cp, sta, CP_STA_VISIBLE_STATE_VISIBLE);
+ test_fail_unless (net->num_visible_stas == 1);
+ cp_sta_set_visible_status (
+ &cp, sta, CP_STA_VISIBLE_STATE_HIDDEN);
+ test_fail_unless (net->num_visible_stas == 0);
+ slab_release (sta);
+ test_sta_mgr_uninit (&cp);
+ }
+ test_end;
+}
+
+void
+test_case_cp_net_access (test_t test)
+{
+ test_case_begin (test, "Network Access type");
+
+ test_begin (test, "Network access type")
+ {
+ cp_t cp;
+ cp_net_t net;
+
+ /* Configuring the test. */
+ memset (&cp, 0, sizeof (cp_t));
+ memset (&net, 0, sizeof (cp_net_t));
+
+ /* Test. */
+ cp_net_set_access (&cp, &net, HPAV_ACCESS_ACCESS);
+ test_fail_if (net.access != HPAV_ACCESS_ACCESS);
+
+ cp_net_set_access (&cp, &net, HPAV_ACCESS_IN_HOME);
+ test_fail_if (net.access != HPAV_ACCESS_IN_HOME);
+ }
+ test_end;
+}
+
+void
+test_case_get_net (test_t test)
+{
+ test_case_begin (test, "Net of a STA");
+
+ test_begin (test, "Get the net of a STA")
+ {
+ cp_t cp;
+ cp_net_t *net;
+ cp_sta_t *sta;
+ /* Initialize. */
+ test_sta_mgr_init (&cp);
+ net = cp_sta_mgr_add_avln (&cp, 1, 1);
+ sta = cp_sta_mgr_sta_add (&cp, net, 1, 1);
+ test_fail_unless (cp_sta_get_net (sta) == net);
+ slab_release (sta);
+ test_sta_mgr_uninit (&cp);
+ }
+ test_end;
+}
+
+void
+test_suite_net (test_t test)
+{
+ test_suite_begin (test, "Net");
+ test_case_cp_net_init (test);
+ test_case_cp_net_uninit (test);
+ test_case_cp_net_get_snid_nid (test);
+ test_case_cp_net_slot_usage (test);
+ test_case_cp_net_nm (test);
+ test_case_cp_net_sta_visible (test);
+ test_case_cp_net_access (test);
+}
diff --git a/cesar/cp/eoc/sta/mgr/test/utest/src/sar_stub.c b/cesar/cp/eoc/sta/mgr/test/utest/src/sar_stub.c
new file mode 100644
index 0000000000..a9847bef57
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/test/utest/src/sar_stub.c
@@ -0,0 +1,50 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/sar_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "mac/sar/sar.h"
+#include "mac/sar/inc/context.h"
+
+/**
+ * Remove a station from the SAR and the mac store.
+ * \param ctx the CP context.
+ * \param tei the station tei.
+ *
+ * Remove all the MFS from the expiration mechanism of the SAR and ends to
+ * remove the station from the mac store.
+ */
+void
+sar_sta_remove (sar_t *ctx, u8 tei)
+{
+ dbg_assert (ctx);
+ dbg_assert (ctx->mac_store);
+ dbg_assert (tei);
+
+ dbg_check (mac_store_sta_remove (ctx->mac_store, tei));
+}
+
+void
+sar_cleanup (sar_t *ctx)
+{
+ mfs_tx_t *mfs;
+ dbg_assert (ctx);
+
+ mfs = mac_store_mfs_get_tx (ctx->mac_store, true, false, 1,
+ MAC_TEI_BCAST);
+ if (mfs)
+ {
+ mac_store_mfs_remove (ctx->mac_store, (mfs_t *) mfs);
+ blk_release (mfs);
+ }
+}
diff --git a/cesar/cp/eoc/sta/mgr/test/utest/src/sta-test.c b/cesar/cp/eoc/sta/mgr/test/utest/src/sta-test.c
new file mode 100644
index 0000000000..dd1d4b80d4
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/test/utest/src/sta-test.c
@@ -0,0 +1,689 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/sta-test.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "lib/test.h"
+#include "lib/bitstream.h"
+
+#include "cp/sta/mgr/sta_own_data.h"
+
+#include "cp/inc/context.h"
+#include "cp/sta/mgr/inc/sta_own_data.h"
+
+#include "cl/inc/context.h"
+#include "mac/sar/inc/context.h"
+#include <string.h>
+#include "cp/fsm/fsm.h"
+
+static void
+test_sta_own_init (cp_t *cp)
+{
+ static mac_config_t mac_config;
+ static cl_t cl;
+ static sar_t sar;
+ 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));
+ 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);
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (cp);
+}
+
+static void
+test_sta_own_uninit (cp_t *cp)
+{
+ cp_sta_mgr_uninit (cp);
+ mac_store_uninit (cp->mac_store);
+ lib_stats_uninit ();
+}
+
+void
+test_case_cp_sta_own_data_init (test_t test)
+{
+ test_case_begin (test, "init");
+
+ test_begin (test, "init")
+ {
+ cp_t cp;
+ cp_sta_own_data_private_t cmp;
+ cp_sta_own_data_private_t *real;
+
+ memset (&cmp, 0, sizeof (cp_sta_own_data_private_t));
+ cmp.public.hybrid_mode = MAC_COEXISTENCE_AV_ONLY_MODE; /* EoC spec. */
+
+ test_sta_own_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);
+ test_fail_if (
+ memcmp(&cmp, real, sizeof (cp_sta_own_data_private_t)) != 0);
+
+ test_sta_own_uninit (&cp);
+ }
+ test_end;
+}
+
+void
+test_case_cp_sta_own_data__set_and_get_tei (test_t test)
+{
+ test_case_begin (test, "Set Get tei");
+
+ test_begin (test, "Set")
+ {
+ cp_t cp;
+ cp_net_t *net;
+ test_sta_own_init (&cp);
+ // Add an AVLN.
+ net = cp_sta_mgr_add_avln (&cp, 1, 1);
+ cp_sta_mgr_set_our_avln (&cp, net);
+
+ cp_sta_own_data_set_tei (&cp, 2);
+
+ test_fail_if (cp_sta_own_data_get_tei (&cp) != 2);
+
+ cp_sta_own_data_set_tei (&cp, 2);
+ test_fail_if (cp_sta_own_data_get_tei (&cp) != 2);
+
+ cp_sta_own_data_set_tei (&cp, MAC_TEI_UNASSOCIATED);
+ test_fail_unless (cp_sta_own_data_get_tei (&cp) ==
+ MAC_TEI_UNASSOCIATED);
+ test_sta_own_uninit (&cp);
+ }
+ test_end;
+}
+
+void
+test_case_cp_sta_own_data__mac_address (test_t test)
+{
+ test_case_begin (test, "Mac address");
+
+ test_begin (test, "Set and Get the mac address")
+ {
+ cp_t cp;
+
+ mac_config_t mac_config;
+ cp.mac_config = &mac_config;
+ lib_stats_init ();
+ lib_rnd_init (&cp.rnd, 0x432);
+
+ 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) !=
+ 0x123456789ABCull);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+}
+
+void
+test_case_cp_sta_own_data__npw (test_t test)
+{
+ test_case_begin (test, "Set and get the NPW");
+
+ test_begin (test, "NPW")
+ {
+ cp_t cp;
+
+ lib_stats_init ();
+ lib_rnd_init (&cp.rnd, 0x432);
+ cp_eoc_sta_mgr_init (&cp);
+ cp_sta_own_data_set_npw (&cp, "Hello world");
+
+ test_fail_if (
+ strcmp (cp_sta_own_data_get_npw (&cp), "Hello world") != 0);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+}
+
+void
+test_case_cp_sta_own_data__nmk (test_t test)
+{
+ test_case_begin (test, "Set and get the NMK");
+
+ test_begin (test, "NMK")
+ {
+ cp_t cp;
+ cp_key_t key;
+ cp_key_t res;
+ bool changed;
+
+ key.key[0] = 0x1234;
+ key.key[1] = 0x5678;
+ key.key[2] = 0x9abc;
+ key.key[3] = 0xdef0;
+
+ lib_stats_init ();
+ lib_rnd_init (&cp.rnd, 0x432);
+ cp_eoc_sta_mgr_init (&cp);
+ changed = cp_sta_own_data_set_nmk (&cp, key, 0);
+
+ res = cp_sta_own_data_get_nmk (&cp);
+
+ test_fail_if (changed == false);
+ test_fail_if (memcmp (&res, &key, sizeof (cp_key_t)) != 0);
+
+ changed = cp_sta_own_data_set_nmk (&cp, key, 0);
+ test_fail_if (changed == true);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+}
+
+void
+test_case_cp_sta_own_data__dpw (test_t test)
+{
+ test_case_begin (test, "Set and get the DPW");
+
+ test_begin (test, "DPW")
+ {
+ cp_t cp;
+
+ lib_stats_init ();
+ lib_rnd_init (&cp.rnd, 0x432);
+ cp_eoc_sta_mgr_init (&cp);
+ cp_sta_own_data_set_dpw (&cp, "Hello world");
+
+ test_fail_if (
+ strcmp (cp_sta_own_data_get_dpw (&cp), "Hello world") != 0);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+}
+
+void
+test_case_cp_sta_own_data__security_level (test_t test)
+{
+ test_case_begin (test, "Set and get the SL");
+
+ test_begin (test, "SL")
+ {
+ cp_t cp;
+
+ lib_stats_init ();
+ lib_rnd_init (&cp.rnd, 0x432);
+ 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) !=
+ CP_SECURITY_LEVEL_SC);
+
+ cp_sta_own_data_set_security_level (&cp, CP_SECURITY_LEVEL_HS);
+
+ test_fail_if (cp_sta_own_data_get_security_level (&cp) !=
+ CP_SECURITY_LEVEL_HS);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+}
+
+void
+test_case_cp_sta_own_data__was_cco (test_t test)
+{
+ test_case_begin (test, "Set and get was_cco");
+
+ test_begin (test, "was_cco")
+ {
+ cp_t cp;
+
+ lib_stats_init ();
+ lib_rnd_init (&cp.rnd, 0x432);
+ 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);
+ test_fail_if (cp_sta_own_data_get_was_cco (&cp) != false);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+
+}
+
+void
+test_case_cp_sta_own_data__hfid_avln (test_t test)
+{
+ test_case_begin (test, "Set and get the AVLN HFID");
+
+ test_begin (test, "AVLN HFID")
+ {
+ cp_t cp;
+ cp_sta_own_data_t *sta;
+
+ lib_stats_init ();
+ lib_rnd_init (&cp.rnd, 0x432);
+ 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");
+
+ test_fail_if (
+ strcmp (sta->hfid_avln, "Hello world") != 0);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+}
+
+void
+test_case_cp_sta_own_data__hfid_user (test_t test)
+{
+ test_case_begin (test, "Set and get the USER HFID");
+
+ test_begin (test, "USER HFID")
+ {
+ cp_t cp;
+ cp_sta_own_data_t *sta;
+
+ lib_stats_init ();
+ lib_rnd_init (&cp.rnd, 0x432);
+ 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");
+
+ test_fail_if (
+ strcmp (sta->hfid_user, "Hello world") != 0);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+}
+
+void
+test_case_cp_sta_own_data__hfid_manufacturer (test_t test)
+{
+ test_case_begin (test, "Set and get the MANUFACTURER HFID");
+
+ test_begin (test, "MANUFACTURER HFID")
+ {
+ cp_t cp;
+ cp_sta_own_data_t *sta;
+
+ lib_stats_init ();
+ lib_rnd_init (&cp.rnd, 0x432);
+ 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");
+
+ test_fail_if (
+ strcmp (sta->hfid_manufacturer, "Hello world") != 0);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+}
+
+void
+test_case_cp_sta_own_data__pco_glid (test_t test)
+{
+ test_case_begin (test, "Set and get the PCO glid");
+
+ test_begin (test, "PCo")
+ {
+ cp_t cp;
+ cp_sta_own_data_t *sta;
+
+ lib_stats_init ();
+ lib_rnd_init (&cp.rnd, 0x432);
+ 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);
+ cp_sta_own_data_set_pco_glid (&cp, 0x0);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+}
+
+void
+test_case_cp_sta_own_data__pco_status (test_t test)
+{
+ test_case_begin (test, "Set and get the PCO status");
+
+ test_begin (test, "PCo")
+ {
+ cp_t cp;
+ cp_sta_own_data_t *sta;
+
+ lib_stats_init ();
+ lib_rnd_init (&cp.rnd, 0x432);
+ cp_eoc_sta_mgr_init (&cp);
+ sta = cp_sta_mgr_get_sta_own_data (&cp);
+
+ cp_sta_own_data_set_pco_status (&cp, true);
+ test_fail_if (cp_sta_own_data_get_pco_status (&cp) != true);
+
+ cp_sta_own_data_set_pco_status (&cp, true);
+ test_fail_if (cp_sta_own_data_get_pco_status (&cp) != true);
+
+ cp_sta_own_data_set_pco_status (&cp, false);
+ test_fail_if (cp_sta_own_data_get_pco_status (&cp) != false);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+
+ test_begin (test, "PCo and glid")
+ {
+ cp_t cp;
+ cp_sta_own_data_t *sta;
+
+ lib_stats_init ();
+ lib_rnd_init (&cp.rnd, 0x432);
+ 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);
+
+ test_fail_if (cp_sta_own_data_get_pco_status (&cp) != true);
+ test_fail_if (cp_sta_own_data_get_pco_glid (&cp) != 0x85);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+}
+
+void
+test_case_cp_sta_own_data__cco_status (test_t test)
+{
+ test_case_begin (test, "Set and get the CCo status");
+
+ test_begin (test, "CCo")
+ {
+ cp_t cp;
+ cp_net_t *net;
+ mac_config_t mac_config;
+ cp_sta_own_data_t *sta;
+ cl_t cl;
+ sar_t sar;
+
+ cp.mac_config = &mac_config;
+ cl.mactotei = NULL;
+ cp.cl = &cl;
+ cp.sar = &sar;
+ cp.mac_store = mac_store_init ();
+ sar.mac_store = cp.mac_store;
+
+ lib_stats_init ();
+ lib_rnd_init (&cp.rnd, 0x432);
+ cp_eoc_sta_mgr_init (&cp);
+ net = cp_sta_mgr_add_avln (&cp, 1, 1);
+ cp_sta_mgr_set_our_avln (&cp, net);
+
+ sta = cp_sta_mgr_get_sta_own_data (&cp);
+ cp_sta_own_data_set_tei (&cp, 1);
+
+ cp_sta_own_data_set_cco_status (&cp, true);
+ test_fail_if (cp_sta_own_data_get_cco_status (&cp) != true);
+
+ cp_sta_own_data_set_cco_status (&cp, true);
+ test_fail_if (cp_sta_own_data_get_cco_status (&cp) != true);
+
+ cp_sta_own_data_set_cco_status (&cp, false);
+ test_fail_if (cp_sta_own_data_get_cco_status (&cp) != false);
+
+ cp_sta_mgr_uninit (&cp);
+ mac_store_uninit (cp.mac_store);
+ lib_stats_uninit ();
+ }
+ test_end;
+}
+
+void
+test_case_cp_sta_own_data__authenticated_status (test_t test)
+{
+ test_case_begin (test, "Set and get the CCo authenticated");
+
+ test_begin (test, "CCo")
+ {
+ cp_t cp;
+ cp_net_t *net;
+ mac_config_t mac_config;
+ cp_sta_own_data_t *sta;
+ cl_t cl;
+ sar_t sar;
+
+ cp.mac_config = &mac_config;
+ cl.mactotei = NULL;
+ cp.cl = &cl;
+ cp.sar = &sar;
+ cp.mac_store = mac_store_init ();
+ sar.mac_store = cp.mac_store;
+
+ lib_stats_init ();
+ lib_rnd_init (&cp.rnd, 0x432);
+ cp_eoc_sta_mgr_init (&cp);
+ net = cp_sta_mgr_add_avln (&cp, 1, 1);
+ cp_sta_mgr_set_our_avln (&cp, net);
+
+ sta = cp_sta_mgr_get_sta_own_data (&cp);
+ cp_sta_own_data_set_tei (&cp, 1);
+
+ cp_sta_own_data_set_authenticated_status (&cp, true);
+ test_fail_if (cp_sta_own_data_get_authenticated_status (&cp) != true);
+
+ cp_sta_own_data_set_authenticated_status (&cp, true);
+ test_fail_if (cp_sta_own_data_get_authenticated_status (&cp) != true);
+
+ cp_sta_own_data_set_authenticated_status (&cp, false);
+ test_fail_if (cp_sta_own_data_get_authenticated_status (&cp) != false);
+
+ cp_sta_mgr_uninit (&cp);
+ mac_store_uninit (cp.mac_store);
+ lib_stats_uninit ();
+ }
+ test_end;
+}
+
+void
+test_case_cp_sta_own_data__nid (test_t test)
+{
+ test_case_begin (test, "Set/Get NID & SL");
+
+ test_begin (test, "")
+ {
+ cp_t cp;
+
+ lib_stats_init ();
+ lib_rnd_init (&cp.rnd, 0x432);
+ cp_eoc_sta_mgr_init (&cp);
+
+ lib_rnd_t rnd;
+ lib_rnd_init (&rnd, 0x4224);
+
+ cp_security_level_t sl;
+ for (sl = CP_SECURITY_LEVEL_SC; sl < CP_SECURITY_LEVEL_NB; sl++)
+ {
+ uint i;
+ for (i = 0; i < 1234; i++)
+ {
+ cp_nid_t nid = ((u64) sl) << (HPAV_NID_SIZE_BITS - 2)
+ | lib_rnd_uniform (&rnd, -1);
+ cp_sta_own_data_set_nid (&cp, nid);
+ test_fail_if (cp_sta_own_data_get_nid (&cp) != nid);
+ test_fail_if (cp_sta_own_data_get_security_level (&cp) != sl);
+ }
+ }
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+}
+
+void
+test_case_cp_sta_own_data__snid (test_t test)
+{
+ test_case_begin (test, "Set and GET SNID");
+
+ test_begin (test, "")
+ {
+ cp_t cp;
+
+ lib_stats_init ();
+ lib_rnd_init (&cp.rnd, 0x432);
+ 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);
+ cp_sta_own_data_set_snid (&cp, 0x1);
+ test_fail_if (cp_sta_own_data_get_snid (&cp) != 0x1);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+}
+
+void
+test_case_cp_sta_own_data__tek (test_t test)
+{
+ test_case_begin (test, "Set the TEK");
+
+ test_begin (test, "TEK")
+ {
+ cp_t cp;
+ cp_key_t key;
+ cp_key_t tek;
+
+ lib_stats_init ();
+ lib_rnd_init (&cp.rnd, 0x432);
+ cp_eoc_sta_mgr_init (&cp);
+
+ key.key[0] = 0x12345678;
+ key.key[1] = 0x12345678;
+ key.key[2] = 0x12345678;
+ key.key[3] = 0x12345678;
+
+ cp_sta_own_data_set_tek (&cp, key);
+
+ tek = cp_sta_own_data_get_tek (&cp);
+
+ test_fail_unless (memcmp (&tek, &key, sizeof (cp_key_t)) == 0);
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+}
+
+void
+test_case_cp_sta_own_data__dak (test_t test)
+{
+ test_case_begin (test, "DAK");
+
+ test_begin (test, "store dak")
+ {
+ cp_t cp;
+ uint i;
+ cp_key_t dak = { {0x11111111, 0x22222222, 0x33333333, 0x44444444} };
+ cp_key_t own_dak;
+
+ memset (&cp, 0, sizeof (cp_t));
+
+ lib_stats_init ();
+ lib_rnd_init (&cp.rnd, 0x432);
+ cp_eoc_sta_mgr_init (&cp);
+
+ cp_sta_own_data_set_dak (&cp, dak);
+ own_dak = cp_sta_own_data_get_dak (&cp);
+
+ for (i = 0; i < COUNT (dak.key); i++)
+ test_fail_unless (dak.key[i] == own_dak.key[i]);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+}
+
+void
+test_case_cp_sta_own_data__sc (test_t test)
+{
+ test_case_begin (test, "Simple connect");
+
+ test_begin (test, "")
+ {
+ cp_t cp;
+
+ memset (&cp, 0, sizeof (cp_t));
+ lib_stats_init ();
+ lib_rnd_init (&cp.rnd, 0x432);
+ cp_eoc_sta_mgr_init (&cp);
+
+ cp_sta_own_data_set_sc (&cp, true);
+ test_fail_unless (cp.sta_mgr.sta_own_data.sc == true);
+ test_fail_unless (cp_sta_own_data_get_sc (&cp) == true);
+
+ cp_sta_own_data_set_sc (&cp, true);
+ test_fail_unless (cp.sta_mgr.sta_own_data.sc == true);
+ test_fail_unless (cp_sta_own_data_get_sc (&cp) == true);
+
+ cp_sta_own_data_set_sc (&cp, false);
+ test_fail_unless (cp.sta_mgr.sta_own_data.sc == false);
+ test_fail_unless (cp_sta_own_data_get_sc (&cp) == false);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+}
+
+void
+test_suite_sta_own (test_t test)
+{
+ test_suite_begin (test, "station own data");
+ test_case_cp_sta_own_data_init (test);
+ test_case_cp_sta_own_data__set_and_get_tei (test);
+ test_case_cp_sta_own_data__mac_address (test);
+ test_case_cp_sta_own_data__npw (test);
+ test_case_cp_sta_own_data__nmk (test);
+ test_case_cp_sta_own_data__dpw (test);
+ test_case_cp_sta_own_data__security_level (test);
+ test_case_cp_sta_own_data__was_cco (test);
+ test_case_cp_sta_own_data__hfid_avln (test);
+ test_case_cp_sta_own_data__hfid_user (test);
+ test_case_cp_sta_own_data__hfid_manufacturer (test);
+ test_case_cp_sta_own_data__pco_glid (test);
+ test_case_cp_sta_own_data__pco_status (test);
+ test_case_cp_sta_own_data__cco_status (test);
+ test_case_cp_sta_own_data__authenticated_status (test);
+ test_case_cp_sta_own_data__nid (test);
+ test_case_cp_sta_own_data__snid (test);
+ test_case_cp_sta_own_data__tek (test);
+ test_case_cp_sta_own_data__dak (test);
+ test_case_cp_sta_own_data__sc (test);
+}
diff --git a/cesar/cp/eoc/sta/mgr/test/utest/src/sta_mgr.c b/cesar/cp/eoc/sta/mgr/test/utest/src/sta_mgr.c
new file mode 100644
index 0000000000..45154c8b47
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/test/utest/src/sta_mgr.c
@@ -0,0 +1,1584 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/sta_mgr.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "lib/test.h"
+#include "test_sta_mgr.h"
+
+#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)
+{
+ test_case_begin (test, "Station manager using stations");
+
+ 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;
+
+ /* configuring the test. */
+ memset (&cp, 0, sizeof (cp_t));
+ 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;
+
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
+
+ net = cp_sta_mgr_add_avln (&cp, 1, 1);
+ dbg_check (net);
+
+ /* Add the station. */
+ sta = cp_sta_mgr_sta_add (&cp, net, 0, mac_addr);
+ test_fail_if (sta == NULL);
+ slab_release (sta);
+
+ /* Find the station by the mac address. */
+ sta = cp_sta_mgr_sta_get_from_mac (&cp, mac_addr);
+ test_fail_if (sta == NULL);
+ test_fail_if (cp_sta_get_mac_address (sta) != mac_addr);
+ slab_release (sta);
+
+ /* Remove the station. */
+ cp_sta_mgr_sta_remove_from_mac (&cp, mac_addr);
+ sta = cp_sta_mgr_sta_get_from_mac (&cp, mac_addr);
+ test_fail_if (sta != NULL);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+
+ test_begin (test, "Station associated")
+ {
+ cp_t cp;
+ cp_net_t *net;
+ 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));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
+ cp.mac_config = &mac_config;
+ mac_addr = 0x12345678ABCull;
+ sta_tei = 0xB;
+
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
+
+ net = cp_sta_mgr_add_avln (&cp, 1, 1);
+ dbg_check (net);
+
+ /* Add a station associated. */
+ sta = cp_sta_mgr_sta_add (&cp, net, sta_tei, mac_addr);
+ test_fail_if (sta == NULL);
+ slab_release (sta);
+
+ /* Get the station by the TEI. */
+ sta = cp_sta_mgr_sta_get_assoc (&cp, net, sta_tei);
+ test_fail_if (sta == NULL);
+ slab_release (sta);
+
+ /* Get the station by the mac address. */
+ sta = cp_sta_mgr_sta_get_from_mac (&cp, mac_addr);
+ test_fail_if (sta == NULL);
+ slab_release (sta);
+
+ /* Remove the station by the TEI. */
+ cp_sta_mgr_sta_remove_assoc (&cp, net, sta_tei);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+
+ test_begin (test, "station Case 1: Nothing change")
+ {
+ cp_t cp;
+ cp_net_t *net;
+ cp_sta_t *sta;
+ cp_sta_t *sta2;
+ mac_t mac_addr;
+ mac_config_t mac_config;
+
+ /* configuring the test. */
+ memset (&cp, 0, sizeof (cp_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
+ cp.mac_config = &mac_config;
+ mac_addr = 0x12345678ABCull;
+
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
+
+ net = cp_sta_mgr_add_avln (&cp, 1, 1);
+ dbg_check (net);
+
+ /* Add a station unassociated. */
+ sta = cp_sta_mgr_sta_add (&cp, net, 0, mac_addr);
+ test_fail_if (sta == NULL);
+
+ /* Add a station with the same mac address and TEI. */
+ sta2 = cp_sta_mgr_sta_add (&cp, net, 0, mac_addr);
+ test_fail_if (sta != sta2);
+
+ /* release the stations. */
+ slab_release (sta);
+ slab_release (sta2);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+
+ test_begin (test, "station Case 2: Same TEI, Mac address change from bcast to unique")
+ {
+ cp_t cp;
+ cp_net_t *net;
+ 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));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
+ cp.mac_config = &mac_config;
+ mac_addr = 0x12345678ABCull;
+ sta_tei = 0xB;
+
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
+
+ net = cp_sta_mgr_add_avln (&cp, 1, 1);
+ dbg_check (net);
+
+ /* Add a station unassociated. */
+ sta = cp_sta_mgr_sta_add (&cp, net, sta_tei, MAC_BROADCAST);
+ test_fail_if (sta == NULL);
+ test_fail_if (cp_sta_get_tei (sta) != sta_tei);
+ test_fail_if (cp_sta_get_mac_address (sta) != MAC_BROADCAST);
+
+ test_fail_if (set_empty(&cp.sta_mgr.stas) != true);
+
+ /* Add a station with the real mac address. */
+ sta2 = cp_sta_mgr_sta_add (&cp, net, sta_tei, mac_addr);
+ test_fail_if (sta != sta2);
+
+ test_fail_if (cp_sta_get_tei (sta2) != sta_tei);
+ test_fail_if (cp_sta_get_mac_address (sta2) != mac_addr);
+
+ test_fail_if (set_empty(&cp.sta_mgr.stas) != false);
+ test_fail_if (set_empty(&net->associated_stas) != false);
+
+ /* release the stations. */
+ slab_release (sta);
+ slab_release (sta2);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+
+ test_begin (test, "station Case 2: Same TEI, Mac address change from A to B")
+ {
+ cp_t cp;
+ cp_net_t *net;
+ cp_sta_t *sta;
+ cp_sta_t *sta2;
+ 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));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
+ cp.mac_config=&mac_config;
+ mac_addrA = 0x12345678ABCull;
+ mac_addrB = 0x2345678ABCDull;
+ sta_tei = 0xB;
+
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
+
+ net = cp_sta_mgr_add_avln (&cp, 1, 1);
+ dbg_check (net);
+
+ /* Add a station unassociated. */
+ sta = cp_sta_mgr_sta_add (&cp, net, sta_tei, mac_addrA);
+ test_fail_if (sta == NULL);
+ test_fail_if (cp_sta_get_tei (sta) != sta_tei);
+ test_fail_if (cp_sta_get_mac_address (sta) != mac_addrA);
+
+ test_fail_if (set_empty(&cp.sta_mgr.stas) != false);
+
+ /* Add a station with the real mac address. */
+ sta2 = cp_sta_mgr_sta_add (&cp, net, sta_tei, mac_addrB);
+ test_fail_if (sta == sta2);
+
+ test_fail_if (cp_sta_get_tei (sta2) != sta_tei);
+ test_fail_if (cp_sta_get_mac_address (sta2) != mac_addrB);
+
+ test_fail_if (set_empty(&cp.sta_mgr.stas) != false);
+ test_fail_if (set_empty(&net->associated_stas) != false);
+
+ /* release the stations. */
+ slab_release (sta);
+ slab_release (sta2);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+
+ test_begin (test, "station Case 2: Change the TEI, Mac address unchanged")
+ {
+ cp_t cp;
+ cp_net_t *net;
+ 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));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
+ cp.mac_config=&mac_config;
+ mac_addr = 0x12345678ABCull;
+ sta_tei = 0xB;
+
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
+
+ net = cp_sta_mgr_add_avln (&cp, 1, 1);
+ dbg_check (net);
+
+ /* Add a station unassociated. */
+ sta = cp_sta_mgr_sta_add (&cp, net, 0, mac_addr);
+ test_fail_if (sta == NULL);
+ test_fail_if (cp_sta_get_tei (sta) != 0);
+ test_fail_if (cp_sta_get_mac_address (sta) != mac_addr);
+
+ test_fail_if (set_empty(&cp.sta_mgr.stas) != false);
+ test_fail_if (set_empty(&net->associated_stas) != true);
+ test_fail_if (set_empty(&net->unassociated_stas) != false);
+
+ /* Add a station with the real TEI. */
+ sta2 = cp_sta_mgr_sta_add (&cp, net, sta_tei, mac_addr);
+ test_fail_if (sta == sta2);
+
+ test_fail_if (cp_sta_get_tei (sta2) != sta_tei);
+ test_fail_if (cp_sta_get_mac_address (sta2) != mac_addr);
+
+ test_fail_if (set_empty(&cp.sta_mgr.stas) != false);
+ test_fail_if (set_empty(&net->associated_stas) != false);
+ test_fail_if (set_empty(&net->unassociated_stas) != true);
+
+ /* release the stations. */
+ slab_release (sta);
+ slab_release (sta2);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+
+ test_begin (test, "station Case 2: Change the TEI A to B, Mac address unchanged")
+ {
+ cp_t cp;
+ cp_net_t *net;
+ cp_sta_t *sta;
+ cp_sta_t *sta2;
+ 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));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+ cp.mac_config=&mac_config;
+ mac_addr = 0x12345678ABCull;
+
+ sta_tei_A = 0xB;
+ sta_tei_B = 0xF;
+
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
+
+ net = cp_sta_mgr_add_avln (&cp, 1, 1);
+ dbg_check (net);
+
+ /* Add a station associated. */
+ sta = cp_sta_mgr_sta_add (&cp, net, sta_tei_A, mac_addr);
+ test_fail_if (sta == NULL);
+ test_fail_if (cp_sta_get_tei (sta) != sta_tei_A);
+ test_fail_if (cp_sta_get_mac_address (sta) != mac_addr);
+
+ test_fail_if (set_empty(&cp.sta_mgr.stas) != false);
+ test_fail_if (set_empty(&net->associated_stas) != false);
+ test_fail_if (set_empty(&net->unassociated_stas) != true);
+
+ /* Add a station with the real TEI. */
+ sta2 = cp_sta_mgr_sta_add (&cp, net, sta_tei_B, mac_addr);
+ test_fail_if (sta != sta2);
+
+ test_fail_if (cp_sta_get_tei (sta2) != sta_tei_B);
+ test_fail_if (cp_sta_get_mac_address (sta2) != mac_addr);
+
+ test_fail_if (set_empty(&cp.sta_mgr.stas) != false);
+ test_fail_if (set_empty(&net->associated_stas) != false);
+ test_fail_if (set_empty(&net->unassociated_stas) != true);
+
+ /* release the stations. */
+ slab_release (sta);
+ slab_release (sta2);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+
+ test_begin (test, "station Case 4: Change the Mac address from A to bcast")
+ {
+ cp_t cp;
+ cp_net_t *net;
+ 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));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+ cp.mac_config=&mac_config;
+ mac_addr = 0x12345678ABCull;
+
+ sta_tei = 0xB;
+
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
+
+ net = cp_sta_mgr_add_avln (&cp, 1, 1);
+ dbg_check (net);
+
+ /* Add a station associated. */
+ sta = cp_sta_mgr_sta_add (&cp, net, sta_tei, mac_addr);
+ test_fail_if (sta == NULL);
+ test_fail_if (cp_sta_get_tei (sta) != sta_tei);
+ test_fail_if (cp_sta_get_mac_address (sta) != mac_addr);
+
+ test_fail_if (set_empty(&cp.sta_mgr.stas) != false);
+ test_fail_if (set_empty(&net->associated_stas) != false);
+ test_fail_if (set_empty(&net->unassociated_stas) != true);
+
+ /* Add a station with the new Mac address. */
+ sta2 = cp_sta_mgr_sta_add (&cp, net, sta_tei, MAC_BROADCAST);
+ test_fail_if (sta != sta2);
+
+ test_fail_if (cp_sta_get_tei (sta2) != sta_tei);
+ test_fail_if (cp_sta_get_mac_address (sta2) != mac_addr);
+
+ test_fail_if (set_empty(&cp.sta_mgr.stas) != false);
+ test_fail_if (set_empty(&net->associated_stas) != false);
+ test_fail_if (set_empty(&net->unassociated_stas) != true);
+
+ /* release the stations. */
+ slab_release (sta);
+ slab_release (sta2);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+
+ test_begin (test, "station Case 2: Change the network")
+ {
+ cp_t cp;
+ cp_net_t *net;
+ cp_net_t *net2;
+ 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));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
+ cp.mac_config=&mac_config;
+ mac_addr = 0x12345678ABCull;
+
+ sta_tei = 0xB;
+
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
+
+ net = cp_sta_mgr_add_avln (&cp, 1, 1);
+ dbg_check (net);
+ net2 = cp_sta_mgr_add_avln (&cp, 2, 2);
+ dbg_check (net2);
+
+ /* Add a station associated. */
+ sta = cp_sta_mgr_sta_add (&cp, net, sta_tei, mac_addr);
+ test_fail_if (sta == NULL);
+ test_fail_if (cp_sta_get_tei (sta) != sta_tei);
+ test_fail_if (cp_sta_get_mac_address (sta) != mac_addr);
+
+ test_fail_if (set_empty(&cp.sta_mgr.stas) != false);
+ test_fail_if (set_empty(&net->associated_stas) != false);
+ test_fail_if (set_empty(&net->unassociated_stas) != true);
+
+ /* Add a station in another network. */
+ sta2 = cp_sta_mgr_sta_add (&cp, net2, sta_tei, mac_addr);
+ test_fail_if (sta == sta2);
+
+ test_fail_if (cp_sta_get_tei (sta2) != sta_tei);
+ test_fail_if (cp_sta_get_mac_address (sta2) != mac_addr);
+
+ test_fail_if (set_empty(&cp.sta_mgr.stas) != false);
+ test_fail_if (set_empty(&net->associated_stas) != true);
+ test_fail_if (set_empty(&net->unassociated_stas) != true);
+
+ test_fail_if (set_empty(&net2->associated_stas) != false);
+ test_fail_if (set_empty(&net2->unassociated_stas) != true);
+
+ /* release the stations. */
+ slab_release (sta);
+ slab_release (sta2);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+
+ test_case_begin (test, "Sta Remove");
+
+ test_begin (test, "remove from mac")
+ {
+ 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);
+ slab_release (sta);
+
+ cp_sta_mgr_sta_remove_from_mac (&cp, 1);
+
+ sta = cp_sta_mgr_sta_get_from_mac(&cp, 1);
+ test_fail_unless (sta == NULL);
+
+ /* set our avln. */
+ cp_sta_mgr_set_our_avln (&cp, net);
+ sta = cp_sta_mgr_sta_add (&cp, net, 0, 1);
+ slab_release (sta);
+
+ cp_sta_mgr_sta_remove_from_mac (&cp, 1);
+ sta = cp_sta_mgr_sta_get_from_mac(&cp, 1);
+ test_fail_unless (sta == NULL);
+
+ sta = cp_sta_mgr_sta_add (&cp, net, 1, 1);
+ slab_release (sta);
+
+ cp_sta_mgr_sta_remove_from_mac (&cp, 1);
+ sta = cp_sta_mgr_sta_get_from_mac(&cp, 1);
+ test_fail_unless (sta == NULL);
+ test_sta_mgr_uninit (&cp);
+ }
+ test_end;
+
+ test_begin (test, "remove from assoc")
+ {
+ 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, 1, 1);
+ slab_release (sta);
+
+ cp_sta_mgr_sta_remove_assoc (&cp, net, 1);
+
+ sta = cp_sta_mgr_sta_get_from_mac(&cp, 1);
+ test_fail_unless (sta == NULL);
+
+ /* set our avln. */
+ cp_sta_mgr_set_our_avln (&cp, net);
+ sta = cp_sta_mgr_sta_add (&cp, net, 1, 1);
+ slab_release (sta);
+
+ cp_sta_mgr_sta_remove_assoc (&cp, net, 1);
+ sta = cp_sta_mgr_sta_get_from_mac(&cp, 1);
+ test_fail_unless (sta == NULL);
+ test_sta_mgr_uninit (&cp);
+ }
+ test_end;
+
+ test_begin (test, "remove")
+ {
+ 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, 1, 1);
+
+ cp_sta_mgr_sta_remove (&cp, sta);
+ slab_release (sta);
+
+ sta = cp_sta_mgr_sta_get_from_mac(&cp, 1);
+ test_fail_unless (sta == NULL);
+
+ /* set our avln. */
+ cp_sta_mgr_set_our_avln (&cp, net);
+ sta = cp_sta_mgr_sta_add (&cp, net, 1, 1);
+ slab_release (sta);
+
+ cp_sta_mgr_sta_remove (&cp, sta);
+ sta = cp_sta_mgr_sta_get_from_mac(&cp, 1);
+ test_fail_unless (sta == NULL);
+ test_sta_mgr_uninit (&cp);
+ }
+ test_end;
+}
+
+void
+test_case__cp_net_uninit (test_t test)
+{
+ test_case_begin (test, "Uninitialise the network with some stations");
+
+ test_begin (test, "net")
+ {
+ 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));
+
+ cp.mac_config=&mac_config;
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
+
+ /* Add an AVLN. */
+ net = cp_sta_mgr_add_avln (&cp, 1, 1);
+
+ test_fail_if (set_empty(&net->associated_stas) != true);
+ test_fail_if (set_empty(&net->unassociated_stas) != true);
+
+ /* Add some stations. */
+ sta = cp_sta_mgr_sta_add (&cp, net, 0, 1);
+ slab_release (sta);
+ sta = cp_sta_mgr_sta_add (&cp, net, 0, 2);
+ slab_release (sta);
+ sta = cp_sta_mgr_sta_add (&cp, net, 0, 3);
+ slab_release (sta);
+
+ sta = cp_sta_mgr_sta_add (&cp, net, 1, 4);
+ slab_release (sta);
+ sta = cp_sta_mgr_sta_add (&cp, net, 2, 5);
+ slab_release (sta);
+ sta = cp_sta_mgr_sta_add (&cp, net, 3, 6);
+ slab_release (sta);
+
+ test_fail_if (set_empty(&net->associated_stas) != false);
+ 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);
+ test_fail_if (set_empty(&cp.sta_mgr.stas) != true);
+ }
+ test_end;
+}
+
+void
+test_case__cp_sta_manager_garbage (test_t test)
+{
+ test_case_begin (test, "Garbage function");
+
+ test_begin (test, "Garbage outside our AVLN.")
+ {
+ cp_t cp;
+ cp_net_t *net1;
+ cp_net_t *net2;
+ 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));
+
+ cp.mac_config=&mac_config;
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
+ cp.cl = &cl;
+
+ /* Add an AVLN. */
+ net1 = cp_sta_mgr_add_avln (&cp, 1, 1);
+ net2 = cp_sta_mgr_add_avln (&cp, 2, 2);
+
+ for (i = 0; i < 10; i++)
+ {
+ sta = cp_sta_mgr_sta_add (&cp, net1, i + 1, i + 1);
+ sta->expired_date_ms = cp_sta_core_get_date_ms (&cp)
+ - HPAV_DISCOVERED_LIST_EXPIRE_TIME_MS;
+ slab_release (sta);
+
+ sta = cp_sta_mgr_sta_add (&cp, net2, i + 1, (i + 1) * 20);
+ sta->expired_date_ms = cp_sta_core_get_date_ms (&cp)
+ - HPAV_DISCOVERED_LIST_EXPIRE_TIME_MS;
+ slab_release (sta);
+ }
+
+ /* Release the stations. */
+ 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;
+
+ test_begin (test, "Associated stations")
+ {
+ cp_t cp;
+ cp_net_t *net;
+ cp_sta_t *sta;
+ mac_config_t mac_config;
+ cl_t cl;
+ sar_t sar;
+
+ /* configure the test.*/
+ memset (&cp, 0, sizeof (cp_t));
+ memset (&cl, 0, sizeof (cl_t));
+ memset (&sar, 0, sizeof (sar_t));
+ memset (&mac_config, 0, sizeof (mac_config_t));
+
+ 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);
+ cp.sta_mgr.our_avln = net;
+ cp.mac_store = mac_store_init ();
+ cp.mac_config = &mac_config;
+ cp.cl = &cl;
+ cp.sar = &sar;
+ sar.mac_store = cp.mac_store;
+
+ cp_sta_own_data_set_tei (&cp, 34);
+ cp_sta_own_data_set_cco_status (&cp, true);
+
+ /* Add some stations. */
+ sta = cp_sta_mgr_sta_add (&cp, net, 0x1, 123);
+ cp_sta_set_assoc_confirmed (&cp, sta, false);
+ sta->assoc_req_last_ms = 130000; /* > 2 min. */
+ slab_release (sta);
+
+ sta = cp_sta_mgr_sta_add (&cp, net, 0x3, 124);
+ cp_sta_set_assoc_confirmed (&cp, sta, false);
+ sta->assoc_req_last_ms = 60000; /* 1 min. */
+ slab_release (sta);
+
+ /* Test. */
+ cp_sta_mgr__assoc__timeout (&cp, 60000);
+
+ sta = cp_sta_mgr_sta_get_from_mac (&cp, 123);
+ test_fail_if (cp_sta_get_assoc_confirmed (&cp, sta) != false);
+ slab_release (sta);
+
+ sta = cp_sta_mgr_sta_get_from_mac (&cp, 124);
+ test_fail_if (cp_sta_get_assoc_confirmed (&cp, sta) != false);
+ slab_release (sta);
+
+ /* Test. */
+ cp_sta_mgr__assoc__timeout (&cp, 120000);
+
+ sta = cp_sta_mgr_sta_get_from_mac (&cp, 123);
+ test_fail_if (cp_sta_get_assoc_confirmed (&cp, sta) != false);
+ slab_release (sta);
+
+ sta = cp_sta_mgr_sta_get_from_mac (&cp, 124);
+ test_fail_if (cp_sta_get_assoc_confirmed (&cp, sta) != true);
+ slab_release (sta);
+
+ /* Station manager uninitialise. */
+ cp_sta_mgr_sta_remove_from_mac (&cp, 123);
+ cp_sta_mgr_sta_remove_from_mac (&cp, 124);
+ mac_store_uninit (cp.mac_store);
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+
+ test_begin (test, "Garbage the network")
+ {
+ cp_t cp;
+ cp_net_t *net;
+ cp_sta_t *sta;
+ 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;
+ 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);
+ sta->expired_date_ms = cp_sta_core_get_date_ms (&cp)
+ - HPAV_DISCOVERED_LIST_EXPIRE_TIME_MS - 10;
+ slab_release (sta);
+ /* Set our AVLN. */
+ cp_sta_mgr_set_our_avln (&cp, net);
+ /* Launch the test. */
+ 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_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;
+}
+
+void
+test_case__cp_net_pco (test_t test)
+{
+ test_case_begin (test, "Net pco");
+
+ test_begin (test, "PCo on the net")
+ {
+ 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));
+
+ cp.mac_config=&mac_config;
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
+
+ /* Add an AVLN. */
+ net = cp_sta_mgr_add_avln (&cp, 2, 2);
+
+ sta = cp_sta_mgr_sta_add (&cp, net, 1, 1);
+
+ /* Set the station as PCo. */
+ cp_net_set_pco (&cp, net, 1);
+
+ test_fail_if (cp_sta_get_pco_status (sta) != true);
+ test_fail_if (net->pco != sta);
+
+ /* Unset the PCo. */
+ cp_net_set_pco (&cp, net, 0);
+
+ test_fail_if (cp_sta_get_pco_status (sta) != false);
+ test_fail_if (net->pco != NULL);
+
+ slab_release (sta);
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+
+ }
+ test_end;
+}
+
+void
+test_case__cp_net_sta_get_first_next (test_t test)
+{
+ test_case_begin (test, "Get first and next");
+
+ test_begin (test, "Get the first and next station")
+ {
+ cp_t cp;
+ 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));
+
+ cp.mac_config=&mac_config;
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
+
+ /* Add an AVLN. */
+ net = cp_sta_mgr_add_avln (&cp, 2, 2);
+
+ sta1 = cp_sta_mgr_sta_add (&cp, net, 1, 1);
+ sta2 = cp_sta_mgr_sta_add (&cp, net, 2, 2);
+ slab_release (sta1);
+ slab_release (sta2);
+
+ /* Get the first station. */
+ sta1 = cp_net_sta_get_first (&cp, net, CP_NET_STA_ASSOC);
+ test_fail_if (sta1 == NULL);
+ test_fail_if (cp_sta_get_tei (sta1) != 1);
+
+ /* Get the next station. */
+ sta2 = cp_net_sta_get_next (&cp, net, sta1);
+ test_fail_if (sta2 == NULL);
+ test_fail_if (cp_sta_get_tei (sta2) != 2);
+
+ slab_release (sta2);
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+}
+
+void
+test_case__cp_sta_mgr_get_avln (test_t test)
+{
+ test_case_begin (test, "Get AVLN");
+
+ test_begin (test, "Get an AVLN")
+ {
+ cp_t cp;
+ uint i, j;
+ /* configuring the test. */
+ memset (&cp, 0, sizeof (cp_t));
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
+ for (i = 0; i < HPAV_AVLNS_NB_MAX; 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);
+ for (j = 0; j < HPAV_AVLNS_NB_MAX; j++)
+ {
+ if (i != j)
+ {
+ test_fail_unless (
+ cp.sta_mgr.networks[i].snid
+ != cp.sta_mgr.networks[j].snid);
+ test_fail_unless (
+ cp.sta_mgr.networks[i].nid
+ != cp.sta_mgr.networks[j].nid);
+ }
+ }
+ }
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+}
+
+void
+test_case__cp_sta_mgr_get_first_next_avln (test_t test)
+{
+ test_case_begin (test, "Get first and next AVLN");
+
+ test_begin (test, "Get first and next AVLN")
+ {
+ cp_t cp;
+ cp_net_t *net_cmp[3];
+ cp_net_t *net;
+
+ /* configuring the test. */
+ memset (&cp, 0, sizeof (cp_t));
+
+ lib_stats_init ();
+ cp_eoc_sta_mgr_init (&cp);
+
+ /* Add AVLN. */
+ net_cmp[0] = cp_sta_mgr_add_avln (&cp, 2, 2);
+ net_cmp[1] = cp_sta_mgr_add_avln (&cp, 3, 3);
+ net_cmp[2] = cp_sta_mgr_add_avln (&cp, 4, 4);
+
+ /* Get the AVLN. */
+ net = cp_sta_mgr_get_first_avln (&cp);
+ test_fail_if (net_cmp[0] != net);
+ net = cp_sta_mgr_get_next_avln (&cp, net);
+ test_fail_if (net_cmp[1] != net);
+ net = cp_sta_mgr_get_next_avln (&cp, net);
+ test_fail_if (net_cmp[2] != net);
+ net = cp_sta_mgr_get_next_avln (&cp, net);
+ test_fail_if (NULL != net);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+}
+
+void
+test_case__cp_net_is_empty (test_t test)
+{
+ test_case_begin (test, "Network is empty");
+
+ test_begin (test, "Network is empty")
+ {
+ cp_t cp;
+ cl_t cl;
+ sar_t sar;
+ cp_net_t *net;
+ cp_sta_t *sta;
+ 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));
+
+ 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;
+ 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++)
+ {
+ net = cp_sta_mgr_add_avln (&cp, i, i);
+ test_fail_unless (net);
+ }
+ test_fail_unless (cp_sta_mgr_net_list_is_empty (&cp) == false);
+ /* Set our AVLN. */
+ cp_sta_mgr_set_our_avln (&cp, cp_sta_mgr_get_avln (&cp, 0, 0));
+ test_fail_unless (cp_sta_mgr_net_list_is_empty (&cp) == false);
+ /* add a station per AVLN. */
+ for (i = 0; i < HPAV_AVLNS_NB_MAX; i++)
+ {
+ net = cp_sta_mgr_get_avln (&cp, i, i);
+ test_fail_unless (net);
+ sta = cp_sta_mgr_sta_add (&cp, net, i+1, i+1);
+ slab_release (sta);
+ }
+ test_fail_unless (cp_sta_mgr_net_list_is_empty (&cp) == false);
+ /* Remove AVLN by AVLN unless our AVLN. */
+ for (i = 1; i < HPAV_AVLNS_NB_MAX; i++)
+ {
+ test_fail_unless (cp_sta_mgr_net_list_is_empty (&cp) == false);
+ cp_sta_mgr_remove_avln (&cp, i, i);
+ }
+ test_fail_unless (cp_sta_mgr_net_list_is_empty (&cp) == false);
+ /* Set present flag in our AVLN. This is just to verify that present
+ * flag in our AVLN is not used. */
+ net = cp_sta_mgr_get_our_avln (&cp);
+ net->present = false;
+ test_fail_unless (cp_sta_mgr_net_list_is_empty (&cp) == false);
+ /* Remove the station in this AVLN. */
+ cp_sta_mgr_sta_remove_from_mac (&cp, 1);
+ test_fail_unless (cp_sta_mgr_net_list_is_empty (&cp) == true);
+ 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;
+}
+
+void
+test_case__cp_sta_mgr_set_our_avln__no_net (test_t test)
+{
+ test_case_begin (test, "Set our AVLN, coming from unassociated state");
+
+ 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;
+ cp_sta_t *sta;
+ uint i;
+ sta_t *sta_store;
+ net = cp_sta_mgr_add_avln (&cp, 1, 1);
+ for (i = 1; i < 4; i ++)
+ {
+ sta = cp_sta_mgr_sta_add (&cp, net, i, i);
+ slab_release (sta);
+ }
+
+ cp_sta_mgr_set_our_avln (&cp, net);
+
+ /* The table of the CL mac to tei as been stubbed for this test, the
+ * real CL mactotei does not allow the user to get data as the
+ * following instructions. To do some, use the functions API's in the
+ * CL mactotei module. */
+ cl_mactotei_t *table;
+ table = (cl_mactotei_t*) cp.cl->mactotei;
+ for (i = 1; i < 4; i++)
+ {
+ sta_store = mac_store_sta_get (cp.mac_store, i);
+ sta = cp_sta_mgr_sta_get_assoc (&cp, net, i);
+ test_fail_if (table[i-1].tei != i);
+ test_fail_if (table[i-1].mac != i);
+ test_fail_if (sta_store == NULL);
+ test_fail_if (sta == NULL);
+ test_fail_if (cp_sta_get_tei (sta) != table[i-1].tei);
+ test_fail_if (cp_sta_get_mac_address (sta) != table[i-1].mac);
+
+ slab_release (sta);
+ blk_release (sta_store);
+ }
+ test_sta_mgr_uninit (&cp);
+ }
+ test_end;
+}
+
+void
+test_case__cp_sta_mgr_set_our_avln__with_net (test_t test)
+{
+ test_case_begin (test, "Set our AVLN, coming from associated state");
+
+ test_begin (test, "start")
+ {
+ cp_t cp;
+ cp_net_t *net;
+ cp_sta_t *sta;
+ uint i;
+ 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,
+ MAC_TEI_BCAST,
+ &added);
+ dbg_assert (added);
+ blk_release (mfs);
+
+ net = cp_sta_mgr_add_avln (&cp, 1, 1);
+
+ for (i = 1; i < 4; i ++)
+ {
+ sta = cp_sta_mgr_sta_add (&cp, net, i, i);
+ slab_release (sta);
+ }
+
+ cp_sta_mgr_set_our_avln (&cp, net);
+
+ /* The table of the CL mac to tei as been stubbed for this test, the
+ * real CL mactotei does not allow the user to get data as the
+ * following instructions. To do some, use the functions API's in the
+ * CL mactotei module. */
+ cl_mactotei_t *table;
+ table = (cl_mactotei_t*) cp.cl->mactotei;
+ for (i = 1; i < 4; i++)
+ {
+ sta_store = mac_store_sta_get (cp.mac_store, i);
+ sta = cp_sta_mgr_sta_get_assoc (&cp, net, i);
+ test_fail_if (table[i-1].tei != i);
+ test_fail_if (table[i-1].mac != i);
+ test_fail_if (sta_store == NULL);
+ test_fail_if (sta == NULL);
+ test_fail_if (cp_sta_get_tei (sta) != table[i-1].tei);
+ test_fail_if (cp_sta_get_mac_address (sta) != table[i-1].mac);
+
+ slab_release (sta);
+ blk_release (sta_store);
+ }
+
+ net = cp_sta_mgr_add_avln (&cp, 2, 2);
+
+ for (i = 1; i < 4; i ++)
+ {
+ sta = cp_sta_mgr_sta_add (&cp, net, i + 3, i + 3);
+ slab_release (sta);
+ }
+
+ cp_sta_mgr_set_our_avln (&cp, net);
+
+ /* The table of the CL mac to tei as been stubbed for this test, the
+ * real CL mactotei does not allow the user to get data as the
+ * following instructions. To do some, use the functions API's in the
+ * CL mactotei module. */
+ table = (cl_mactotei_t*) cp.cl->mactotei;
+ for (i = 1; i < 4; i++)
+ {
+ sta_store = mac_store_sta_get (cp.mac_store, i + 3);
+ sta = cp_sta_mgr_sta_get_assoc (&cp, net, i + 3);
+ test_fail_if (table[i-1].tei != i + 3);
+ test_fail_if (table[i-1].mac != i + 3);
+ test_fail_if (sta_store == NULL);
+ test_fail_if (sta == NULL);
+ test_fail_if (cp_sta_get_tei (sta) != table[i-1].tei);
+ test_fail_if (cp_sta_get_mac_address (sta) != table[i-1].mac);
+
+ slab_release (sta);
+ blk_release (sta_store);
+ }
+
+ for (i = 1; i < 4; i++)
+ {
+ sta_store = mac_store_sta_get (cp.mac_store, i);
+ test_fail_if (sta_store != NULL);
+ }
+ test_sta_mgr_uninit (&cp);
+ }
+ test_end;
+}
+
+void
+test_case__cp_sta_mgr_set_our_avln__with_net_to_unassoc (test_t test)
+{
+ test_case_begin (test, "Set our AVLN, coming from associated to unassoc");
+
+ test_begin (test, "start")
+ {
+ uint i;
+ cp_sta_t *sta;
+ 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);
+
+ for (i = 1; i < 4; i ++)
+ {
+ sta = cp_sta_mgr_sta_add (&cp, net, i, i);
+ slab_release (sta);
+ }
+
+ cp_sta_mgr_set_our_avln (&cp, net);
+
+ /* The table of the CL mac to tei as been stubbed for this test, the
+ * real CL mactotei does not allow the user to get data as the
+ * following instructions. To do some, use the functions API's in the
+ * CL mactotei module. */
+ cl_mactotei_t *table;
+ table = (cl_mactotei_t*) cp.cl->mactotei;
+ for (i = 1; i < 4; i++)
+ {
+ sta_store = mac_store_sta_get (cp.mac_store, i);
+ sta = cp_sta_mgr_sta_get_assoc (&cp, net, i);
+ test_fail_if (table[i-1].tei != i);
+ test_fail_if (table[i-1].mac != i);
+ test_fail_if (sta_store == NULL);
+ test_fail_if (sta == NULL);
+ test_fail_if (cp_sta_get_tei (sta) != table[i-1].tei);
+ test_fail_if (cp_sta_get_mac_address (sta) != table[i-1].mac);
+
+ slab_release (sta);
+ blk_release (sta_store);
+ }
+
+ dbg_fatal_try_begin
+ {
+ cp_sta_mgr_set_our_avln (&cp, NULL);
+
+ test_fail_if (cp.cl->mactotei != NULL);
+
+ for (i = 1; i < 4; i++)
+ {
+ sta_store = mac_store_sta_get (cp.mac_store, i);
+ test_fail_if (sta_store != NULL);
+ }
+ }
+ dbg_fatal_try_catch (const char *fatal_message)
+ {
+ test_verbose_print (fatal_message);
+ }
+ dbg_fatal_try_end;
+ test_sta_mgr_uninit (&cp);
+ }
+ test_end;
+}
+
+void
+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")
+ {
+ test_sta_mgr_init (&cp);
+ net = cp_sta_mgr_add_avln (&cp, 1, 1);
+ cp_sta_mgr_set_our_avln (&cp, net);
+
+ sta = cp_sta_mgr_sta_add (&cp, net, 1, 1);
+ dbg_fatal_try_begin
+ {
+ cp_eoc_sta_mgr_release_station (&cp, 1);
+ }
+ dbg_fatal_try_catch (const char *fail)
+ {
+ test_verbose_print (fail);
+ test_fail_if (cp_sta_own_data_get_cco_status (&cp) == true);
+ }
+ dbg_fatal_try_end;
+ // The same as CCo.
+ cp_sta_own_data_set_tei (&cp, 2);
+ cp_sta_own_data_set_cco_status (&cp, true);
+ cp_eoc_sta_mgr_release_station (&cp, 1);
+
+ /* Launch the garbage. */
+ cp_eoc_sta_mgr_garbage (&cp);
+ /* Station goes directly to unassoc. list. */
+ test_fail_if (set_empty (&net->unassociated_stas) == true);
+
+ /* modify the expired to force expiration. */
+ sta->expired_date_ms = 0;
+ slab_release (sta);
+
+ /* Check if unassociated sta is still in the network. */
+ cp_net_garbage_station_list (&cp, cp_sta_mgr_get_our_avln (&cp),
+ cp_sta_core_get_date_ms (&cp),
+ CP_NET_STA_UNASSOC);
+
+ /* Remove to public stations.*/
+ test_fail_if (set_empty (&net->unassociated_stas) == false);
+
+ /* Verify the store. */
+ sta_store = mac_store_sta_get (cp.mac_store, 1);
+ test_fail_if (sta_store != NULL);
+ test_sta_mgr_uninit (&cp);
+ }
+ test_end;
+
+ test_begin (test, "Change AVLN")
+ {
+ test_sta_mgr_init (&cp);
+ net = cp_sta_mgr_add_avln (&cp, 1, 1);
+ cp_sta_mgr_set_our_avln (&cp, net);
+
+ sta = cp_sta_mgr_sta_add (&cp, net, 1, 1);
+
+ // The same as CCo.
+ cp_sta_own_data_set_tei (&cp, 2);
+ cp_sta_own_data_set_cco_status (&cp, true);
+ cp_eoc_sta_mgr_release_station (&cp, 1);
+
+ sta->expired_date_ms = 0;
+ slab_release (sta);
+ /* Check if unassociated sta is still in the previous net.
+ * In EoC no change of AVLN. */
+ cp_net_garbage_station_list (&cp, net, cp_sta_core_get_date_ms (&cp),
+ CP_NET_STA_UNASSOC);
+ /* Change the AVLN. */
+ cp_sta_mgr_set_our_avln (&cp, NULL);
+ /* Verify the store. */
+ sta_store = mac_store_sta_get (cp.mac_store, 1);
+ test_fail_if (sta_store != NULL);
+ test_sta_mgr_uninit (&cp);
+ }
+ test_end;
+
+ test_begin (test, "AVLN1 to AVLN2")
+ {
+ test_sta_mgr_init (&cp);
+ net = cp_sta_mgr_add_avln (&cp, 1, 1);
+ cp_sta_mgr_set_our_avln (&cp, net);
+
+ sta = cp_sta_mgr_sta_add (&cp, net, 1, 1);
+ slab_release (sta);
+
+ // The same as CCo.
+ cp_sta_own_data_set_tei (&cp, 2);
+ cp_sta_own_data_set_cco_status (&cp, true);
+ 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);
+
+ sta = cp_sta_mgr_sta_add (&cp, net, 1, 1);
+
+ // The same as CCo.
+ cp_sta_own_data_set_tei (&cp, 2);
+ cp_sta_own_data_set_cco_status (&cp, true);
+ cp_eoc_sta_mgr_release_station (&cp, 1);
+
+ sta->expired_date_ms = 0;
+ slab_release (sta);
+ /* Check if unassociated sta is still in the previous net.
+ * In EoC no change of AVLN. */
+ cp_net_garbage_station_list (&cp, net, cp_sta_core_get_date_ms (&cp),
+ CP_NET_STA_UNASSOC);
+ cp_sta_mgr_set_our_avln (&cp, NULL);
+ /* Verify the store. */
+ sta_store = mac_store_sta_get (cp.mac_store, 1);
+ test_fail_if (sta_store != NULL);
+ test_sta_mgr_uninit (&cp);
+ }
+ test_end;
+}
+
+void
+test_case__cp_sta_mgr_change_snid (test_t test)
+{
+ test_case_begin (test, "Change snid");
+
+ test_begin (test, "CCo")
+ {
+ 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);
+ cp_sta_own_data_set_tei (&cp, 1);
+ cp_sta_own_data_set_authenticated_status (&cp, true);
+ cp_sta_own_data_set_cco_status (&cp, true);
+
+ /* Change our AVLN. */
+ cp_sta_own_data_set_snid (&cp, 0x3);
+
+ test_fail_unless (cp_sta_own_data_get_snid (&cp) == 0x3);
+ test_fail_unless (net->snid == 0x3);
+ test_sta_mgr_uninit (&cp);
+ }
+ test_end;
+
+ test_begin (test, "Station")
+ {
+ 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);
+
+ test_fail_unless (net->snid == 0x1);
+
+ /* Change our AVLN. */
+ cp_sta_own_data_set_snid (&cp, 0x3);
+
+ test_fail_unless (cp_sta_own_data_get_snid (&cp) == 0x3);
+ test_fail_unless (net->snid == 0x1);
+
+ cp_sta_own_data_set_snid (&cp, 0x1);
+ cp_sta_mgr_set_our_avln (&cp, net);
+
+ cp_sta_own_data_set_snid (&cp, 0x3);
+
+ test_fail_unless (cp_sta_own_data_get_snid (&cp) == 0x3);
+ test_fail_unless (net->snid == 0x3);
+ test_sta_mgr_uninit (&cp);
+ }
+ test_end;
+}
+
+/** SNID present
+ *
+ * \param test the test object.
+ *
+ * Return a flag indicating which SNID is currently in use.
+ * environment 3 AVLNs with SNID 1, 5, 10.
+ * At the end of the test the flag shall contain 0x211.
+ */
+void
+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++)
+ {
+ cp_sta_mgr_add_avln (&cp, snid[i], i);
+ snidfcmp = snidfcmp | ((u16) 1 << snid[i]);
+ }
+ snidFlags = cp_sta_mgr_get_present_snids (&cp);
+ test_begin (test, "Verifying the flags")
+ {
+ test_fail_unless (snidFlags == snidfcmp);
+ }
+ test_end;
+}
+
+/** Get slot usage
+ * \param test the test object.
+ *
+ * Environment
+ * Add three AVLN in the station manager configured as followed:
+ *
+ * * AVLN 1 : Slot id = 4;
+ * * AVLN 2 : Slot id = 7;
+ * * AVLN 3 : Slot id = 2;
+ *
+ * This makes a slot usage equal to 0x94.
+ *
+ * Result
+ * This function shall return 0x94.
+ */
+void
+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);
+
+ test_case_begin (test, "Getting the slot usage");
+
+ // Add the first AVLN.
+ net = cp_sta_mgr_add_avln (&cp, 1, 1);
+ cp_net_set_slot_id_and_usage (&cp, net, 4, 5);
+
+ net = cp_sta_mgr_add_avln (&cp, 2, 2);
+ cp_net_set_slot_id_and_usage (&cp, net, 7, 7);
+
+ net = cp_sta_mgr_add_avln (&cp, 3, 3);
+ cp_net_set_slot_id_and_usage (&cp, net, 2, 3);
+
+ test_begin (test, "Verify")
+ {
+ test_fail_if (cp_sta_mgr_get_slot_usage (&cp) != 0 /*0x94*/,
+ "Wrong Slot usage bit fields");
+ }
+ test_end;
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+}
+
+void
+test_case__cp_net_num_sta_associated (test_t test)
+{
+ test_case_begin (test, "Number of stations associated");
+
+ test_begin (test, "Add 10 STAs")
+ {
+ cp_t cp;
+ cp_net_t *net;
+ cp_sta_t *sta;
+ mac_config_t mac_config;
+
+ memset (&cp, 0, sizeof (cp_t));
+ 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);
+
+ test_fail_unless (cp_net_num_sta_associated (&cp, net) == 0);
+
+ sta = cp_sta_mgr_sta_add (&cp, net, MAC_TEI_UNASSOCIATED, 1);
+ slab_release (sta);
+
+ test_fail_unless (cp_net_num_sta_associated (&cp, net) == 0);
+
+ sta = cp_sta_mgr_sta_add (&cp, net, 1, 1);
+ slab_release (sta);
+
+ test_fail_unless (cp_net_num_sta_associated (&cp, net) == 1);
+
+ sta = cp_sta_mgr_sta_add (&cp, net, 2, 1);
+ slab_release (sta);
+
+ test_fail_unless (cp_net_num_sta_associated (&cp, net) == 1);
+
+ cp_sta_mgr_sta_remove_from_mac (&cp, 1);
+ test_fail_unless (cp_net_num_sta_associated (&cp, net) == 0);
+
+ cp_sta_mgr_uninit (&cp);
+ lib_stats_uninit ();
+ }
+ test_end;
+}
+
+void
+test_suite_sta_mgr (test_t test)
+{
+ test_suite_begin (test, "sta mgr");
+ test_case__cp_sta_mgr_sta (test);
+ test_case__cp_net_uninit (test);
+ test_case__cp_sta_manager_garbage (test);
+ test_case__cp_net_pco (test);
+ test_case__cp_net_sta_get_first_next (test);
+ test_case__cp_sta_mgr_get_avln (test);
+ test_case__cp_sta_mgr_get_first_next_avln (test);
+ test_case__cp_net_is_empty (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_eoc_sta_mgr_release_station (test);
+ test_case__cp_sta_mgr_change_snid (test);
+ test_case_snid_present (test);
+ test_case_slot_usage (test);
+ test_case__cp_net_num_sta_associated (test);
+}
diff --git a/cesar/cp/eoc/sta/mgr/test/utest/src/station_test.c b/cesar/cp/eoc/sta/mgr/test/utest/src/station_test.c
new file mode 100644
index 0000000000..d97cf8a890
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/test/utest/src/station_test.c
@@ -0,0 +1,431 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/station_test.c
+ * \brief Test the station.
+ * \ingroup cp_sta_mgr
+ *
+ */
+#include "common/std.h"
+#include "test_sta_mgr.h"
+
+#include "cp/sta/mgr/inc/sta.h"
+
+/**
+ * Initialise a station.
+ *
+ */
+void
+test_case_station_init (test_t test)
+{
+ cp_sta_t *sta;
+ cp_sta_private_t station;
+ slab_cache_t sta_slab_cache;
+
+ test_case_begin (test, "Station init");
+ test_begin (test, "verify data")
+ {
+ slab_cache_init (&sta_slab_cache,
+ "Station cache",
+ sizeof (cp_sta_private_t),
+ (slab_object_destructor_t) cp_sta_uninit);
+
+
+ memset (&station, 0, sizeof (cp_sta_private_t));
+ station.association_confirmed = true;
+ station.visible = true;
+ sta = cp_sta_init (&sta_slab_cache);
+
+ test_fail_if (memcmp(sta, &station,
+ sizeof(cp_sta_private_t)) != 0,
+ "Wrong sta is not initialised");
+
+
+ slab_release (sta);
+ }
+ test_end;
+}
+
+/**
+ * Get the TEI of the station.
+ *
+ * \param test the test object.
+ */
+void
+test_case_get_tei (test_t test)
+{
+ cp_sta_private_t station;
+
+ memset (&station, '\0', sizeof (cp_sta_private_t));
+
+ test_case_begin (test, "get station TEI");
+
+ station.tei = 0xA;
+
+ test_begin (test, "Getting TEI")
+ {
+ test_fail_if (cp_sta_get_tei ((cp_sta_t *) &station) != 0xA,
+ "Wrong TEI");
+ }
+ test_end;
+}
+
+/**
+ * Get the Mac address of the station.
+ *
+ * \param test the test object.
+ */
+void
+test_case_get_mac_addr (test_t test)
+{
+ cp_sta_private_t station;
+
+ memset (&station, '\0', sizeof (cp_sta_private_t));
+
+ test_case_begin (test, "get station Mac address");
+
+ station.mac_address = 0x123456789abcull;
+
+ test_begin (test, "Getting Mac address")
+ {
+ test_fail_if (cp_sta_get_mac_address ((cp_sta_t *) &station)
+ != 0x123456789abcull,
+ "Wrong Mac address");
+ }
+ test_end;
+}
+
+/**
+ * Get the peer structure of the station.
+ *
+ * \param test the test object.
+ */
+void
+test_case_get_peer (test_t test)
+{
+ cp_sta_private_t station;
+
+ memset (&station, '\0', sizeof (cp_sta_private_t));
+
+ test_case_begin (test, "get station peer");
+
+ station.tei = 0xA;
+ station.mac_address = 0x123456789abcull;
+
+ test_begin (test, "Getting peer")
+ {
+ cp_mme_peer_t peer;
+ cp_sta_get_peer ((cp_sta_t *) &station, &peer);
+ test_fail_if (!cp_mme_peer_cmp (
+ &peer, &CP_MME_PEER (0x123456789abcull, 0xA)),
+ "Wrong peer");
+ }
+ test_end;
+}
+
+/**
+ * Get the CCo status of the station.
+ *
+ * \param test the test object.
+ */
+void
+test_case_get_cco_status (test_t test)
+{
+ cp_sta_private_t station;
+
+ memset (&station, '\0', sizeof (cp_sta_private_t));
+
+ test_case_begin (test, "get station CCo status");
+
+ test_begin (test, "Getting CCo status")
+ {
+ test_fail_if (cp_sta_get_cco_status ((cp_sta_t *) &station)
+ != false,
+ "Wrong CCo status");
+ }
+ test_end;
+
+ station.is_cco = true;
+
+ test_begin (test, "Getting CCo status true")
+ {
+ test_fail_if (cp_sta_get_cco_status ((cp_sta_t *) &station)
+ != true,
+ "Wrong CCo status");
+ }
+ test_end;
+}
+
+/**
+ * Get the PCo status of the station.
+ *
+ * \param test the test object.
+ */
+void
+test_case_get_pco_status (test_t test)
+{
+ cp_sta_private_t station;
+
+ memset (&station, '\0', sizeof (cp_sta_private_t));
+
+ test_case_begin (test, "get station PCo status");
+
+ test_begin (test, "Getting PCo status")
+ {
+ test_fail_if (cp_sta_get_pco_status ((cp_sta_t *) &station)
+ != false,
+ "Wrong PCo status");
+ }
+ test_end;
+
+ station.pco_glid = 0x80;
+
+ test_begin (test, "Getting PCo status true")
+ {
+ test_fail_if (cp_sta_get_pco_status ((cp_sta_t *) &station)
+ != true,
+ "Wrong PCo status");
+ }
+ test_end;
+}
+
+void
+test_case_authenticated (test_t test)
+{
+ test_case_begin (test, "Authentication");
+
+ test_begin (test, "set & get authentication")
+ {
+ cp_t cp;
+ cp_net_t net;
+ cp_sta_private_t station;
+ cp_sta_t *sta = (cp_sta_t *) &station;
+
+ memset (&station, 0, sizeof (cp_sta_private_t));
+ memset (&cp, 0, sizeof (cp_t));
+
+ /* configure the test. */
+ cp.mac_store = mac_store_init ();
+ cp.sta_mgr.our_avln = &net;
+ station.tei = 0xA;
+ station.net = &net;
+ mac_store_sta_add (cp.mac_store, station.tei);
+
+ cp_sta_set_authenticated (&cp, sta, true);
+ test_fail_if (cp_sta_get_authenticated (&cp, sta) != true);
+
+ cp_sta_set_authenticated (&cp, sta, false);
+ test_fail_if (cp_sta_get_authenticated (&cp, sta) != false);
+
+ dbg_check (mac_store_sta_remove (cp.mac_store, station.tei));
+
+ station.tei = MAC_TEI_UNASSOCIATED;
+ test_fail_if (cp_sta_get_authenticated (&cp, sta) != false);
+ mac_store_uninit (cp.mac_store);
+ }
+ test_end;
+
+ test_begin (test, "set authentication TEI = 0")
+ {
+ cp_t cp;
+ cp_net_t net;
+ cp_sta_private_t station;
+ cp_sta_t *sta = (cp_sta_t *) &station;
+
+ memset (&station, 0, sizeof (cp_sta_private_t));
+ memset (&cp, 0, sizeof (cp_t));
+
+ /* configure the test. */
+ cp.mac_store = mac_store_init ();
+ cp.sta_mgr.our_avln = &net;
+ station.tei = 0;
+ station.net = &net;
+
+ cp_sta_set_authenticated (&cp, sta, false);
+ mac_store_uninit (cp.mac_store);
+ }
+ test_end;
+}
+
+void
+test_case_visible_state (test_t test)
+{
+ test_case_begin (test, "Visible state");
+
+ test_begin (test, "station visible state")
+ {
+ cp_t cp;
+ cp_net_t net;
+ cp_sta_private_t sta;
+
+ memset (&cp, 0, sizeof (cp_t));
+ memset (&net, 0, sizeof (cp_net_t));
+ memset (&sta, 0, sizeof (cp_sta_private_t));
+
+ /* configure the stations. */
+ sta.net = &net;
+ sta.tei = 1;
+
+ cp_sta_set_visible_status (&cp, (cp_sta_t *) &sta,
+ CP_STA_VISIBLE_STATE_VISIBLE);
+ test_fail_if (cp_net_get_num_discovered_stas (&cp, &net) != 1);
+
+ cp_sta_set_visible_status (&cp, (cp_sta_t *) &sta,
+ CP_STA_VISIBLE_STATE_HIDDEN);
+ test_fail_if (cp_net_get_num_discovered_stas (&cp, &net) != 0);
+ test_fail_if (cp_sta_get_visible_status ((cp_sta_t *) &sta) !=
+ CP_STA_VISIBLE_STATE_HIDDEN);
+ }
+ test_end;
+
+ test_begin (test, "station visible state in our AVLN")
+ {
+ cp_t cp;
+ cp_net_t net;
+ cp_sta_private_t sta;
+ sta_t *sta_store;
+
+ memset (&cp, 0, sizeof (cp_t));
+ memset (&net, 0, sizeof (cp_net_t));
+ memset (&sta, 0, sizeof (cp_sta_private_t));
+
+ /* configure the stations. */
+ sta.net = &net;
+ sta.tei = 1;
+ cp.sta_mgr.our_avln = &net;
+ cp.mac_store = mac_store_init ();
+
+ mac_store_sta_add (cp.mac_store, sta.tei);
+ sta_store = mac_store_sta_get (cp.mac_store, 1);
+
+ cp_sta_set_assoc_confirmed (&cp, (cp_sta_t*) &sta, false);
+ test_fail_unless (sta_store->multi_unicast_receiver == false);
+
+ cp_sta_set_visible_status (&cp, (cp_sta_t *) &sta,
+ CP_STA_VISIBLE_STATE_VISIBLE);
+ test_fail_if (cp_net_get_num_discovered_stas (&cp, &net) != 1);
+ test_fail_unless (sta_store->multi_unicast_receiver == false);
+
+ cp_sta_set_assoc_confirmed (&cp, (cp_sta_t*) &sta, true);
+ test_fail_if (sta_store->multi_unicast_receiver != true);
+
+ cp_sta_set_visible_status (&cp, (cp_sta_t *) &sta,
+ CP_STA_VISIBLE_STATE_HIDDEN);
+ test_fail_if (cp_net_get_num_discovered_stas (&cp, &net) != 0);
+ test_fail_if (cp_sta_get_visible_status ((cp_sta_t *) &sta) !=
+ CP_STA_VISIBLE_STATE_HIDDEN);
+
+ test_fail_if (sta_store->multi_unicast_receiver != false);
+ blk_release (sta_store);
+
+ dbg_check (mac_store_sta_remove (cp.mac_store, 1));
+ mac_store_uninit (cp.mac_store);
+ }
+ test_end;
+
+}
+
+void
+test_case_pco_glid (test_t test)
+{
+ test_case_begin (test, "PCo GLID");
+
+ test_begin (test, "PCo GLID")
+ {
+ cp_sta_private_t sta;
+
+ memset (&sta, 0, sizeof (cp_sta_private_t));
+
+ cp_sta_set_pco_glid ((cp_sta_t *) &sta, 0x95);
+ test_fail_if (cp_sta_get_pco_glid ((cp_sta_t *) &sta) != 0x95);
+ test_fail_if (cp_sta_get_pco_status ((cp_sta_t *) &sta) != true);
+
+ cp_sta_set_pco_glid ((cp_sta_t *) &sta, 0x0);
+ test_fail_if (cp_sta_get_pco_glid ((cp_sta_t *) &sta) != 0x0);
+ test_fail_if (cp_sta_get_pco_status ((cp_sta_t *) &sta) != false);
+ }
+ test_end;
+}
+
+void
+test_case_multi_association_confirmed (test_t test)
+{
+ test_case_begin (test, "Association confirmed");
+ test_begin (test, "Visible station")
+ {
+ cp_t cp;
+ /* Configure the test. */
+ test_sta_mgr_init (&cp);
+ cp_net_t *net = cp_sta_mgr_add_avln (&cp, 1, 1);
+ cp_sta_t *sta = cp_sta_mgr_sta_add (&cp, net, 1, 1);
+ sta_t *sta_store;
+ cp_sta_mgr_set_our_avln (&cp, net);
+ cp_sta_own_data_set_tei (&cp, 2);
+ cp_sta_own_data_set_cco_status (&cp, true);
+ /* begin the test. */
+ cp_sta_set_visible_status (&cp, sta, CP_STA_VISIBLE_STATE_VISIBLE);
+ cp_sta_set_assoc_confirmed (&cp, sta, true);
+ sta_store = mac_store_sta_get (cp.mac_store, 1);
+ test_fail_unless (cp_sta_get_assoc_confirmed (&cp, sta));
+ test_fail_unless (sta_store->multi_unicast_receiver);
+ /* Change the state. */
+ cp_sta_set_assoc_confirmed (&cp, sta, false);
+ test_fail_unless (!cp_sta_get_assoc_confirmed (&cp, sta));
+ test_fail_unless (!sta_store->multi_unicast_receiver);
+ /* Uninitialise */
+ slab_release (sta);
+ blk_release (sta_store);
+ test_sta_mgr_uninit (&cp);
+ }
+ test_end;
+
+ test_begin (test, "Hidden station")
+ {
+ cp_t cp;
+ cp_net_t *net;
+ cp_sta_t *sta;
+ sta_t *sta_store;
+ /* Configure the test. */
+ test_sta_mgr_init (&cp);
+ net = cp_sta_mgr_add_avln (&cp, 1, 1);
+ sta = cp_sta_mgr_sta_add (&cp, net, 1, 1);
+ cp_sta_mgr_set_our_avln (&cp, net);
+ cp_sta_own_data_set_tei (&cp, 2);
+ /* begin the test. */
+ cp_sta_set_visible_status (&cp, sta, CP_STA_VISIBLE_STATE_HIDDEN);
+ cp_sta_set_assoc_confirmed (&cp, sta, true);
+ sta_store = mac_store_sta_get (cp.mac_store, 1);
+ test_fail_unless (cp_sta_get_assoc_confirmed (&cp, sta));
+ test_fail_unless (!sta_store->multi_unicast_receiver);
+ /* Change the state. */
+ cp_sta_set_assoc_confirmed (&cp, sta, false);
+ test_fail_unless (!cp_sta_get_assoc_confirmed (&cp, sta));
+ test_fail_unless (!sta_store->multi_unicast_receiver);
+ /* Uninitialise */
+ slab_release (sta);
+ blk_release (sta_store);
+ test_sta_mgr_uninit (&cp);
+ }
+ test_end;
+}
+
+void
+test_suite_station (test_t test)
+{
+ test_suite_begin (test, "station");
+ test_case_station_init (test);
+ test_case_get_tei (test);
+ test_case_get_mac_addr (test);
+ test_case_get_peer (test);
+ test_case_get_cco_status (test);
+ test_case_get_pco_status (test);
+ test_case_authenticated (test);
+ test_case_visible_state (test);
+ test_case_pco_glid (test);
+ test_case_multi_association_confirmed (test);
+}
diff --git a/cesar/cp/eoc/sta/mgr/test/utest/src/test_sta_mgr.c b/cesar/cp/eoc/sta/mgr/test/utest/src/test_sta_mgr.c
new file mode 100644
index 0000000000..a3af644711
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/test/utest/src/test_sta_mgr.c
@@ -0,0 +1,142 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2011 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/mgr/test/src/test_sta_mgr.c
+ * \brief Test environment.
+ * \ingroup cp_sta_mgr
+ */
+#include "common/std.h"
+#include "test_sta_mgr.h"
+
+#include "cl/cl_mactotei.h"
+
+static cl_mactotei_t table[10];
+static uint table_index;
+
+void
+test_sta_mgr_init (cp_t *cp)
+{
+ static mac_config_t mac_config;
+ static sar_t sar;
+ static cl_t cl;
+
+ memset (&mac_config, 0, sizeof (mac_config));
+ 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);
+ 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);
+}
+
+/**
+ * Create a new table to be filled by the CP.
+ *
+ * \return a pointer to the new block to be fill with the mac to tei table
+ * data
+ */
+cl_mactotei_blk_t *
+cl_mactotei_new (void)
+{
+ memset (table, 0, sizeof (table));
+ table_index = 0;
+ return (cl_mactotei_blk_t *) &table;
+}
+
+/**
+ * Add a new tupple of data to the table.
+ *
+ * \param table the table pointer to add a new mac to tei correspondance.
+ * \param mac_addr the mac addr to add
+ * \param tei the tei corresponding to the STA.
+ * \param tag the CP tag provide to indentifier a network.
+ */
+void cl_mactotei_addr_add (cl_mactotei_blk_t *table, mac_t mac_addr,
+ uint tei, uint tag)
+{
+ cl_mactotei_t *curr;
+
+ curr = (cl_mactotei_t*) table;
+ curr[table_index].tag = tag;
+ curr[table_index].tei = tei;
+ curr[table_index].mac = mac_addr;
+ table_index ++;
+}
+
+/**
+ * Request the CL to use the new table and remove the old one.
+ *
+ * \param ctx the CL context
+ * \param table the new table to use.
+ */
+void
+cl_mactotei_use_table (cl_t *ctx, cl_mactotei_blk_t *table)
+{
+ dbg_assert (table);
+ dbg_assert (ctx);
+
+ ctx->mactotei = (cl_mactotei_table_t *) table;
+}
+
+/**
+ * Release the complete table from the memory.
+ *
+ * \param ctx the convergence layer context
+ */
+void cl_mactotei_release_table (cl_t *ctx)
+{
+ dbg_assert (ctx);
+ memset (table, 0, sizeof (table));
+ ctx->mactotei = NULL;
+}
+
+void
+test_suite_sta_mgr (test_t test);
+
+void
+test_suite_net (test_t test);
+
+void
+test_suite_sta_own (test_t test);
+
+void
+test_suite_station (test_t test);
+
+int
+main (int argc, char **argv)
+{
+ test_t test;
+ test_init (test, argc, argv);
+ test_suite_sta_mgr (test);
+ test_suite_net (test);
+ test_suite_sta_own (test);
+ test_suite_station (test);
+
+ test_case_begin (test, "Memory allocation");
+ test_begin (test, "memory leaks")
+ {
+ test_fail_if (blk_check_memory () != true, "Memory leaks");
+ }
+ test_end;
+
+ test_result (test);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
diff --git a/cesar/cp/eoc/sta/mgr/test/utest/test_sta_mgr.h b/cesar/cp/eoc/sta/mgr/test/utest/test_sta_mgr.h
new file mode 100644
index 0000000000..7faa31ddf9
--- /dev/null
+++ b/cesar/cp/eoc/sta/mgr/test/utest/test_sta_mgr.h
@@ -0,0 +1,50 @@
+#ifndef cp_sta_mgr_test_test_sta_mgr_h
+#define cp_sta_mgr_test_test_sta_mgr_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2011 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/eoc/sta/mgr/test/test_sta_mgr.h
+ * \brief Test environment.
+ * \ingroup cp_eoc_sta_mgr_test
+ */
+#include "lib/test.h"
+#include "cp/cp.h"
+#include "cp/sta/mgr/sta_mgr.h"
+
+#include "mac/common/ntb.h"
+#include "mac/common/timings.h"
+#include "cl/inc/context.h"
+
+#include "cp/inc/context.h"
+#include "cp/sta/mgr/inc/net.h"
+#include "mac/sar/inc/context.h"
+
+
+struct cl_mactotei_t
+{
+ mac_t mac;
+ cp_tei_t tei;
+ uint tag;
+};
+typedef struct cl_mactotei_t cl_mactotei_t;
+
+/**
+ * Initialise all necessary data for the station manager test.
+ * \param cp the control plane override structure.
+ */
+void
+test_sta_mgr_init (cp_t *cp);
+
+/**
+ * Uninitialise the environment of test for station manager.
+ * \param cp the control plane override structure.
+ */
+void
+test_sta_mgr_uninit (cp_t *cp);
+
+#endif /* cp_sta_mgr_test_test_sta_mgr_h */