summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschodet2008-12-09 15:23:53 +0000
committerschodet2008-12-09 15:23:53 +0000
commitaec3578384f10f3c5dec7351ff848ec563e750ee (patch)
tree7419f0488350f1a6b2aa80c522c630102334f04e
parent8cb2e5177a17f7df01ef4c24fb7e00bbf8e965cb (diff)
* cp:
- cleaned-up CP_MME_PEER usage. - removed one argument form of CP_MME_PEER, closes #198. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@3604 017c9cb6-072f-447c-8318-d5b54f68fe89
-rw-r--r--cesar/common/tests/tests10
-rw-r--r--cesar/cp/Module5
-rw-r--r--cesar/cp/cco/action/src/cco_action.c25
-rw-r--r--cesar/cp/cco/bw/Module2
-rw-r--r--cesar/cp/mme.h11
-rw-r--r--cesar/cp/sta/action/test/utest/src/assoc.c3
-rw-r--r--cesar/cp/sta/action/test/utest/src/drv.c2
-rw-r--r--cesar/cp/sta/action/test/utest/src/info.c44
-rw-r--r--cesar/cp/test/mme/src/test_mme.c10
9 files changed, 50 insertions, 62 deletions
diff --git a/cesar/common/tests/tests b/cesar/common/tests/tests
index ff96771672..75ace6c4b6 100644
--- a/cesar/common/tests/tests
+++ b/cesar/common/tests/tests
@@ -334,16 +334,6 @@ cp/pwl/test:
make
pwl: ./obj/pwl.elf
-cp/conn/test:
-make
-conn_test: ./obj/conn_test.elf
-
-cp/cco/bw/test:
-make
-bw_lib_alloc: ./obj/schedules.elf
-bw: ./obj/bw_test.elf
-bw_prio_heap: ./obj/bw_prio_heap_test.elf
-
cp/beacon/test:
make
beacon: ./obj/beacon.elf
diff --git a/cesar/cp/Module b/cesar/cp/Module
index 648fce77c3..d4d00be4a6 100644
--- a/cesar/cp/Module
+++ b/cesar/cp/Module
@@ -2,6 +2,5 @@ SOURCES := cp.c
ifeq ($(CONFIG_TRACE),y)
SOURCES += trace.c
endif
-MODULES := cp/beacon cp/cco/action cp/cco/bw cp/cl_interf \
-cp/conn cp/fsm cp/msg cp/pwl cp/secu cp/sta/action cp/sta/core \
-cp/sta/mgr
+MODULES := cp/beacon cp/cco/action cp/cco/bw cp/cl_interf cp/fsm cp/msg cp/pwl \
+cp/secu cp/sta/action cp/sta/core cp/sta/mgr
diff --git a/cesar/cp/cco/action/src/cco_action.c b/cesar/cp/cco/action/src/cco_action.c
index b20222311b..b0a01a7a9b 100644
--- a/cesar/cp/cco/action/src/cco_action.c
+++ b/cesar/cp/cco/action/src/cco_action.c
@@ -450,7 +450,6 @@ cp_cco_action__assoc__renew (cp_t *ctx, cp_mme_rx_t *msg,
{
cp_net_t *net;
cp_sta_t *sta;
- cp_tei_t tei;
cp_msg_cc_assoc_cnf_t cnf;
dbg_assert (ctx);
@@ -487,8 +486,7 @@ cp_cco_action__assoc__renew (cp_t *ctx, cp_mme_rx_t *msg,
}
/* Send the answer. */
- cp_msg_cc_assoc_cnf_send (ctx, &CP_MME_PEER(msg->peer.mac,
- tei), &cnf);
+ cp_msg_cc_assoc_cnf_send (ctx, &msg->peer, &cnf);
}
/**
@@ -640,9 +638,8 @@ cp_cco_action__cco__cm_get_key_req_pid0 (cp_t *ctx, cp_mme_rx_t * get_key_req)
cnf.key_type = req.key_type;
cnf.nid = req.nid;
cp_secu_protocol_next (&get_key_req->prun, true);
- cp_msg_cm_get_key_cnf_send (ctx, &CP_MME_PEER (get_key_req->peer.mac,
- get_key_req->peer.tei),
- get_key_req->peks, &get_key_req->prun, &cnf);
+ cp_msg_cm_get_key_cnf_send (ctx, &get_key_req->peer, get_key_req->peks,
+ &get_key_req->prun, &cnf);
}
/**
@@ -668,7 +665,7 @@ cp_cco_action__cco__sta_leave_send_tei_map (cp_t *ctx, cp_sta_t *sta)
if (!cp_net_is_empty (ctx, net))
{
- peer = &CP_MME_PEER (MAC_BROADCAST);
+ peer = &CP_MME_PEER_ALL_STA;
if (cp_sta_get_authenticated (ctx, sta))
{
@@ -703,7 +700,7 @@ cp_cco_action__cco__sta_leave_send_tei_map (cp_t *ctx, cp_sta_t *sta)
void
cp_cco_action__cco__tei_expired (cp_t *ctx, cp_sta_t *sta)
{
- cp_mme_peer_t *peer;
+ cp_mme_peer_t peer;
cp_net_t *net;
dbg_assert (ctx);
@@ -711,10 +708,9 @@ cp_cco_action__cco__tei_expired (cp_t *ctx, cp_sta_t *sta)
/* Get the network of the station. */
net = cp_sta_mgr_get_our_avln (ctx);
- peer = &CP_MME_PEER (cp_sta_get_mac_address (sta),
- cp_sta_get_tei (sta));
+ cp_sta_get_peer (sta, &peer);
- cp_msg_cc_leave_ind_send (ctx, peer,
+ cp_msg_cc_leave_ind_send (ctx, &peer,
CP_MSG_CC_LEAVE_IND_REASON_TEI_LEASE_EXPIRED,
cp_net_get_nid(ctx, net));
@@ -734,7 +730,6 @@ cp_cco_action__cco__tei_expired (cp_t *ctx, cp_sta_t *sta)
void
cp_cco_action__cco__cc_leave (cp_t *ctx, cp_mme_rx_t *mme)
{
- cp_mme_peer_t *peer;
cp_sta_t *sta;
cp_net_t *net;
bool res_read;
@@ -768,12 +763,10 @@ cp_cco_action__cco__cc_leave (cp_t *ctx, cp_mme_rx_t *mme)
sta = cp_sta_mgr_sta_get_assoc (ctx, net, mme->peer.tei);
dbg_check (sta);
- peer = &CP_MME_PEER (mme->peer.mac, mme->peer.tei);
-
if (mme->mmtype == CC_LEAVE_REQ)
- cp_msg_cc_leave_cnf_send (ctx, peer);
+ cp_msg_cc_leave_cnf_send (ctx, &mme->peer);
else
- cp_msg_cc_leave_rsp_send (ctx, peer);
+ cp_msg_cc_leave_rsp_send (ctx, &mme->peer);
cp_sta_mgr_release_station (ctx, cp_sta_get_tei (sta));
cp_cco_action__cco__sta_leave_send_tei_map (ctx, sta);
diff --git a/cesar/cp/cco/bw/Module b/cesar/cp/cco/bw/Module
index be06c3a4fe..e88b7ed3d6 100644
--- a/cesar/cp/cco/bw/Module
+++ b/cesar/cp/cco/bw/Module
@@ -1 +1 @@
-SOURCES:=bw_lib_alloc.c bw_prio_heap.c bw.c
+SOURCES:=bw_lib_alloc.c #bw_prio_heap.c bw.c
diff --git a/cesar/cp/mme.h b/cesar/cp/mme.h
index 35889dc543..c4fa686fef 100644
--- a/cesar/cp/mme.h
+++ b/cesar/cp/mme.h
@@ -309,15 +309,10 @@ typedef struct cp_mme_tx_t cp_mme_tx_t;
/** Construct a cp_mme_peer_t for unicast to all STA. */
#define CP_MME_PEER_ALL_STA \
- ((cp_mme_peer_t) { .mac = MAC_BROADCAST, .tei = MAC_TEI_BCAST })
+ ((cp_mme_peer_t) { .mac = MAC_BROADCAST, .tei = MAC_TEI_MULTI_UNICAST })
-/** Construct a cp_mme_peer_t from a MAC address and an optional TEI. */
-#define CP_MME_PEER(mac, tei...) \
- PASTE_EXPAND (CP_MME_PEER_, PREPROC_NARG (mac, ## tei)) (mac, ## tei)
-
-#define CP_MME_PEER_1(mac_) \
- CP_MME_PEER_2 (mac_, 0xff)
-#define CP_MME_PEER_2(mac_, tei_) \
+/** Construct a cp_mme_peer_t from a MAC address and a TEI. */
+#define CP_MME_PEER(mac_, tei_) \
((cp_mme_peer_t) { .mac = mac_, .vlan_tag = 0, .tei = tei_ })
/**
diff --git a/cesar/cp/sta/action/test/utest/src/assoc.c b/cesar/cp/sta/action/test/utest/src/assoc.c
index c99092c656..1e8fb00a00 100644
--- a/cesar/cp/sta/action/test/utest/src/assoc.c
+++ b/cesar/cp/sta/action/test/utest/src/assoc.c
@@ -115,7 +115,8 @@ assoc_basic_test_cases (test_t t)
.type = CP_FSM_EVENT_TYPE_to_assoc),
SCENARIO_ACTION (assoc__unassociated__to_assoc),
SCENARIO_EVENT (cp_msg_cc_assoc_req_send,
- .peer = CP_MME_PEER (cco_mac, 0), /* UCCo. */
+ .peer = CP_MME_PEER (
+ cco_mac, MAC_TEI_UNASSOCIATED), /* UCCo. */
.request_type = CP_MSG_CC_ASSOC_REQ_TYPE_NEW,
.nid = nid, .cco_cap = CP_CCO_LEVEL,
.proxy_cap = CP_PCO_CAP),
diff --git a/cesar/cp/sta/action/test/utest/src/drv.c b/cesar/cp/sta/action/test/utest/src/drv.c
index d57fb33260..eb4806f9bd 100644
--- a/cesar/cp/sta/action/test/utest/src/drv.c
+++ b/cesar/cp/sta/action/test/utest/src/drv.c
@@ -81,7 +81,7 @@ 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);
+ cp_mme_peer_t peer = CP_MME_PEER (0xaabbccddeeffull, MAC_TEI_FOREIGN);
test_case_begin (t, "basic");
test_begin (t, "set")
{
diff --git a/cesar/cp/sta/action/test/utest/src/info.c b/cesar/cp/sta/action/test/utest/src/info.c
index 75767d45db..53cd3c54f1 100644
--- a/cesar/cp/sta/action/test/utest/src/info.c
+++ b/cesar/cp/sta/action/test/utest/src/info.c
@@ -73,7 +73,7 @@ info_set_tei_map_test_cases (test_t t)
scenario_globals_t globals = {
.cp = &ctx.cp,
};
- cp_mme_peer_t peer = CP_MME_PEER (0xaabbccddeeffull);
+ cp_mme_peer_t peer = CP_MME_PEER (0xaabbccddeeffull, 1);
test_case_begin (t, "set_tei_map");
test_begin (t, "add first")
{
@@ -395,7 +395,8 @@ info_unassociated_sta_test_cases (test_t t)
{
scenario_entry_t entries[] = {
SCENARIO_ACTION (process_cm_unassociated_sta_ind,
- .peer = CP_MME_PEER (0x111111111111ull)),
+ .peer = CP_MME_PEER (0x111111111111ull,
+ MAC_TEI_UNASSOCIATED)),
SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
.ok = true,
.nid = 0xf11111111111ull, .cco_cap = 0),
@@ -413,28 +414,33 @@ info_unassociated_sta_test_cases (test_t t)
scenario_entry_t entries[] = {
/* More STA. */
SCENARIO_ACTION (process_cm_unassociated_sta_ind,
- .peer = CP_MME_PEER (0x222222222222ull)),
+ .peer = CP_MME_PEER (0x222222222222ull,
+ MAC_TEI_UNASSOCIATED)),
SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
.ok = true,
.nid = 0xf22222222222ull, .cco_cap = 1),
SCENARIO_ACTION (process_cm_unassociated_sta_ind,
- .peer = CP_MME_PEER (0x333333333333ull)),
+ .peer = CP_MME_PEER (0x333333333333ull,
+ MAC_TEI_UNASSOCIATED)),
SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
.ok = true,
.nid = 0xf33333333333ull, .cco_cap = 2),
SCENARIO_ACTION (process_cm_unassociated_sta_ind,
- .peer = CP_MME_PEER (0x444444444444ull)),
+ .peer = CP_MME_PEER (0x444444444444ull,
+ MAC_TEI_UNASSOCIATED)),
SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
.ok = true,
.nid = 0xf44444444444ull, .cco_cap = 0),
/* More STA with the same NID. */
SCENARIO_ACTION (process_cm_unassociated_sta_ind,
- .peer = CP_MME_PEER (0xaaaaaaaaaaaaull)),
+ .peer = CP_MME_PEER (0xaaaaaaaaaaaaull,
+ MAC_TEI_UNASSOCIATED)),
SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
.ok = true,
.nid = 0xf11111111111ull, .cco_cap = 1),
SCENARIO_ACTION (process_cm_unassociated_sta_ind,
- .peer = CP_MME_PEER (0xbbbbbbbbbbbbull)),
+ .peer = CP_MME_PEER (0xbbbbbbbbbbbbull,
+ MAC_TEI_UNASSOCIATED)),
SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
.ok = true,
.nid = 0xf22222222222ull, .cco_cap = 2),
@@ -457,13 +463,15 @@ info_unassociated_sta_test_cases (test_t t)
scenario_entry_t entries[] = {
/* Change of cco_cap. */
SCENARIO_ACTION (process_cm_unassociated_sta_ind,
- .peer = CP_MME_PEER (0x111111111111ull)),
+ .peer = CP_MME_PEER (0x111111111111ull,
+ MAC_TEI_UNASSOCIATED)),
SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
.ok = true,
.nid = 0xf11111111111ull, .cco_cap = 2),
/* Update, no change. */
SCENARIO_ACTION (process_cm_unassociated_sta_ind,
- .peer = CP_MME_PEER (0x222222222222ull)),
+ .peer = CP_MME_PEER (0x222222222222ull,
+ MAC_TEI_UNASSOCIATED)),
SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
.ok = true,
.nid = 0xf22222222222ull, .cco_cap = 1),
@@ -487,7 +495,8 @@ info_unassociated_sta_test_cases (test_t t)
{
scenario_entry_t entries[] = {
SCENARIO_ACTION (process_cm_unassociated_sta_ind,
- .peer = CP_MME_PEER (0x888888888888ull)),
+ .peer = CP_MME_PEER (0x888888888888ull,
+ MAC_TEI_UNASSOCIATED)),
SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
.ok = false,
.nid = 0xf88888888888ull, .cco_cap = 2),
@@ -510,28 +519,33 @@ info_unassociated_sta_test_cases (test_t t)
{
scenario_entry_t entries[] = {
SCENARIO_ACTION (process_cm_unassociated_sta_ind,
- .peer = CP_MME_PEER (0x555555555555ull)),
+ .peer = CP_MME_PEER (0x555555555555ull,
+ MAC_TEI_UNASSOCIATED)),
SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
.ok = true,
.nid = 0xf55555555555ull, .cco_cap = 0),
SCENARIO_ACTION (process_cm_unassociated_sta_ind,
- .peer = CP_MME_PEER (0x666666666666ull)),
+ .peer = CP_MME_PEER (0x666666666666ull,
+ MAC_TEI_UNASSOCIATED)),
SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
.ok = true,
.nid = 0xf66666666666ull, .cco_cap = 0),
SCENARIO_ACTION (process_cm_unassociated_sta_ind,
- .peer = CP_MME_PEER (0x777777777777ull)),
+ .peer = CP_MME_PEER (0x777777777777ull,
+ MAC_TEI_UNASSOCIATED)),
SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
.ok = true,
.nid = 0xf77777777777ull, .cco_cap = 0),
SCENARIO_ACTION (process_cm_unassociated_sta_ind,
- .peer = CP_MME_PEER (0x888888888888ull)),
+ .peer = CP_MME_PEER (0x888888888888ull,
+ MAC_TEI_UNASSOCIATED)),
SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
.ok = true,
.nid = 0xf88888888888ull, .cco_cap = 0),
/* No more room. */
SCENARIO_ACTION (process_cm_unassociated_sta_ind,
- .peer = CP_MME_PEER (0x999999999999ull)),
+ .peer = CP_MME_PEER (0x999999999999ull,
+ MAC_TEI_UNASSOCIATED)),
SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
.ok = true,
.nid = 0xf99999999999ull, .cco_cap = 0),
diff --git a/cesar/cp/test/mme/src/test_mme.c b/cesar/cp/test/mme/src/test_mme.c
index ef0d3d1884..a79c112926 100644
--- a/cesar/cp/test/mme/src/test_mme.c
+++ b/cesar/cp/test/mme/src/test_mme.c
@@ -137,14 +137,10 @@ mme_peer_test_suite (test_t t)
test_fail_unless (peer1.mac == 0x0123456789abull);
test_fail_unless (peer1.tei == 0xab);
test_fail_unless (peer1.vlan_tag == 0);
- cp_mme_peer_t peer2 = CP_MME_PEER (0x0123456789abull);
- test_fail_unless (peer2.mac == 0x0123456789abull);
- test_fail_unless (peer2.tei == 0xff);
+ cp_mme_peer_t peer2 = CP_MME_PEER_ALL_STA;
+ test_fail_unless (peer2.mac == MAC_BROADCAST);
+ test_fail_unless (peer2.tei == MAC_TEI_MULTI_UNICAST);
test_fail_unless (peer2.vlan_tag == 0);
- cp_mme_peer_t peer3 = CP_MME_PEER_ALL_STA;
- test_fail_unless (peer3.mac == MAC_BROADCAST);
- test_fail_unless (peer3.tei == MAC_TEI_BCAST);
- test_fail_unless (peer3.vlan_tag == 0);
} test_end;
test_begin (t, "cmp")
{