OSDN Git Service

unit/AVDTP: Add /TP/SIG/SYN/BV-04-C test
[android-x86/external-bluetooth-bluez.git] / unit / test-avdtp.c
index bc28821..799e2f2 100644 (file)
@@ -41,6 +41,7 @@
 
 struct test_pdu {
        bool valid;
+       bool fragmented;
        const uint8_t *data;
        size_t size;
 };
@@ -59,6 +60,14 @@ struct test_data {
                .size = sizeof(data(args)),                     \
        }
 
+#define frg_pdu(args...) \
+       {                                                       \
+               .valid = true,                                  \
+               .fragmented = true,                             \
+               .data = data(args),                             \
+               .size = sizeof(data(args)),                     \
+       }
+
 #define define_test(name, function, args...) \
        do {                                                            \
                const struct test_pdu pdus[] = {                        \
@@ -77,9 +86,11 @@ struct context {
        struct avdtp_local_sep *sep;
        struct avdtp_stream *stream;
        guint source;
+       guint process;
        int fd;
        int mtu;
        gboolean pending_open;
+       gboolean pending_suspend;
        unsigned int pdu_offset;
        const struct test_data *data;
 };
@@ -103,6 +114,9 @@ static gboolean context_quit(gpointer user_data)
 {
        struct context *context = user_data;
 
+       if (context->process > 0)
+               g_source_remove(context->process);
+
        g_main_loop_quit(context->main_loop);
 
        return FALSE;
@@ -121,11 +135,14 @@ static gboolean send_pdu(gpointer user_data)
        if (g_test_verbose())
                util_hexdump('<', pdu->data, len, test_debug, "AVDTP: ");
 
-       g_assert(len == (ssize_t) pdu->size);
+       g_assert_cmpint(len, ==, pdu->size);
 
        if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BI-02-C"))
                g_timeout_add_seconds(1, context_quit, context);
 
+       if (pdu->fragmented)
+               return send_pdu(user_data);
+
        return FALSE;
 }
 
@@ -136,7 +153,7 @@ static void context_process(struct context *context)
                return;
        }
 
-       g_idle_add(send_pdu, context);
+       context->process = g_idle_add(send_pdu, context);
 }
 
 static gboolean transport_open(struct avdtp_stream *stream)
@@ -173,7 +190,7 @@ static gboolean test_handler(GIOChannel *channel, GIOCondition cond,
        if (g_test_verbose())
                util_hexdump('>', buf, len, test_debug, "AVDTP: ");
 
-       g_assert((size_t) len == pdu->size);
+       g_assert_cmpint(len, ==, pdu->size);
 
        g_assert(memcmp(buf, pdu->data, pdu->size) == 0);
 
@@ -182,12 +199,23 @@ static gboolean test_handler(GIOChannel *channel, GIOCondition cond,
                g_assert(transport_open(context->stream));
        }
 
-       context_process(context);
+       if (context->pending_suspend) {
+               int ret;
+
+               context->pending_suspend = FALSE;
+               ret = avdtp_suspend(context->session, context->stream);
+               g_assert_cmpint(ret, ==, 0);
+       }
+
+       if (!pdu->fragmented)
+               context_process(context);
 
        return TRUE;
 }
 
-static struct context *create_context(uint16_t version, gconstpointer data)
+
+static struct context *context_new(uint16_t version, uint16_t imtu,
+                                       uint16_t omtu, gconstpointer data)
 {
        struct context *context = g_new0(struct context, 1);
        GIOChannel *channel;
@@ -199,7 +227,7 @@ static struct context *create_context(uint16_t version, gconstpointer data)
        err = socketpair(AF_UNIX, SOCK_SEQPACKET | SOCK_CLOEXEC, 0, sv);
        g_assert(err == 0);
 
-       context->session = avdtp_new(sv[0], 672, 672, version);
+       context->session = avdtp_new(sv[0], imtu, omtu, version);
        g_assert(context->session != NULL);
 
        channel = g_io_channel_unix_new(sv[1]);
@@ -221,6 +249,11 @@ static struct context *create_context(uint16_t version, gconstpointer data)
        return context;
 }
 
