summaryrefslogtreecommitdiff
path: root/cesar
diff options
context:
space:
mode:
Diffstat (limited to 'cesar')
-rw-r--r--cesar/cp2/beacon/test/src/bentry.c10
-rw-r--r--cesar/cp2/cco/action/test/src/action-test.c3
-rw-r--r--cesar/cp2/secu/test/src/test-aes.c10
-rw-r--r--cesar/cp2/sta/mgr/test/src/cl_stub.c25
-rw-r--r--cesar/cp2/sta/mgr/test/src/sta-test.c10
-rw-r--r--cesar/cp2/sta/mgr/test/src/station_test.c4
-rw-r--r--cesar/hle/test/src/hle_add_buffer.c18
-rw-r--r--cesar/interface/sniffer/src/sniffer.c9
-rw-r--r--cesar/mac/sar/test/src/reassembly_unit_test_functions.c8
-rw-r--r--cesar/mac/sar/test/unit_test/ecos/src/reassembly_complete.c1
-rw-r--r--cesar/test_general/hard/bridgedma/src/bridgedma-rx-one-frame.c10
11 files changed, 58 insertions, 50 deletions
diff --git a/cesar/cp2/beacon/test/src/bentry.c b/cesar/cp2/beacon/test/src/bentry.c
index e163466d43..134f8ace14 100644
--- a/cesar/cp2/beacon/test/src/bentry.c
+++ b/cesar/cp2/beacon/test/src/bentry.c
@@ -985,8 +985,9 @@ test_case_bentry_discover_info (test_t test)
test_case_begin (test, "Discover Info : Read");
- buffer [0] = CP_BENTRY_DISCOVER_INFO;
- buffer [1] = CP_BEACON_ENTRY_DISCOVER_INFO;
+ bitstream_init (&bitstream, buffer, 200, BITSTREAM_WRITE);
+ bitstream_write (&bitstream, CP_BENTRY_DISCOVER_INFO, 8);
+ bitstream_write (&bitstream, CP_BEACON_ENTRY_DISCOVER_INFO, 8);
info_struct.updated = true;
info_struct.cco_cap = 2;
@@ -999,8 +1000,7 @@ test_case_bentry_discover_info (test_t test)
info_struct.num_dis_net = 30;
info_struct.authentication = true;
info_struct.status_user_ap_cco = false;
-
- bitstream_init (&bitstream, buffer + 2, 10, BITSTREAM_WRITE);
+
bitstream_access (&bitstream, &info_struct.updated, 1);
bitstream_access (&bitstream, &info_struct.cco_cap, 2);
bitstream_access (&bitstream, &info_struct.proxy_net_cap, 1);
@@ -1058,7 +1058,7 @@ test_case_bentry_discover_info (test_t test)
bentry.read_write = CP_BEACON_BENTRY_WRITE;
cp_beacon_bentry_mgr_discover_info_bentry (&bentry, &info_struct);
-
+
test_begin (test, "verify")
{
test_fail_if (bitstream_memcmp(buffer, buffer2, 6) != true,
diff --git a/cesar/cp2/cco/action/test/src/action-test.c b/cesar/cp2/cco/action/test/src/action-test.c
index d68d76ae8e..900953d5fb 100644
--- a/cesar/cp2/cco/action/test/src/action-test.c
+++ b/cesar/cp2/cco/action/test/src/action-test.c
@@ -841,8 +841,7 @@ cp_msg_cm_get_key_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
else
offset = 37;
- bitstream_memcpy (mme->p_mme + offset, &data->hash_key, mme->length -
- offset);
+ memcpy (mme->p_mme + offset, &data->hash_key, mme->length - offset);
return true;
}
diff --git a/cesar/cp2/secu/test/src/test-aes.c b/cesar/cp2/secu/test/src/test-aes.c
index d9c7d7cb02..60fd8e2820 100644
--- a/cesar/cp2/secu/test/src/test-aes.c
+++ b/cesar/cp2/secu/test/src/test-aes.c
@@ -42,11 +42,11 @@ test_case_aes (test_t test)
test_begin (test, "Verify")
{
- test_fail_if (bitstream_memcmp(output, result, 16) != true,
+ test_fail_if (memcmp(output, result, 16) != 0,
"Wrong encryption");
aes_decrypt (&aes, output, output);
- test_fail_if (bitstream_memcmp(output, input, 16) != true,
+ test_fail_if (memcmp(output, input, 16) != 0,
"Wrong encryption");
}
test_end;
@@ -76,11 +76,11 @@ test_case_aes_in_one_buffer (test_t test)
test_begin (test, "Verify")
{
- test_fail_if (bitstream_memcmp(buffer, result, 16) != true,
+ test_fail_if (memcmp(buffer, result, 16) != 0,
"Wrong encryption");
aes_decrypt (&aes, buffer, buffer);
- test_fail_if (bitstream_memcmp(buffer, input, 16) != true,
+ test_fail_if (memcmp(buffer, input, 16) != 0,
"Wrong encryption");
}
test_end;
@@ -111,7 +111,7 @@ test_case_aes_crypt_in_one_buffer (test_t test)
test_begin (test, "Verify")
{
aes_cbc_decrypt (&aes, key_cp, buffer, buffer, 224);
- test_fail_if (bitstream_memcmp(buffer, input, 224) != true,
+ test_fail_if (memcmp(buffer, input, 224) != 0,
"Wrong encryption");
}
test_end;
diff --git a/cesar/cp2/sta/mgr/test/src/cl_stub.c b/cesar/cp2/sta/mgr/test/src/cl_stub.c
index ca78f053a9..e9ff2f1556 100644
--- a/cesar/cp2/sta/mgr/test/src/cl_stub.c
+++ b/cesar/cp2/sta/mgr/test/src/cl_stub.c
@@ -9,17 +9,18 @@
* \file cl/cl_mactotei.h
* \brief mac to tei table interface between the CL and the CP
* \ingroup cl
- *
- */
+ *
+ */
#include "common/std.h"
#include "cl/cl_mactotei.h"
#include "lib/bitstream.h"
+#include <string.h>
/**
* 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
+ *
+ * \return a pointer to the new block to be fill with the mac to tei table
* data
*/
cl_mactotei_blk_t *
@@ -65,12 +66,12 @@ void cl_mactotei_addr_add (cl_mactotei_blk_t *table, mac_t mac_addr,
/**
* Request the CL to copy all the data corresponding to the tag.
- *
+ *
* \param ctx the cl context.
* \param table the mactotei new table to fill
* \param tag the tag to copy
*/
-void
+void
cl_mactotei_copy_tag (cl_t *ctx,
cl_mactotei_blk_t *table, u8 tag)
{
@@ -78,13 +79,13 @@ cl_mactotei_copy_tag (cl_t *ctx,
/**
* Request the CL to copy all the data corresponding to the tag and the tei.
- *
+ *
* \param ctx the cl context.
* \param table the mactotei new table to fill
* \param tei the tei to copy.
* \param tag the tag to copy
*/
-void
+void
cl_mactotei_copy_tei_and_tag (cl_t *ctx,
cl_mactotei_blk_t *table, u8 tei, u8 tag)
{
@@ -92,9 +93,9 @@ cl_mactotei_copy_tei_and_tag (cl_t *ctx,
/**
* 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.
+ * \param table the new table to use.
*/
void
cl_mactotei_use_table (cl_t *ctx, cl_mactotei_blk_t *table)
@@ -102,14 +103,14 @@ cl_mactotei_use_table (cl_t *ctx, cl_mactotei_blk_t *table)
dbg_assert (ctx);
dbg_assert (table);
- bitstream_memcpy ((u8 *) ctx, (u8 *)table, 512) ;
+ memcpy ((u8 *) ctx, (u8 *)table, 512) ;
blk_release (table);
}
/**
* Release the complete table from the memory.
- *
+ *
* \param ctx the convergence layer context
*/
void cl_mactotei_release_table (cl_t *ctx)
diff --git a/cesar/cp2/sta/mgr/test/src/sta-test.c b/cesar/cp2/sta/mgr/test/src/sta-test.c
index 68abb71aa1..ab22b07903 100644
--- a/cesar/cp2/sta/mgr/test/src/sta-test.c
+++ b/cesar/cp2/sta/mgr/test/src/sta-test.c
@@ -190,9 +190,9 @@ test_case_sta_npw (test_t test)
test_begin (test, "get the NPW")
{
- test_fail_if (bitstream_memcmp (
+ test_fail_if (memcmp (
(u8 *) cp_sta_own_data_get_npw(&cp),
- npw, sizeof (npw)) != true, "Wrong NPW");
+ npw, sizeof (npw)) != 0, "Wrong NPW");
}
test_end;
}
@@ -261,16 +261,16 @@ test_case_sta_dpw (test_t test)
test_begin (test, "store of the DPW")
{
- test_fail_if (bitstream_memcmp(data->dpw, dpw, sizeof(dpw)) != true,
+ test_fail_if (memcmp(data->dpw, dpw, sizeof(dpw)) != 0,
"wrong DPW");
}
test_end;
test_begin (test, "get the DPW")
{
- test_fail_if (bitstream_memcmp (
+ test_fail_if (memcmp (
(u8 *) cp_sta_own_data_get_dpw(&cp),
- dpw, sizeof (dpw)) != true, "Wrong NMK");
+ dpw, sizeof (dpw)) != 0, "Wrong NMK");
}
test_end;
}
diff --git a/cesar/cp2/sta/mgr/test/src/station_test.c b/cesar/cp2/sta/mgr/test/src/station_test.c
index e55e436e3b..e5235ef21d 100644
--- a/cesar/cp2/sta/mgr/test/src/station_test.c
+++ b/cesar/cp2/sta/mgr/test/src/station_test.c
@@ -39,8 +39,8 @@ test_case_station_init (test_t test)
test_case_begin (test, "Station init");
test_begin (test, "verify data")
{
- test_fail_if (bitstream_memcmp(sta, &station,
- sizeof(cp_sta_private_t)) != true,
+ test_fail_if (memcmp(sta, &station,
+ sizeof(cp_sta_private_t)) != 0,
"Wrong sta is not initialised");
}
test_end;
diff --git a/cesar/hle/test/src/hle_add_buffer.c b/cesar/hle/test/src/hle_add_buffer.c
index bfde07e9e4..031dea4290 100644
--- a/cesar/hle/test/src/hle_add_buffer.c
+++ b/cesar/hle/test/src/hle_add_buffer.c
@@ -81,10 +81,10 @@ int main (void)
bitstream_access (&bitstream, &data, 3);
bitstream_finalise (&bitstream);
- bitstream_memcpy (&msgs[1], &buff_packet[0], sizeof(uint));
+ memcpy (&msgs[1], &buff_packet[0], sizeof(uint));
- bitstream_memcpy (&msgs[2], &msgs[0], sizeof(uint));
- bitstream_memcpy (&msgs[3], &buff_packet[1], sizeof(uint));
+ memcpy (&msgs[2], &msgs[0], sizeof(uint));
+ memcpy (&msgs[3], &buff_packet[1], sizeof(uint));
hle_ipmbox_recv (hle, msgs, 4);
@@ -105,9 +105,9 @@ int main (void)
bitstream_finalise (&bitstream);
- bitstream_memcpy (&msgs[1], &buff_packet[0], sizeof(uint));
- bitstream_memcpy (&msgs[2], &msgs[0], sizeof(uint));
- bitstream_memcpy (&msgs[3], &buff_packet[1], sizeof(uint));
+ memcpy (&msgs[1], &buff_packet[0], sizeof(uint));
+ memcpy (&msgs[2], &msgs[0], sizeof(uint));
+ memcpy (&msgs[3], &buff_packet[1], sizeof(uint));
hle_ipmbox_recv (hle, msgs, 4);
@@ -131,9 +131,9 @@ int main (void)
bitstream_access (&bitstream, &data, 3);
bitstream_finalise (&bitstream);
- bitstream_memcpy (&msgs[1], &buff_packet[0], sizeof(uint));
- bitstream_memcpy (&msgs[2], &msgs[0], sizeof(uint));
- bitstream_memcpy (&msgs[3], &buff_packet[1], sizeof(uint));
+ memcpy (&msgs[1], &buff_packet[0], sizeof(uint));
+ memcpy (&msgs[2], &msgs[0], sizeof(uint));
+ memcpy (&msgs[3], &buff_packet[1], sizeof(uint));
hle_ipmbox_recv (hle, msgs, 4);
diff --git a/cesar/interface/sniffer/src/sniffer.c b/cesar/interface/sniffer/src/sniffer.c
index 45d9f890a6..e0722496c5 100644
--- a/cesar/interface/sniffer/src/sniffer.c
+++ b/cesar/interface/sniffer/src/sniffer.c
@@ -161,16 +161,17 @@ interface_sniffer_copy_beacon (interface_sniffer_t *ctx, pb_beacon_t *beacon,
/* Inserting length. */
bitstream_access (&bitstream, &length, 16);
- /* inserting the first data word of the beacon. */
+ /* inserting the first data word of the beacon. */
bitstream_access (&bitstream, &beacon->first_data_word, 32);
bitstream_finalise (&bitstream);
/* Make a copy of the full beacon. */
- bitstream_memcpy (buffer + 27, beacon->data, length - 4);
+ bitstream_memcpy (buffer + bitstream_bytes_processed(&bitstream),
+ beacon->data, length - 4);
word[0] = BF_FILL (IPMBOX_REG, (MSG_TYPE, HLE_MSG_TYPE_INTERFACE),
- (MSG_LENGTH, 1),
+ (MSG_LENGTH, 1),
(PARAM_INTERFACE_TYPE, INTERFACE_MODULE_SNIFFER),
(PARAM_INTERFACE_LENGTH, length));
@@ -178,7 +179,7 @@ interface_sniffer_copy_beacon (interface_sniffer_t *ctx, pb_beacon_t *beacon,
/** Request the interface to send the message to the linux driver. */
- (*ctx->send_func) (ctx->send_user_data, word, 2);
+ (*ctx->send_func) (ctx->send_user_data, word, 2);
}
diff --git a/cesar/mac/sar/test/src/reassembly_unit_test_functions.c b/cesar/mac/sar/test/src/reassembly_unit_test_functions.c
index ee86ec6295..5b895926fa 100644
--- a/cesar/mac/sar/test/src/reassembly_unit_test_functions.c
+++ b/cesar/mac/sar/test/src/reassembly_unit_test_functions.c
@@ -159,11 +159,11 @@ void sar_unit_test_generate_pb_list (pb_t **first, pb_t **last)
write_mfh (pb_list[10]->data + 431, length, type, ats);
// Repeat the PB with the ssn = 1.
- bitstream_memcpy (&pb_list[12]->header, &pb_list[1]->header, 4);
- bitstream_memcpy (pb_list[12]->data, pb_list[1]->data, 512);
+ memcpy (&pb_list[12]->header, &pb_list[1]->header, 4);
+ memcpy (pb_list[12]->data, pb_list[1]->data, 512);
- bitstream_memcpy (&pb_list[13]->header, &pb_list[10]->header, 4);
- bitstream_memcpy (pb_list[13]->data, pb_list[10]->data, 512);
+ memcpy (&pb_list[13]->header, &pb_list[10]->header, 4);
+ memcpy (pb_list[13]->data, pb_list[10]->data, 512);
*first = pb_list[6];
pb_list[6]->next= pb_list[2];
diff --git a/cesar/mac/sar/test/unit_test/ecos/src/reassembly_complete.c b/cesar/mac/sar/test/unit_test/ecos/src/reassembly_complete.c
index f3a3bc6bb2..efeaf756d3 100644
--- a/cesar/mac/sar/test/unit_test/ecos/src/reassembly_complete.c
+++ b/cesar/mac/sar/test/unit_test/ecos/src/reassembly_complete.c
@@ -183,6 +183,7 @@ void this_test_data_rx (void)
sar_mpdu_add (sar_ctx, (mfs_t *) mfs, NULL, &rx_params, pb_first,
pb_last, 14, NULL, 0);
+ pb_last->next = NULL;
sar_mfs_add (sar_ctx, (mfs_t *)mfs);
diff --git a/cesar/test_general/hard/bridgedma/src/bridgedma-rx-one-frame.c b/cesar/test_general/hard/bridgedma/src/bridgedma-rx-one-frame.c
index a4b9e1bc18..994baae4c2 100644
--- a/cesar/test_general/hard/bridgedma/src/bridgedma-rx-one-frame.c
+++ b/cesar/test_general/hard/bridgedma/src/bridgedma-rx-one-frame.c
@@ -143,8 +143,14 @@ bridgedma_test (void)
bitstream_init (&bitstream, pb_first->data + TEST_BRIDGEDMA_JOB_OFFSET,
BLK_SIZE - TEST_BRIDGEDMA_JOB_OFFSET,
BITSTREAM_WRITE);
- bitstream_access_buf (&bitstream, &mf_header1, 4);
- bitstream_access_buf (&bitstream, &mf_header2, 2);
+ bitstream_access (&bitstream, &mf_header1, 32);
+ bitstream_access (&bitstream, &mf_header2, 16);
+ bitstream_finalise (&bitstream);
+
+ bitstream_init (&bitstream, pb_first->data + TEST_BRIDGEDMA_JOB_OFFSET
+ + job->header_len,
+ BLK_SIZE - TEST_BRIDGEDMA_JOB_OFFSET,
+ BITSTREAM_WRITE);
bitstream_access_buf (&bitstream, (u8 *) source_buffer,
BLK_SIZE - 6 - TEST_BRIDGEDMA_JOB_OFFSET);
bitstream_finalise (&bitstream);