summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNélio Laranjeiro2012-09-14 16:05:48 +0200
committerNélio Laranjeiro2012-10-19 14:25:42 +0200
commite61931fa6dfe798194a5576f901fe8ceaf640d65 (patch)
treefeaadcde2d31aa795a933f390ee6168ac1309cf4
parent7d06ab21fd505d329cdab06df57c4e30933f9dad (diff)
cesar/cp[eoc]: remove useless state in sta own data, closes #3358
The station status is deductible: * NO TEI --> unassociated * not authenticated with TEI --> associated * authenticated --> authenticated There is no need to add another variable to maintain.
-rw-r--r--cesar/cp/eoc/cco/action/src/cco_action.c1
-rw-r--r--cesar/cp/eoc/sta/action/src/assoc_slave.c4
-rw-r--r--cesar/cp/eoc/sta/action/src/drv.c8
-rw-r--r--cesar/cp/eoc/sta/action/test/utest/src/test_actions.c2
-rw-r--r--cesar/cp/eoc/sta/action/test/utest_eoc/src/assoc.c6
-rw-r--r--cesar/cp/msg/inc/msg_drv.h3
-rw-r--r--cesar/cp/msg/src/msg_drv.c3
-rw-r--r--cesar/cp/msg/stub/src/msg_drv.c7
-rw-r--r--cesar/cp/sta/mgr/inc/sta_own_data.h6
-rw-r--r--cesar/cp/sta/mgr/sta.h9
10 files changed, 18 insertions, 31 deletions
diff --git a/cesar/cp/eoc/cco/action/src/cco_action.c b/cesar/cp/eoc/cco/action/src/cco_action.c
index 6547e12646..3f48a6eecc 100644
--- a/cesar/cp/eoc/cco/action/src/cco_action.c
+++ b/cesar/cp/eoc/cco/action/src/cco_action.c
@@ -74,7 +74,6 @@ cp_eoc_cco_action__power_on_no_beacons (cp_t *ctx)
cp_sta_own_data_set_tei (ctx, tei);
cp_sta_own_data_set_authenticated_status (ctx, true);
- ctx->sta_mgr.sta_own_data.state = CP_EOC_STA_STATE_AUTHENTICATED;
cp_eoc_sta_action_drv__drv_sta_get_status_ind (ctx);
/* Set our AVLN. */
diff --git a/cesar/cp/eoc/sta/action/src/assoc_slave.c b/cesar/cp/eoc/sta/action/src/assoc_slave.c
index 14b5cf0bcc..72e9b24f3f 100644
--- a/cesar/cp/eoc/sta/action/src/assoc_slave.c
+++ b/cesar/cp/eoc/sta/action/src/assoc_slave.c
@@ -59,7 +59,6 @@ cp_eoc_sta_action_sta_clear_status (cp_t *ctx)
sta = cp_sta_mgr_sta_get_assoc (ctx, net, own_data->tei_track);
if (sta)
{
- ctx->sta_mgr.sta_own_data.state = CP_EOC_STA_STATE_UNASSOCIATED;
cp_eoc_sta_action_drv__drv_sta_get_status_ind(ctx);
cp_sta_set_authenticated (ctx, sta, false);
@@ -321,7 +320,6 @@ cp_eoc_sta_action_assoc__associating_cnf (cp_t *ctx, cp_mme_rx_t *mme)
/* Change state. */
cp_fsm_branch (ctx, ASSOCIATING, CC_ASSOC_CNF, success);
DBG_PRINT("sta: assoc");
- ctx->sta_mgr.sta_own_data.state = CP_EOC_STA_STATE_ASSOCIATED;
cp_eoc_sta_action_drv__drv_sta_get_status_ind (ctx);
}
}
@@ -403,7 +401,7 @@ cp_eoc_sta_action_assoc__associated_key_cnf (cp_t *ctx, cp_mme_rx_t *mme)
cp_msg_cm_get_key_req_send (ctx, &mme->peer, CP_MME_PEKS_DAK,
&ctx->sta_action.assoc.prun, &get_key);
- ctx->sta_mgr.sta_own_data.state = CP_EOC_STA_STATE_AUTHENTICATED;
+ cp_sta_own_data_set_authenticated_status (ctx, true);
cp_eoc_sta_action_drv__drv_sta_get_status_ind (ctx);
}
}
diff --git a/cesar/cp/eoc/sta/action/src/drv.c b/cesar/cp/eoc/sta/action/src/drv.c
index 923e02931d..33f024faa5 100644
--- a/cesar/cp/eoc/sta/action/src/drv.c
+++ b/cesar/cp/eoc/sta/action/src/drv.c
@@ -147,14 +147,18 @@ 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;
- cp_eoc_sta_state_t state = 0;
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;
- state = ctx->sta_mgr.sta_own_data.state;
+ 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/test/utest/src/test_actions.c b/cesar/cp/eoc/sta/action/test/utest/src/test_actions.c
index f8a88a8cb3..5b0c682131 100644
--- a/cesar/cp/eoc/sta/action/test/utest/src/test_actions.c
+++ b/cesar/cp/eoc/sta/action/test/utest/src/test_actions.c
@@ -1369,8 +1369,6 @@ test_case_association_and_authentication_action (test_t test)
cp_eoc_sta_action_assoc__associated_key_cnf (&ctx, mme);
test_fail_unless(ctx.fsm.active_states[0] == CP_FSM_STATE_AUTHENTICATED);
- test_fail_unless(ctx.sta_mgr.sta_own_data.state ==
- CP_EOC_STA_STATE_AUTHENTICATED);
cp_eoc_sta_mgr_sta_remove (&ctx, sta);
slab_release (sta);
cp_eoc_cco_action_test_release_mac_store (&ctx);
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
index 44b2164f26..ce05b527f1 100644
--- a/cesar/cp/eoc/sta/action/test/utest_eoc/src/assoc.c
+++ b/cesar/cp/eoc/sta/action/test/utest_eoc/src/assoc.c
@@ -46,12 +46,10 @@ assoc_test_case_basic (test_t t)
test_begin (t, "Started up.")
{
test_fail_unless (ctx.cp.mac_config->authenticated == false);
- test_fail_unless (ctx.cp.sta_mgr.sta_own_data.tei
- == MAC_TEI_UNASSOCIATED);
test_fail_unless (ctx.cp.sta_action.assoc.retry == 0);
test_fail_unless (ctx.cp.sta_action.assoc.beacon_loss == 0);
- test_fail_unless (ctx.cp.sta_mgr.sta_own_data.state
- == CP_EOC_STA_STATE_UNASSOCIATED);
+ test_fail_unless (cp_sta_own_data_get_tei (&ctx.cp)
+ == MAC_TEI_UNASSOCIATED);
}
test_end;
diff --git a/cesar/cp/msg/inc/msg_drv.h b/cesar/cp/msg/inc/msg_drv.h
index 0a88ca4d33..a9cd65f8c6 100644
--- a/cesar/cp/msg/inc/msg_drv.h
+++ b/cesar/cp/msg/inc/msg_drv.h
@@ -337,7 +337,8 @@ cp_msg_drv_sta_set_avln_hfid_ind_send (cp_t *ctx, cp_mme_peer_t *peer,
void
cp_msg_drv_get_status_ind_send (cp_t *ctx, cp_mme_peer_t *peer,
- mmtype_t mmtype, cp_eoc_sta_state_t state);
+ mmtype_t mmtype,
+ cp_msg_drv_sta_status_status_t state);
/**
* Receive DRV_MCAST_SET_LIST.REQ
diff --git a/cesar/cp/msg/src/msg_drv.c b/cesar/cp/msg/src/msg_drv.c
index f05926038b..4dba4b3f09 100644
--- a/cesar/cp/msg/src/msg_drv.c
+++ b/cesar/cp/msg/src/msg_drv.c
@@ -711,7 +711,8 @@ cp_msg_drv_sta_set_avln_hfid_ind_send (cp_t *ctx, cp_mme_peer_t *peer,
*/
void
cp_msg_drv_get_status_ind_send (cp_t *ctx, cp_mme_peer_t *peer,
- mmtype_t mmtype, cp_eoc_sta_state_t state)
+ mmtype_t mmtype,
+ cp_msg_drv_sta_status_status_t state)
{
cp_mme_tx_t *msg;
diff --git a/cesar/cp/msg/stub/src/msg_drv.c b/cesar/cp/msg/stub/src/msg_drv.c
index 41e3f16980..87ae57ab32 100644
--- a/cesar/cp/msg/stub/src/msg_drv.c
+++ b/cesar/cp/msg/stub/src/msg_drv.c
@@ -34,10 +34,13 @@ cp_msg_drv_sta_string_recv (cp_t *ctx, cp_mme_rx_t *mme, char *buffer,
void
cp_msg_drv_get_status_ind_send (cp_t *ctx, cp_mme_peer_t *peer,
- mmtype_t mmtype, cp_eoc_sta_state_t state) __attribute__((weak));
+ mmtype_t mmtype, cp_msg_drv_sta_status_status_t state)
+ __attribute__((weak));
+
void
cp_msg_drv_get_status_ind_send (cp_t *ctx, cp_mme_peer_t *peer,
- mmtype_t mmtype, cp_eoc_sta_state_t state)
+ mmtype_t mmtype,
+ cp_msg_drv_sta_status_status_t state)
{
dbg_assert (peer);
dbg_assert (mmtype);
diff --git a/cesar/cp/sta/mgr/inc/sta_own_data.h b/cesar/cp/sta/mgr/inc/sta_own_data.h
index 935d72ca15..ff405d0d5f 100644
--- a/cesar/cp/sta/mgr/inc/sta_own_data.h
+++ b/cesar/cp/sta/mgr/inc/sta_own_data.h
@@ -111,12 +111,6 @@ struct cp_sta_own_data_private_t
* Simple connect procedure status.
*/
bool sc;
-
-
- /**
- * State of the station (unassociated, associated, authenticated).
- */
- cp_eoc_sta_state_t state;
};
#endif /* cp_sta_data_inc_sta_own_data_h */
diff --git a/cesar/cp/sta/mgr/sta.h b/cesar/cp/sta/mgr/sta.h
index 2e6197bf8a..3d2488b246 100644
--- a/cesar/cp/sta/mgr/sta.h
+++ b/cesar/cp/sta/mgr/sta.h
@@ -36,15 +36,6 @@ enum cp_sta_visible_status_t
};
typedef enum cp_sta_visible_status_t cp_sta_visible_status_t;
-/** Enum */
-enum cp_eoc_sta_state_t
-{
- CP_EOC_STA_STATE_UNASSOCIATED,
- CP_EOC_STA_STATE_ASSOCIATED,
- CP_EOC_STA_STATE_AUTHENTICATED,
-};
-typedef enum cp_eoc_sta_state_t cp_eoc_sta_state_t;
-
/** Reassembly context block. */
struct cp_sta_reassembly_ctx_blk_t
{