+static struct context *create_context(uint16_t version, gconstpointer data)
+{
+       return context_new(version, 672, 672, data);
+}
+
 static void execute_context(struct context *context)
 {
        g_main_loop_run(context->main_loop);
@@ -270,15 +303,92 @@ static gboolean sep_open_ind(struct avdtp *session, struct avdtp_local_sep *sep,
 {
        struct context *context = user_data;
 
+       if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BI-18-C")) {
+               *err = 0xc0;
+               return FALSE;
+       }
+
        context->pending_open = TRUE;
        context->stream = stream;
 
        return TRUE;
 }
 
+static gboolean sep_setconf_ind(struct avdtp *session,
+                                               struct avdtp_local_sep *sep,
+                                               struct avdtp_stream *stream,
+                                               GSList *caps,
+                                               avdtp_set_configuration_cb cb,
+                                               void *user_data)
+{
+       struct context *context = user_data;
+
+       if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BI-09-C"))
+               return FALSE;
+
+       cb(session, stream, NULL);
+
+       return TRUE;
+}
+
+static gboolean sep_start_ind(struct avdtp *session,
+                                               struct avdtp_local_sep *sep,
+                                               struct avdtp_stream *stream,
+                                               uint8_t *err,
+                                               void *user_data)
+{
+       struct context *context = user_data;
+
+       if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BI-21-C")) {
+               *err = 0xc0;
+               return FALSE;
+       }
+
+       if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BI-25-C"))
+               context->pending_suspend = TRUE;
+
+       return TRUE;
+}
+
+static gboolean sep_close_ind(struct avdtp *session,
+                                               struct avdtp_local_sep *sep,
+                                               struct avdtp_stream *stream,
+                                               uint8_t *err,
+                                               void *user_data)
+{
+       struct context *context = user_data;
+
+       if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BI-24-C")) {
+               *err = 0xc0;
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+static gboolean sep_suspend_ind(struct avdtp *session,
+                                               struct avdtp_local_sep *sep,
+                                               struct avdtp_stream *stream,
+                                               uint8_t *err,
+                                               void *user_data)
+{
+       struct context *context = user_data;
+
+       if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BI-27-C")) {
+               *err = 0xc0;
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
 static struct avdtp_sep_ind sep_ind = {
        .get_capability         = sep_getcap_ind,
+       .set_configuration      = sep_setconf_ind,
        .open                   = sep_open_ind,
+       .close                  = sep_close_ind,
+       .start                  = sep_start_ind,
+       .suspend                = sep_suspend_ind,
 };
 
 static void sep_setconf_cfm(struct avdtp *session, struct avdtp_local_sep *sep,
@@ -286,22 +396,21 @@ static void sep_setconf_cfm(struct avdtp *session, struct avdtp_local_sep *sep,
                                struct avdtp_error *err, void *user_data)
 {
        struct context *context = user_data;
-       const struct test_pdu *pdu;
        int ret;
 
-       g_assert(err == NULL);
-
-       if (!context)
+       if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BI-07-C")) {
+               g_assert(err != NULL);
+               g_assert_cmpint(avdtp_error_error_code(err), ==, 0x13);
+               context_quit(context);
                return;
+       }
 
-       pdu = &context->data->pdu_list[context->pdu_offset];
-
-       if (pdu->size < 2)
-               return;
+       g_assert(err == NULL);
 
-       if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BV-11-C"))
+       if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BV-11-C") ||
+               g_str_equal(context->data->test_name, "/TP/SIG/SMG/BI-10-C"))
                ret = avdtp_get_configuration(session, stream);
-       if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BV-23-C"))
+       else if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BV-23-C"))
                ret = avdtp_abort(session, stream);
        else
                ret = avdtp_open(session, stream);
@@ -309,6 +418,21 @@ static void sep_setconf_cfm(struct avdtp *session, struct avdtp_local_sep *sep,
        g_assert_cmpint(ret, ==, 0);
 }
 
+static void sep_getconf_cfm(struct avdtp *session, struct avdtp_local_sep *sep,
+                               struct avdtp_stream *stream,
+                               struct avdtp_error *err, void *user_data)
+{
+       struct context *context = user_data;
+
+       if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BI-10-C")) {
+               g_assert(err != NULL);
+               g_assert_cmpint(avdtp_error_error_code(err), ==, 0x12);
+       } else
+               g_assert(err == NULL);
+
+       context_quit(context);
+}
+
 static void sep_open_cfm(struct avdtp *session, struct avdtp_local_sep *sep,
                        struct avdtp_stream *stream, struct avdtp_error *err,
                        void *user_data)
@@ -330,6 +454,14 @@ static void sep_start_cfm(struct avdtp *session, struct avdtp_local_sep *sep,
        struct context *context = user_data;
        int ret;
 
+       if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BI-19-C") ||
+               g_str_equal(context->data->test_name, "/TP/SIG/SMG/BI-22-C")) {
+               g_assert(err != NULL);
+               g_assert_cmpint(avdtp_error_error_code(err), ==, 0x31);
+               context_quit(context);
+               return;
+       }
+
        g_assert(err == NULL);
 
        if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BV-19-C"))
@@ -340,10 +472,25 @@ static void sep_start_cfm(struct avdtp *session, struct avdtp_local_sep *sep,
        g_assert_cmpint(ret, ==, 0);
 }
 
+static void sep_suspend_cfm(struct avdtp *session, struct avdtp_local_sep *sep,
+                       struct avdtp_stream *stream, struct avdtp_error *err,
+                       void *user_data)
+{
+       struct context *context = user_data;
+
+       if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BI-25-C")) {
+               g_assert(err != NULL);
+               g_assert_cmpint(avdtp_error_error_code(err), ==, 0x31);
+               context_quit(context);
+       }
+}
+
 static struct avdtp_sep_cfm sep_cfm = {
        .set_configuration      = sep_setconf_cfm,
+       .get_configuration      = sep_getconf_cfm,
        .open                   = sep_open_cfm,
        .start                  = sep_start_cfm,
+       .suspend                = sep_suspend_cfm,
 };
 
 static void test_server(gconstpointer data)
