summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlaranjeiro2008-07-10 15:47:11 +0000
committerlaranjeiro2008-07-10 15:47:11 +0000
commite509560ef6ac31428540575695b471f604470cc1 (patch)
treee020c16d5d29e3740d3ba8b8805396c4c303c81c
parent98439c201b17b7909f6657e3ceb8645cd87e190c (diff)
cp2/cco/action: Added the FSM event when the station leave.
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@2592 017c9cb6-072f-447c-8318-d5b54f68fe89
-rw-r--r--cesar/cp2/cco/action/src/cco_action.c1
-rw-r--r--cesar/cp2/cco/action/test/Makefile2
-rw-r--r--cesar/cp2/cco/action/test/src/action-test.c51
3 files changed, 53 insertions, 1 deletions
diff --git a/cesar/cp2/cco/action/src/cco_action.c b/cesar/cp2/cco/action/src/cco_action.c
index e18aa489ca..88abf1f389 100644
--- a/cesar/cp2/cco/action/src/cco_action.c
+++ b/cesar/cp2/cco/action/src/cco_action.c
@@ -28,6 +28,7 @@
#include "cp2/defs.h"
#include "cp2/cp.h"
+#include "cp2/fsm/fsm.h"
#include "cp2/msg/msg.h"
#include "cp2/cco/action/cco_action.h"
diff --git a/cesar/cp2/cco/action/test/Makefile b/cesar/cp2/cco/action/test/Makefile
index dfedc2aed8..c2fe292170 100644
--- a/cesar/cp2/cco/action/test/Makefile
+++ b/cesar/cp2/cco/action/test/Makefile
@@ -6,7 +6,7 @@ INCLUDES = cp2/cco/action/test/overide
TARGET_PROGRAMS = action garbage
-action_SOURCES = action-test.c fsm_stub.c
+action_SOURCES = action-test.c
action_MODULES = lib cp2/cco/action mac/common cp2/sta/mgr cl
garbage_SOURCES = garbage.c fsm_stub.c
diff --git a/cesar/cp2/cco/action/test/src/action-test.c b/cesar/cp2/cco/action/test/src/action-test.c
index 9ce4d55eb4..d68d76ae8e 100644
--- a/cesar/cp2/cco/action/test/src/action-test.c
+++ b/cesar/cp2/cco/action/test/src/action-test.c
@@ -28,6 +28,7 @@
#include "mac/common/ntb.h"
#include "cp2/cp.h"
+#include "cp2/fsm/fsm.h"
#include "cp2/msg/msg.h"
#include "cp2/sta/mgr/sta.h"
@@ -44,6 +45,9 @@ u16 snid_compute;
// A Simple counter.
uint tei_map_cnt;
+static cp_fsm_event_t fsm_event;
+static bool fsm_event_posted = false;
+
/**
* Verify TEI lease computing function.
* \param test the test object.
@@ -588,6 +592,40 @@ test_case_sta_authentication (test_t test)
cp_cco_action_uninit (&cp);
}
+/** Test the station leaving procedure.
+ * \param test the test object.
+ *
+ * This shall only verify that a message is post in the FSM when the station
+ * leave the AVLN.
+ */
+void
+test_case_sta_leave (test_t test)
+{
+ cp_t cp;
+ cp_net_t *net;
+ cp_sta_t *sta;
+
+ cp_sta_mgr_init (&cp);
+ cp_cco_action_init (&cp);
+
+ test_case_begin (test, "CCO action : Station leave");
+
+ net = cp_sta_mgr_get_our_avln (&cp);
+ sta = cp_net_sta_add (&cp, net, 0x1, 0x1);
+
+ cp_cco_action_manage_sta_leave (&cp, NULL, sta);
+ slab_release (sta);
+
+ test_begin (test, "Verify the post event")
+ {
+ test_fail_if (fsm_event_posted != true, "FSM Event not posted");
+ }
+ test_end;
+
+ cp_cco_action_uninit (&cp);
+ cp_sta_mgr_uninit (&cp);
+}
+
int
main (void)
{
@@ -603,6 +641,7 @@ main (void)
test_case_change_snid (test);
test_case_sta_assoc_procedure (test);
test_case_sta_authentication (test);
+ test_case_sta_leave (test);
test_case_begin (test, "Memory leaks");
@@ -857,3 +896,15 @@ cp_msg_cc_leave_ind_send (cp_t *ctx, cp_mme_peer_t *peer,
cp_nid_t nid)
{
}
+
+cp_fsm_event_t *
+cp_fsm_event_bare_new (cp_t *ctx, cp_fsm_event_type_t type)
+{
+ return &fsm_event;
+}
+
+void
+cp_fsm_post (cp_t *ctx, cp_fsm_event_t *event)
+{
+ fsm_event_posted = true;
+}