summaryrefslogtreecommitdiff
path: root/cesar/cp2/msg
diff options
context:
space:
mode:
authorlaranjeiro2008-07-04 08:51:42 +0000
committerlaranjeiro2008-07-04 08:51:42 +0000
commit4ed645e84a6c0a4f9d00b3e785de45431c92c800 (patch)
treefed8074e61444c50783d73a339a2183106a50933 /cesar/cp2/msg
parenteeb8653a1e09dd52860de9c93094ff03848cb819 (diff)
cp2/msg: Tested the fragmentation of the CC_SET_TEI_MAP.IND.
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@2550 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/cp2/msg')
-rw-r--r--cesar/cp2/msg/src/msg_cc.c3
-rw-r--r--cesar/cp2/msg/test/src/cc_set_tei_map_frag.c60
2 files changed, 58 insertions, 5 deletions
diff --git a/cesar/cp2/msg/src/msg_cc.c b/cesar/cp2/msg/src/msg_cc.c
index 0434b8cd27..5d4a7c5fc8 100644
--- a/cesar/cp2/msg/src/msg_cc.c
+++ b/cesar/cp2/msg/src/msg_cc.c
@@ -531,6 +531,9 @@ cp_msg_set_tei_map_change_buffer (bitstream_t *ctx,
cp_msg_mme_write_frag_header (data->cp, data->msg, &data->msg->peer,
CC_SET_TEI_MAP_IND, data->fmi_nbFrag,
data->fmi_fnmi, data->fmi_ssn);
+
+ // Set newly the boolean indicating the buffer change callback is present.
+ data->msg->bitstream.buffer_cb_present = true;
}
diff --git a/cesar/cp2/msg/test/src/cc_set_tei_map_frag.c b/cesar/cp2/msg/test/src/cc_set_tei_map_frag.c
index 90b8e982fa..6299a0e0c4 100644
--- a/cesar/cp2/msg/test/src/cc_set_tei_map_frag.c
+++ b/cesar/cp2/msg/test/src/cc_set_tei_map_frag.c
@@ -51,10 +51,20 @@ test_case_msg_cc_set_tei_map_frag (void)
cp_t cp;
bitstream_t stream;
mme_header_t header;
+ mac_config_t mac_config;
u8 *buffer1;
u8 *buffer2;
+ cp.mac_config = &mac_config;
+ test_init (test, 0, NULL);
+
+ cp_sta_own_data_set_tei (&cp, 0xA);
+ cp_sta_own_data_set_mac_address (&cp, 0x123456789ABCull);
+ cp_sta_mgr_update_our_avln_nid (&cp, 0x123456789ABCDEFull);
+ cp_sta_mgr_update_our_avln_snid (&cp, 0x2);
+
+
test_case_begin (test, "CC_SET_TEI_MAP.IND : Send");
peer.mac = 0x23456789ABCDull;
@@ -74,11 +84,10 @@ test_case_msg_cc_set_tei_map_frag (void)
cp_msg_cc_set_tei_map_ind_send_sta (&cp, mme_tx, i + 1, i + 1,
CP_MSG_CC_SET_TEI_MAP_IND_STATUS_ASSOCIATED);
}
- cp_msg_cc_set_tei_map_ind_send_end (&cp, mme_tx);
-
// get the second buffer.
buffer2 = mme_tx->p_mme;
- slab_release (mme_tx);
+
+ cp_msg_cc_set_tei_map_ind_send_end (&cp, mme_tx);
bitstream_init (&stream, buffer1, 1518, BITSTREAM_READ);
@@ -92,7 +101,7 @@ test_case_msg_cc_set_tei_map_frag (void)
bitstream_access (&stream, &header.fmi_mi, 4);
bitstream_access (&stream, &header.fmi_ssn, 8);
- test_begin (test, "Verify")
+ test_begin (test, "Verify buffer 1")
{
bitstream_access (&stream, &data, 8);
test_fail_if (data != mode, "Wrong mode");
@@ -112,12 +121,52 @@ test_case_msg_cc_set_tei_map_frag (void)
}
test_end
bitstream_finalise (&stream);
+
+ bitstream_init (&stream, buffer2, 1518, BITSTREAM_READ);
+
+ bitstream_access (&stream, &header.oda, 48);
+ bitstream_access (&stream, &header.osa, 48);
+ bitstream_access (&stream, &header.mtype, 16);
+ header.mtype = swap16 (header.mtype);
+ bitstream_access (&stream, &header.mmv, 8);
+ bitstream_access (&stream, &header.mmtype, 16);
+ bitstream_access (&stream, &header.fmi_inf, 4);
+ bitstream_access (&stream, &header.fmi_mi, 4);
+ bitstream_access (&stream, &header.fmi_ssn, 8);
+
+ test_begin (test, "Verify buffer 2")
+ {
+ bitstream_access (&stream, &data, 40);
+ test_fail_if (data != 0, "Wrong status");
+ for ( i = 0; i < 12; i++)
+ {
+ bitstream_access (&stream, &data, 8);
+ test_fail_if (data != i + 189, "Wrong TEI");
+ bitstream_access (&stream, &data, 48);
+ test_fail_if (data != i + 189, "Wrong Mac Address");
+ bitstream_access (&stream, &data, 8);
+ test_fail_if (data != CP_MSG_CC_SET_TEI_MAP_IND_STATUS_ASSOCIATED,
+ "Wrong status");
+ }
+ }
+ test_end
+ bitstream_finalise (&stream);
}
int
main (void)
{
- return 0;
+ test_case_msg_cc_set_tei_map_frag ();
+
+ 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;
}
u8 *
@@ -145,5 +194,6 @@ cp_cl_interf_add_buffer_tx (cp_t *ctx, u8 * buffer)
void
cp_cl_interf_mme_send (cp_t *ctx, cp_mme_tx_t * mme)
{
+ dbg_assert (mme);
mme->p_mme = NULL;
}