summaryrefslogtreecommitdiff
path: root/cesar/interface/test/src/test-interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/interface/test/src/test-interface.c')
-rw-r--r--cesar/interface/test/src/test-interface.c130
1 files changed, 114 insertions, 16 deletions
diff --git a/cesar/interface/test/src/test-interface.c b/cesar/interface/test/src/test-interface.c
index aacdafce92..74a1e910da 100644
--- a/cesar/interface/test/src/test-interface.c
+++ b/cesar/interface/test/src/test-interface.c
@@ -54,14 +54,42 @@ void ipmbox_tx (ipmbox_t *ctx, u32 *first_msg, uint length);
void
test_configure_sniffer (test_t test)
{
- u8 buffer[3];
- test_case_begin (test, "Configure the sniffer");
+ bitstream_t bitstream;
+ u8 buffer[60];
+ mac_t oda;
+ uint mtype;
+ uint data;
+
- buffer[0] = INTERFACE_MODULE_SNIFFER;
- buffer[1] = 1;
+ test_case_begin (test, "Configure the sniffer");
- buffer[2] = 0x1;
- interface_configure (interface, buffer);
+ oda = 0x123456789ABCull;
+ mtype = HPAV_MTYPE_MME;
+ bitstream_init (&bitstream, buffer, 60, BITSTREAM_WRITE);
+ bitstream_access ( &bitstream, &oda, 48);
+ bitstream_access ( &bitstream, &oda, 48);
+ bitstream_access ( &bitstream, &mtype, 16);
+ // MMV equal 1.
+ data = 0x1;
+ bitstream_access ( &bitstream, &data, 8);
+ // MMtype = 0xA030
+ data = 0xA030;
+ bitstream_access ( &bitstream, &data, 16);
+ // FMI = 0
+ data = 0;
+ bitstream_access ( &bitstream, &data, 16);
+ // Module
+ data = INTERFACE_MODULE_SNIFFER;
+ bitstream_access ( &bitstream, &data, 8);
+ // length in bytes = 1
+ data = 1;
+ bitstream_access ( &bitstream, &data, 8);
+ // Activate the MME tx sniffer
+ data = 0x1;
+ bitstream_access ( &bitstream, &data, 8);
+ bitstream_finalise ( &bitstream );
+
+ interface_hle_recv (interface, buffer);
test_begin (test, "Activate the mme tx")
{
test_fail_if (interface_sniffer_mme_status_tx (interface->sniffer) !=
@@ -69,9 +97,32 @@ test_configure_sniffer (test_t test)
}
test_end;
- buffer[2] = 0x3;
- interface_configure (interface, buffer);
- test_begin (test, "Anactivate the mme tx/rx")
+ bitstream_init (&bitstream, buffer, 60, BITSTREAM_WRITE);
+ bitstream_access ( &bitstream, &oda, 48);
+ bitstream_access ( &bitstream, &oda, 48);
+ bitstream_access ( &bitstream, &mtype, 16);
+ // MMV equal 1.
+ data = 0x1;
+ bitstream_access ( &bitstream, &data, 8);
+ // MMtype = 0xA030
+ data = 0xA030;
+ bitstream_access ( &bitstream, &data, 16);
+ // FMI = 0
+ data = 0;
+ bitstream_access ( &bitstream, &data, 16);
+ // Module
+ data = INTERFACE_MODULE_SNIFFER;
+ bitstream_access ( &bitstream, &data, 8);
+ // length in bytes = 1
+ data = 1;
+ bitstream_access ( &bitstream, &data, 8);
+ // Activate the MME tx sniffer
+ data = 0x3;
+ bitstream_access ( &bitstream, &data, 8);
+ bitstream_finalise ( &bitstream );
+
+ interface_hle_recv (interface, buffer);
+ test_begin (test, "Unactivate the mme tx/rx")
{
test_fail_if (interface_sniffer_mme_status_tx (interface->sniffer) !=
true, "Error sniffer mme TX shall be active");
@@ -80,8 +131,31 @@ test_configure_sniffer (test_t test)
}
test_end;
- buffer[2] = 0x7;
- interface_configure (interface, buffer);
+ bitstream_init (&bitstream, buffer, 60, BITSTREAM_WRITE);
+ bitstream_access ( &bitstream, &oda, 48);
+ bitstream_access ( &bitstream, &oda, 48);
+ bitstream_access ( &bitstream, &mtype, 16);
+ // MMV equal 1.
+ data = 0x1;
+ bitstream_access ( &bitstream, &data, 8);
+ // MMtype = 0xA030
+ data = 0xA030;
+ bitstream_access ( &bitstream, &data, 16);
+ // FMI = 0
+ data = 0;
+ bitstream_access ( &bitstream, &data, 16);
+ // Module
+ data = INTERFACE_MODULE_SNIFFER;
+ bitstream_access ( &bitstream, &data, 8);
+ // length in bytes = 1
+ data = 1;
+ bitstream_access ( &bitstream, &data, 8);
+ // Activate the MME tx sniffer
+ data = 0x7;
+ bitstream_access ( &bitstream, &data, 8);
+ bitstream_finalise ( &bitstream );
+
+ interface_hle_recv (interface, buffer);
test_begin (test, "Anactivate the mme tx/rx, beacon Tx")
{
test_fail_if (interface_sniffer_mme_status_tx (interface->sniffer) !=
@@ -93,8 +167,31 @@ test_configure_sniffer (test_t test)
}
test_end;
- buffer[2] = 0xF;
- interface_configure (interface, buffer);
+ bitstream_init (&bitstream, buffer, 60, BITSTREAM_WRITE);
+ bitstream_access ( &bitstream, &oda, 48);
+ bitstream_access ( &bitstream, &oda, 48);
+ bitstream_access ( &bitstream, &mtype, 16);
+ // MMV equal 1.
+ data = 0x1;
+ bitstream_access ( &bitstream, &data, 8);
+ // MMtype = 0xA030
+ data = 0xA030;
+ bitstream_access ( &bitstream, &data, 16);
+ // FMI = 0
+ data = 0;
+ bitstream_access ( &bitstream, &data, 16);
+ // Module
+ data = INTERFACE_MODULE_SNIFFER;
+ bitstream_access ( &bitstream, &data, 8);
+ // length in bytes = 1
+ data = 1;
+ bitstream_access ( &bitstream, &data, 8);
+ // Activate the MME tx sniffer
+ data = 0xF;
+ bitstream_access ( &bitstream, &data, 8);
+ bitstream_finalise ( &bitstream );
+
+ interface_hle_recv (interface, buffer);
test_begin (test, "Sniffer conf")
{
test_fail_if (interface_sniffer_beacon_status_rx (interface->sniffer)
@@ -301,12 +398,13 @@ main (void)
* Initialise the interface to add an Interface buffer.
*
* \param ctx the hle context.
- * \param cb the function to call on interface buffer reception.
+ * \param buffer_cb the function to call on interface buffer reception.
+ * \param mme_cb the function to call on interface mme.
* \param user_data the user_data to provide on function call.
*/
void
-hle_init_interface_buffer_add_cb (hle_t *ctx, hle_interface_buffer_add_cb_t
- cb, void *user_data)
+hle_init_interface_cb (hle_t *ctx, hle_interface_buffer_add_cb_t buffer_cb,
+ hle_interface_mme_recv_cb_t mme_cb, void *user_data)
{
}