@@ -352,7 +499,8 @@ static void test_server(gconstpointer data)
        struct avdtp_local_sep *sep;
 
        sep = avdtp_register_sep(AVDTP_SEP_TYPE_SOURCE, AVDTP_MEDIA_TYPE_AUDIO,
-                                       0x00, FALSE, &sep_ind, NULL, context);
+                                       0x00, FALSE, &sep_ind, &sep_cfm,
+                                       context);
 
        g_idle_add(send_pdu, context);
 
@@ -376,6 +524,21 @@ static void test_server_1_3(gconstpointer data)
        avdtp_unregister_sep(sep);
 }
 
+static void test_server_1_3_sink(gconstpointer data)
+{
+       struct context *context = create_context(0x0103, data);
+       struct avdtp_local_sep *sep;
+
+       sep = avdtp_register_sep(AVDTP_SEP_TYPE_SINK, AVDTP_MEDIA_TYPE_AUDIO,
+                                       0x00, TRUE, &sep_ind, NULL, context);
+
+       g_idle_add(send_pdu, context);
+
+       execute_context(context);
+
+       avdtp_unregister_sep(sep);
+}
+
 static void test_server_0_sep(gconstpointer data)
 {
        struct context *context = create_context(0x0100, data);
@@ -385,6 +548,62 @@ static void test_server_0_sep(gconstpointer data)
        execute_context(context);
 }
 
