From 1e2c32119db82da4daa2d733f3e2ce2f94231df8 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 6 Jan 2013 14:37:36 -0800 Subject: [PATCH] unit: Add test cases for SDP Service Search Requests --- unit/test-sdp.c | 113 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/unit/test-sdp.c b/unit/test-sdp.c index c20790746..2c55c95a8 100644 --- a/unit/test-sdp.c +++ b/unit/test-sdp.c @@ -726,5 +726,118 @@ int main(int argc, char *argv[]) raw_pdu(0x03, 0x00, 0x01, 0x00, 0x09, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00)); + /* + * Service Search Request + * + * Verify the correct behaviour of the IUT when searching for + * existing service(s), using continuation state. + */ + define_ss("BV-03-C/UUID-16", + raw_pdu(0x02, 0x00, 0x01, 0x00, 0x08, 0x35, 0x03, 0x19, + 0x01, 0x00, 0xff, 0xff, 0x00), + raw_pdu_cont(8, 0x03, 0x00, 0x01, 0x00, 0x29, 0x00, 0x08, 0x00, + 0x07, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, + 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, + 0x05, 0x00, 0x01, 0x00, 0x06, 0x08), + raw_pdu_cont(8, 0x02, 0x00, 0x02, 0x00, 0x10, 0x35, 0x03, 0x19, + 0x01, 0x00, 0xff, 0xff, 0x08), + raw_pdu(0x03, 0x00, 0x02, 0x00, 0x09, 0x00, 0x08, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x07, 0x00)); + define_ss("BV-03-C/UUID-32", + raw_pdu(0x02, 0x00, 0x01, 0x00, 0x0a, 0x35, 0x05, 0x1a, + 0x00, 0x00, 0x01, 0x00, 0xff, 0xff, 0x00), + raw_pdu_cont(8, 0x03, 0x00, 0x01, 0x00, 0x29, 0x00, 0x08, 0x00, + 0x07, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, + 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, + 0x05, 0x00, 0x01, 0x00, 0x06, 0x08), + raw_pdu_cont(8, 0x02, 0x00, 0x02, 0x00, 0x12, 0x35, 0x05, 0x1a, + 0x00, 0x00, 0x01, 0x00, 0xff, 0xff, 0x08), + raw_pdu(0x03, 0x00, 0x02, 0x00, 0x09, 0x00, 0x08, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x07, 0x00)); + define_ss("BV-03-C/UUID-128", + raw_pdu(0x02, 0x00, 0x01, 0x00, 0x16, 0x35, 0x11, 0x1c, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, + 0x80, 0x00, 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb, + 0xff, 0xff, 0x00), + raw_pdu_cont(8, 0x03, 0x00, 0x01, 0x00, 0x29, 0x00, 0x08, 0x00, + 0x07, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, + 0x03, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, + 0x05, 0x00, 0x01, 0x00, 0x06, 0x08), + raw_pdu_cont(8, 0x02, 0x00, 0x02, 0x00, 0x1e, 0x35, 0x11, 0x1c, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, + 0x80, 0x00, 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb, + 0xff, 0xff, 0x08), + raw_pdu(0x03, 0x00, 0x02, 0x00, 0x09, 0x00, 0x08, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x07, 0x00)); + + /* + * Service Search Request + * + * Verify the correct behaviour of the IUT when searching for + * no existing service(s). + */ + define_ss("BV-04-C/UUID-16", + raw_pdu(0x02, 0x00, 0x01, 0x00, 0x08, 0x35, 0x03, 0x19, + 0xff, 0xff, 0x00, 0x01, 0x00), + raw_pdu(0x03, 0x00, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x00, 0x00)); + define_ss("BV-04-C/UUID-128", + raw_pdu(0x02, 0x00, 0x01, 0x00, 0x16, 0x35, 0x11, 0x1c, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x01, 0x00), + raw_pdu(0x03, 0x00, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x00, 0x00)); + define_ss("BV-04-C/UUID-32", + raw_pdu(0x02, 0x00, 0x01, 0x00, 0x0a, 0x35, 0x05, 0x1a, + 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x00), + raw_pdu(0x03, 0x00, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x00, 0x00)); + + /* + * Service Search Request + * + * Verify the correct behaviour of the IUT when searching for + * existing service(s), using invalid PDU size. + */ + define_ss("BI-01-C/UUID-16", + raw_pdu(0x02, 0x00, 0x01, 0x00, 0x0d, 0x35, 0x03, 0x19, + 0x01, 0x00, 0x00, 0x05, 0x00), + raw_pdu(0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x04)); + define_ss("BI-01-C/UUID-32", + raw_pdu(0x02, 0x00, 0x01, 0x00, 0x0f, 0x35, 0x05, 0x1a, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x05, 0x00), + raw_pdu(0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x04)); + define_ss("BI-01-C/UUID-128", + raw_pdu(0x02, 0x00, 0x01, 0x00, 0x1b, 0x35, 0x11, 0x1c, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, + 0x80, 0x00, 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb, + 0x00, 0x05, 0x00), + raw_pdu(0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x04)); + + /* + * Service Search Request + * + * Verify the correct behaviour of the IUT when searching for + * existing service(s), using invalid request syntax. + */ + define_ss("BI-02-C/UUID-16", + raw_pdu(0x02, 0x00, 0x01, 0x00, 0x06, 0x35, 0x03, 0x19, + 0x01, 0x00, 0x00), + raw_pdu(0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03)); + define_ss("BI-02-C/UUID-32", + raw_pdu(0x02, 0x00, 0x01, 0x00, 0x08, 0x35, 0x05, 0x1a, + 0x00, 0x00, 0x01, 0x00, 0x00), + raw_pdu(0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03)); + define_ss("BI-02-C/UUID-128", + raw_pdu(0x02, 0x00, 0x01, 0x00, 0x14, 0x35, 0x11, 0x1c, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, + 0x80, 0x00, 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb, + 0x00), + raw_pdu(0x01, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03)); + return g_test_run(); } -- 2.47.3