+static gboolean sep_getcap_ind_frg(struct avdtp *session,
+                                       struct avdtp_local_sep *sep,
+                                       gboolean get_all, GSList **caps,
+                                       uint8_t *err, void *user_data)
+{
+       struct avdtp_service_capability *media_transport, *media_codec;
+       struct avdtp_service_capability *content_protection;
+       struct avdtp_media_codec_capability *codec_caps;
+       uint8_t cap[4] = { 0xff, 0xff, 2, 64 };
+       uint8_t frg_cap[96] = {};
+
+       *caps = NULL;
+
+       media_transport = avdtp_service_cap_new(AVDTP_MEDIA_TRANSPORT,
+                                               NULL, 0);
+
+       *caps = g_slist_append(*caps, media_transport);
+
+       codec_caps = g_malloc0(sizeof(*codec_caps) + sizeof(cap));
+       codec_caps->media_type = AVDTP_MEDIA_TYPE_AUDIO;
+       codec_caps->media_codec_type = 0x00;
+       memcpy(codec_caps->data, cap, sizeof(cap));
+
+       media_codec = avdtp_service_cap_new(AVDTP_MEDIA_CODEC, codec_caps,
+                                       sizeof(*codec_caps) + sizeof(cap));
+
+       *caps = g_slist_append(*caps, media_codec);
+       g_free(codec_caps);
+
+       content_protection = avdtp_service_cap_new(AVDTP_CONTENT_PROTECTION,
+                                               frg_cap, sizeof(frg_cap));
+       *caps = g_slist_append(*caps, content_protection);
+
+       return TRUE;
+}
+
+static struct avdtp_sep_ind sep_ind_frg = {
+       .get_capability         = sep_getcap_ind_frg,
+};
+
+static void test_server_frg(gconstpointer data)
+{
+       struct context *context = context_new(0x0100, 48, 48, data);
+       struct avdtp_local_sep *sep;
+
+       sep = avdtp_register_sep(AVDTP_SEP_TYPE_SOURCE, AVDTP_MEDIA_TYPE_AUDIO,
+                                               0x00, TRUE, &sep_ind_frg,
+                                               NULL, context);
+
+       g_idle_add(send_pdu, context);
+
+       execute_context(context);
+
+       avdtp_unregister_sep(sep);
+}
+
 static void discover_cb(struct avdtp *session, GSList *seps,
                                struct avdtp_error *err, void *user_data)
 {
@@ -409,7 +628,8 @@ static void discover_cb(struct avdtp *session, GSList *seps,
                return;
        }
 
-       if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BI-04-C")) {
+       if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BI-04-C") ||
+               g_str_equal(context->data->test_name, "/TP/SIG/SMG/BI-32-C")) {
                g_assert(err != NULL);
                g_assert_cmpint(avdtp_error_error_code(err), ==, 0x11);
                context_quit(context);
@@ -419,6 +639,12 @@ static void discover_cb(struct avdtp *session, GSList *seps,
        g_assert(err == NULL);
        g_assert_cmpint(g_slist_length(seps), !=, 0);
 
+       if (g_str_equal(context->data->test_name, "/TP/SIG/FRA/BV-02-C")) {
+               g_assert(err == NULL);
+               context_quit(context);
+               return;
+       }
+
        rsep = avdtp_find_remote_sep(session, context->sep);
        g_assert(rsep != NULL);
 
@@ -479,6 +705,23 @@ static void test_client_1_3(gconstpointer data)
        avdtp_unregister_sep(sep);
 }
 
+static void test_client_frg(gconstpointer data)
+{
+       struct context *context = context_new(0x0100, 48, 48, data);
+       struct avdtp_local_sep *sep;
+
+       sep = avdtp_register_sep(AVDTP_SEP_TYPE_SINK, AVDTP_MEDIA_TYPE_AUDIO,
+                                       0x00, TRUE, NULL, &sep_cfm,
+                                       context);
+       context->sep = sep;
+
+       avdtp_discover(context->session, discover_cb, context);
+
+       execute_context(context);
+
+       avdtp_unregister_sep(sep);
+}
+
 int main(int argc, char *argv[])
 {
        g_test_init(&argc, &argv, NULL);
@@ -680,7 +923,7 @@ int main(int argc, char *argv[])
                        raw_pdu(0x02, 0x01, 0x04, 0x00),
                        raw_pdu(0x10, 0x0c, 0x04),
                        raw_pdu(0x12, 0x0c, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
-                               0xff, 0xff, 0x02, 0x40));
+                               0xff, 0xff, 0x02, 0x40, 0x08, 0x00));
        define_test("/TP/SIG/SMG/BV-27-C", test_server_1_3,
                        raw_pdu(0x00, 0x01),
                        raw_pdu(0x02, 0x01, 0x04, 0x00),
@@ -723,6 +966,337 @@ int main(int argc, char *argv[])
                        raw_pdu(0x02, 0x01, 0x04, 0x00),
                        raw_pdu(0x10, 0x02),
                        raw_pdu(0x13, 0x02, 0x11));
+       define_test("/TP/SIG/SMG/BI-06-C", test_server,
+                       raw_pdu(0x00, 0x01),
+                       raw_pdu(0x02, 0x01, 0x04, 0x00),
+                       raw_pdu(0x10, 0x02, 0x00),
+                       raw_pdu(0x13, 0x02, 0x12));
+       define_test("/TP/SIG/SMG/BI-07-C", test_client,
+                       raw_pdu(0xe0, 0x01),
+                       raw_pdu(0xe2, 0x01, 0x04, 0x00),
+                       raw_pdu(0xf0, 0x02, 0x04),
+                       raw_pdu(0xf2, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+                               0xff, 0xff, 0x02, 0x40),
+                       raw_pdu(0x00, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+                               0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
+                       raw_pdu(0x03, 0x03, 0x00, 0x13));
+       define_test("/TP/SIG/SMG/BI-08-C", test_server,
+                       raw_pdu(0x00, 0x01),
+                       raw_pdu(0x02, 0x01, 0x04, 0x00),
+                       raw_pdu(0x10, 0x02, 0x04),
+                       raw_pdu(0x12, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+                               0xff, 0xff, 0x02, 0x40),
+                       raw_pdu(0x20, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+                               0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
+                       raw_pdu(0x22, 0x03),
+                       raw_pdu(0x30, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+                               0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
+                       raw_pdu(0x33, 0x03, 0x00, 0x13));
+       define_test("/TP/SIG/SMG/BI-09-C", test_server,
+                       raw_pdu(0x00, 0x01),
+                       raw_pdu(0x02, 0x01, 0x04, 0x00),
+                       raw_pdu(0x10, 0x02, 0x04),
+                       raw_pdu(0x12, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+                               0xff, 0xff, 0x02, 0x40),
+                       raw_pdu(0x20, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+                               0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
+                       raw_pdu(0x23, 0x03, 0x00, 0x29));
+       define_test("/TP/SIG/SMG/BI-10-C", test_client,
+                       raw_pdu(0x10, 0x01),
+                       raw_pdu(0x12, 0x01, 0x04, 0x00),
+                       raw_pdu(0x20, 0x02, 0x04),
+                       raw_pdu(0x22, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+                               0xff, 0xff, 0x02, 0x40),
+                       raw_pdu(0x30, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+                               0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
+                       raw_pdu(0x32, 0x03),
+                       raw_pdu(0x40, 0x04, 0x04),
+                       raw_pdu(0x43, 0x04, 0x12));
+       define_test("/TP/SIG/SMG/BI-11-C", test_server,
+                       raw_pdu(0x00, 0x01),
+                       raw_pdu(0x02, 0x01, 0x04, 0x00),
+                       raw_pdu(0x10, 0x02, 0x04),
+                       raw_pdu(0x12, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+                               0xff, 0xff, 0x02, 0x40),
+                       raw_pdu(0x20, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+                               0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
+                       raw_pdu(0x22, 0x03),
+                       raw_pdu(0x30, 0x04, 0x00),
+                       raw_pdu(0x33, 0x04, 0x12));
+       define_test("/TP/SIG/SMG/BI-17-C", test_server,
+                       raw_pdu(0x00, 0x01),
+                       raw_pdu(0x02, 0x01, 0x04, 0x00),
+                       raw_pdu(0x10, 0x02, 0x04),
+                       raw_pdu(0x12, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+                               0xff, 0xff, 0x02, 0x40),
+                       raw_pdu(0x30, 0x06, 0x04),
+                       raw_pdu(0x33, 0x06, 0x31));
+       define_test("/TP/SIG/SMG/BI-18-C", test_server,
+                       raw_pdu(0x00, 0x01),
+                       raw_pdu(0x02, 0x01, 0x04, 0x00),
+                       raw_pdu(0x10, 0x02, 0x04),
+                       raw_pdu(0x12, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+                               0xff, 0xff, 0x02, 0x40),
+                       raw_pdu(0x20, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+                               0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
+                       raw_pdu(0x22, 0x03),
+                       raw_pdu(0x30, 0x06, 0x04),
+                       raw_pdu(0x33, 0x06, 0xc0));
+       define_test("/TP/SIG/SMG/BI-19-C", test_client,
+                       raw_pdu(0x50, 0x01),
+                       raw_pdu(0x52, 0x01, 0x04, 0x00),
+                       raw_pdu(0x60, 0x02, 0x04),
+                       raw_pdu(0x62, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+                               0xff, 0xff, 0x02, 0x40),
+                       raw_pdu(0x70, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+                               0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
+                       raw_pdu(0x72, 0x03),
+                       raw_pdu(0x80, 0x06, 0x04),
+                       raw_pdu(0x82, 0x06),
+                       raw_pdu(0x90, 0x07, 0x04),
+                       raw_pdu(0x93, 0x07, 0x04, 0x31));
+       define_test("/TP/SIG/SMG/BI-20-C", test_server,
+                       raw_pdu(0x00, 0x01),
+                       raw_pdu(0x02, 0x01, 0x04, 0x00),
+                       raw_pdu(0x10, 0x02, 0x04),
+                       raw_pdu(0x12, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+                               0xff, 0xff, 0x02, 0x40),
+                       raw_pdu(0x20, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+                               0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
+                       raw_pdu(0x22, 0x03),
+                       raw_pdu(0x30, 0x07, 0x04),
+                       raw_pdu(0x33, 0x07, 0x04, 0x31));
+       define_test("/TP/SIG/SMG/BI-21-C", test_server,
+                       raw_pdu(0x00, 0x01),
+                       raw_pdu(0x02, 0x01, 0x04, 0x00),
+                       raw_pdu(0x10, 0x02, 0x04),
+                       raw_pdu(0x12, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+                               0xff, 0xff, 0x02, 0x40),
+                       raw_pdu(0x20, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+                               0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
+                       raw_pdu(0x22, 0x03),
+                       raw_pdu(0x30, 0x06, 0x04),
+                       raw_pdu(0x32, 0x06),
+                       raw_pdu(0x40, 0x07, 0x04),
+                       raw_pdu(0x43, 0x07, 0x04, 0xc0));
+       define_test("/TP/SIG/SMG/BI-22-C", test_client,
+                       raw_pdu(0xa0, 0x01),
+                       raw_pdu(0xa2, 0x01, 0x04, 0x00),
+                       raw_pdu(0xb0, 0x02, 0x04),
+                       raw_pdu(0xb2, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+                               0xff, 0xff, 0x02, 0x40),
+                       raw_pdu(0xc0, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+                               0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
+                       raw_pdu(0xc2, 0x03),
+                       raw_pdu(0xd0, 0x06, 0x04),
+                       raw_pdu(0xd2, 0x06),
+                       raw_pdu(0xe0, 0x07, 0x04),
+                       raw_pdu(0xe3, 0x07, 0x04, 0x31));
+       define_test("/TP/SIG/SMG/BI-23-C", test_server,
+                       raw_pdu(0x00, 0x01),
+                       raw_pdu(0x02, 0x01, 0x04, 0x00),
+                       raw_pdu(0x10, 0x02, 0x04),
+                       raw_pdu(0x12, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+                               0xff, 0xff, 0x02, 0x40),
+                       raw_pdu(0x20, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+                               0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
+                       raw_pdu(0x22, 0x03),
+                       raw_pdu(0x30, 0x06, 0x04),
+                       raw_pdu(0x32, 0x06),
+                       raw_pdu(0x40, 0x08, 0x00),
+                       raw_pdu(0x43, 0x08, 0x12));
+       define_test("/TP/SIG/SMG/BI-24-C", test_server,
+                       raw_pdu(0x00, 0x01),
+                       raw_pdu(0x02, 0x01, 0x04, 0x00),
+                       raw_pdu(0x10, 0x02, 0x04),
+                       raw_pdu(0x12, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+                               0xff, 0xff, 0x02, 0x40),
+                       raw_pdu(0x20, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+                               0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
+                       raw_pdu(0x22, 0x03),
+                       raw_pdu(0x30, 0x06, 0x04),
+                       raw_pdu(0x32, 0x06),
+                       raw_pdu(0x40, 0x08, 0x04),
+                       raw_pdu(0x43, 0x08, 0xc0));
+       define_test("/TP/SIG/SMG/BI-25-C", test_server,
+                       raw_pdu(0x00, 0x01),
+                       raw_pdu(0x02, 0x01, 0x04, 0x00),
+                       raw_pdu(0x10, 0x02, 0x04),
+                       raw_pdu(0x12, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+                               0xff, 0xff, 0x02, 0x40),
+                       raw_pdu(0x20, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+                               0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
+                       raw_pdu(0x22, 0x03),
+                       raw_pdu(0x30, 0x06, 0x04),
+                       raw_pdu(0x32, 0x06),
+                       raw_pdu(0x40, 0x07, 0x04),
+                       raw_pdu(0x42, 0x07),
+                       raw_pdu(0xf0, 0x09, 0x04),
+                       raw_pdu(0xf3, 0x09, 0x04, 0x31));
+       define_test("/TP/SIG/SMG/BI-26-C", test_server,
+                       raw_pdu(0x00, 0x01),
+                       raw_pdu(0x02, 0x01, 0x04, 0x00),
+                       raw_pdu(0x10, 0x02, 0x04),
+                       raw_pdu(0x12, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+                               0xff, 0xff, 0x02, 0x40),
+                       raw_pdu(0x20, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+                               0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
+                       raw_pdu(0x22, 0x03),
+                       raw_pdu(0x30, 0x06, 0x04),
+                       raw_pdu(0x32, 0x06),
+                       raw_pdu(0x40, 0x09, 0x04),
+                       raw_pdu(0x43, 0x09, 0x04, 0x31));
+       define_test("/TP/SIG/SMG/BI-27-C", test_server,
+                       raw_pdu(0x00, 0x01),
+                       raw_pdu(0x02, 0x01, 0x04, 0x00),
+                       raw_pdu(0x10, 0x02, 0x04),
+                       raw_pdu(0x12, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+                               0xff, 0xff, 0x02, 0x40),
+                       raw_pdu(0x20, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+                               0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
+                       raw_pdu(0x22, 0x03),
+                       raw_pdu(0x30, 0x06, 0x04),
+                       raw_pdu(0x32, 0x06),
+                       raw_pdu(0x40, 0x07, 0x04),
+                       raw_pdu(0x42, 0x07),
+                       raw_pdu(0x50, 0x09, 0x04),
+                       raw_pdu(0x53, 0x09, 0x04, 0xc0));
+       define_test("/TP/SIG/SMG/BI-28-C", test_server,
+                       raw_pdu(0x00, 0xff),
+                       raw_pdu(0x01, 0x3f));
+       define_test("/TP/SIG/SMG/BI-30-C", test_client,
+                       raw_pdu(0x00, 0x01),
+                       raw_pdu(0x02, 0x01, 0x04, 0x00),
+                       raw_pdu(0x10, 0x02, 0x04),
+                       raw_pdu(0x12, 0x02, 0xee, 0x01, 0x00, 0x01, 0x00, 0x07,
+                               0x06, 0x00, 0x00, 0xff, 0xff, 0x02, 0x40),
+                       raw_pdu(0x20, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+                               0x00, 0x00, 0x21, 0x02, 0x02, 0x20));
+       define_test("/TP/SIG/SMG/ESR04/BI-28-C", test_server,
+                       raw_pdu(0x00, 0x3f),
+                       raw_pdu(0x01, 0x3f));
+       define_test("/TP/SIG/SMG/BI-32-C", test_client_1_3,
+                       raw_pdu(0x30, 0x01),
+                       raw_pdu(0x32, 0x01, 0x04, 0x00),
+                       raw_pdu(0x40, 0x0c, 0x04),
+                       raw_pdu(0x43, 0x0c, 0x11));
+       define_test("/TP/SIG/SMG/BI-33-C", test_server_1_3,
+                       raw_pdu(0x00, 0x01),
+                       raw_pdu(0x02, 0x01, 0x04, 0x00),
+                       raw_pdu(0x10, 0x0c),
+                       raw_pdu(0x13, 0x0c, 0x11));
+       define_test("/TP/SIG/SMG/BI-35-C", test_client_1_3,
+                       raw_pdu(0x50, 0x01),
+                       raw_pdu(0x52, 0x01, 0x04, 0x00),
+                       raw_pdu(0x60, 0x0c, 0x04),
+                       raw_pdu(0x62, 0x0c, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00,
+                               0x04, 0x00, 0x05, 0x00, 0x06, 0x00, 0x07, 0x06,
+                               0x00, 0x00, 0xff, 0xff, 0x02, 0x40, 0x08, 0x00),
+                       raw_pdu(0x70, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+                               0x00, 0x00, 0x21, 0x02, 0x02, 0x20, 0x08,
+                               0x00));
+       define_test("/TP/SIG/SMG/BI-36-C", test_client_1_3,
+                       raw_pdu(0x80, 0x01),
+                       raw_pdu(0x82, 0x01, 0x04, 0x00),
+                       raw_pdu(0x90, 0x0c, 0x04),
+                       raw_pdu(0x92, 0x0c, 0xee, 0x01, 0x00, 0x01, 0x00, 0x07,
+                               0x06, 0x00, 0x00, 0xff, 0xff, 0x02, 0x40),
+                       raw_pdu(0xa0, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+                               0x00, 0x00, 0x21, 0x02, 0x02, 0x20));
+
+       /*
+        * Signaling Message Fragmentation Service
+        *
+        * verify that the IUT (INT and ACP) fragments the signaling messages
+        * that cannot fit in a single L2CAP packet.
+        */
+       define_test("/TP/SIG/FRA/BV-01-C", test_server_frg,
+                       raw_pdu(0x00, 0x01),
+                       raw_pdu(0x02, 0x01, 0x04, 0x00),
+                       raw_pdu(0x10, 0x02, 0x04),
+                       frg_pdu(0x16, 0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00,
+                               0x00, 0xff, 0xff, 0x02, 0x40, 0x04, 0x60, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00),
+                       frg_pdu(0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00),
+                       raw_pdu(0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00));
+       define_test("/TP/SIG/FRA/BV-02-C", test_client_frg,
+                       raw_pdu(0xb0, 0x01),
+                       raw_pdu(0xb2, 0x01, 0x04, 0x00),
+                       raw_pdu(0xc0, 0x02, 0x04),
+                       frg_pdu(0xc6, 0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00,
+                               0x00, 0xff, 0xff, 0x02, 0x40, 0x04, 0x60, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00),
+                       frg_pdu(0xca, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00),
+                       raw_pdu(0xce, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00));
+
+       /*
+        * Delay Reporting
+        *
+        * Verify that the stream management signaling procedure of delay
+        * reporting is implemented according to its specification in AVDTP.
+        */
+       define_test("/TP/SIG/SYN/BV-01-C", test_server_1_3_sink,
+                       raw_pdu(0x00, 0x01),
+                       raw_pdu(0x02, 0x01, 0x04, 0x08),
+                       raw_pdu(0x10, 0x0c, 0x04),
+                       raw_pdu(0x12, 0x0c, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+                               0xff, 0xff, 0x02, 0x40, 0x08, 0x00));
+       define_test("/TP/SIG/SYN/BV-02-C", test_client_1_3,
+                       raw_pdu(0xd0, 0x01),
+                       raw_pdu(0xd2, 0x01, 0x04, 0x00),
+                       raw_pdu(0xe0, 0x0c, 0x04),
+                       raw_pdu(0xe2, 0x0c, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+                               0xff, 0xff, 0x02, 0x40, 0x0f, 0x00, 0x08, 0x00),
+                       raw_pdu(0xf0, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+                               0x00, 0x00, 0x21, 0x02, 0x02, 0x20, 0x08,
+                               0x00));
+       define_test("/TP/SIG/SYN/BV-03-C", test_server_1_3_sink,
+                       raw_pdu(0x00, 0x01),
+                       raw_pdu(0x02, 0x01, 0x04, 0x08),
+                       raw_pdu(0x10, 0x0c, 0x04),
+                       raw_pdu(0x12, 0x0c, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+                               0xff, 0xff, 0x02, 0x40, 0x08, 0x00),
+                       raw_pdu(0x20, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+                               0x00, 0x00, 0x21, 0x02, 0x02, 0x20, 0x08,
+                               0x00),
+                       raw_pdu(0x22, 0x03),
+                       raw_pdu(0x00, 0x0d, 0x04, 0x00, 0x00));
+       define_test("/TP/SIG/SYN/BV-04-C", test_client_1_3,
+                       raw_pdu(0x10, 0x01),
+                       raw_pdu(0x12, 0x01, 0x04, 0x00),
+                       raw_pdu(0x20, 0x0c, 0x04),
+                       raw_pdu(0x22, 0x0c, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
+                               0xff, 0xff, 0x02, 0x40, 0x0f, 0x00, 0x08, 0x00),
+                       raw_pdu(0x30, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
+                               0x00, 0x00, 0x21, 0x02, 0x02, 0x20, 0x08,
+                               0x00),
+                       raw_pdu(0x32, 0x03),
+                       raw_pdu(0x40, 0x0d, 0x04, 0x00, 0x00));
+
 
        return g_test_run();
 }