| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377 |
- // SPDX-License-Identifier: GPL-2.0-or-later
- /*
- *
- * BlueZ - Bluetooth protocol stack for Linux
- *
- * Copyright (C) 2012 Intel Corporation. All rights reserved.
- *
- *
- */
- #ifdef HAVE_CONFIG_H
- #include <config.h>
- #endif
- #include <unistd.h>
- #include <stdlib.h>
- #include <stdbool.h>
- #include <inttypes.h>
- #include <string.h>
- #include <fcntl.h>
- #include <sys/socket.h>
- #include <glib.h>
- #include "src/shared/util.h"
- #include "src/shared/queue.h"
- #include "src/shared/tester.h"
- #include "src/log.h"
- #include "android/avdtp.h"
- #define MAX_SEID 0x3E
- struct test_pdu {
- bool valid;
- bool fragmented;
- uint8_t *data;
- size_t size;
- };
- struct test_data {
- char *test_name;
- struct test_pdu *pdu_list;
- };
- #define data(args...) ((const unsigned char[]) { args })
- #define raw_pdu(args...) \
- { \
- .valid = true, \
- .data = g_memdup(data(args), sizeof(data(args))), \
- .size = sizeof(data(args)), \
- }
- #define frg_pdu(args...) \
- { \
- .valid = true, \
- .fragmented = true, \
- .data = g_memdup(data(args), sizeof(data(args))), \
- .size = sizeof(data(args)), \
- }
- #define define_test(name, function, args...) \
- do { \
- const struct test_pdu pdus[] = { \
- args, { } \
- }; \
- static struct test_data data; \
- data.test_name = g_strdup(name); \
- data.pdu_list = g_memdup(pdus, sizeof(pdus)); \
- tester_add(name, &data, NULL, function, NULL); \
- } while (0)
- struct context {
- struct avdtp *session;
- struct avdtp_local_sep *sep;
- struct avdtp_stream *stream;
- struct queue *lseps;
- guint source;
- guint process;
- int fd;
- int mtu;
- gboolean pending_open;
- gboolean pending_suspend;
- unsigned int pdu_offset;
- const struct test_data *data;
- };
- static void test_free(gconstpointer user_data)
- {
- const struct test_data *data = user_data;
- struct test_pdu *pdu;
- int i;
- for (i = 0; (pdu = &data->pdu_list[i]) && pdu->valid; i++)
- g_free(pdu->data);
- g_free(data->test_name);
- g_free(data->pdu_list);
- }
- static void unregister_sep(void *data)
- {
- struct avdtp_local_sep *sep = data;
- /* Removed from the queue by caller */
- avdtp_unregister_sep(NULL, sep);
- }
- static void destroy_context(struct context *context)
- {
- if (context->source > 0)
- g_source_remove(context->source);
- avdtp_unref(context->session);
- test_free(context->data);
- queue_destroy(context->lseps, unregister_sep);
- g_free(context);
- }
- static gboolean context_quit(gpointer user_data)
- {
- struct context *context = user_data;
- if (context->process > 0)
- g_source_remove(context->process);
- destroy_context(context);
- tester_test_passed();
- return FALSE;
- }
- static gboolean send_pdu(gpointer user_data)
- {
- struct context *context = user_data;
- const struct test_pdu *pdu;
- ssize_t len;
- pdu = &context->data->pdu_list[context->pdu_offset++];
- len = write(context->fd, pdu->data, pdu->size);
- tester_monitor('<', 0x0000, 0x0019, pdu->data, len);
- 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);
- context->process = 0;
- return FALSE;
- }
- static void context_process(struct context *context)
- {
- if (!context->data->pdu_list[context->pdu_offset].valid) {
- context_quit(context);
- return;
- }
- context->process = g_idle_add(send_pdu, context);
- }
- static gboolean transport_open(struct avdtp_stream *stream)
- {
- int fd;
- fd = open("/dev/null", O_RDWR, 0);
- if (fd < 0)
- g_assert_not_reached();
- return avdtp_stream_set_transport(stream, fd, 672, 672);
- }
- static gboolean test_handler(GIOChannel *channel, GIOCondition cond,
- gpointer user_data)
- {
- struct context *context = user_data;
- const struct test_pdu *pdu;
- unsigned char buf[512];
- ssize_t len;
- int fd;
- pdu = &context->data->pdu_list[context->pdu_offset++];
- if (cond & (G_IO_NVAL | G_IO_ERR | G_IO_HUP)) {
- context->source = 0;
- return FALSE;
- }
- fd = g_io_channel_unix_get_fd(channel);
- len = read(fd, buf, sizeof(buf));
- g_assert(len > 0);
- tester_monitor('>', 0x0000, 0x0019, buf, len);
- g_assert_cmpint(len, ==, pdu->size);
- g_assert(memcmp(buf, pdu->data, pdu->size) == 0);
- if (context->pending_open) {
- context->pending_open = FALSE;
- g_assert(transport_open(context->stream));
- }
- 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 *context_new(uint16_t version, uint16_t imtu,
- uint16_t omtu, gconstpointer data)
- {
- struct context *context = g_new0(struct context, 1);
- GIOChannel *channel;
- int err, sv[2];
- err = socketpair(AF_UNIX, SOCK_SEQPACKET | SOCK_CLOEXEC, 0, sv);
- g_assert(err == 0);
- context->lseps = queue_new();
- g_assert(context->lseps);
- context->session = avdtp_new(sv[0], imtu, omtu, version,
- context->lseps);
- g_assert(context->session != NULL);
- channel = g_io_channel_unix_new(sv[1]);
- g_io_channel_set_close_on_unref(channel, TRUE);
- g_io_channel_set_encoding(channel, NULL, NULL);
- g_io_channel_set_buffered(channel, FALSE);
- context->source = g_io_add_watch(channel,
- G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
- test_handler, context);
- g_assert(context->source > 0);
- g_io_channel_unref(channel);
- context->fd = sv[1];
- context->data = data;
- return context;
- }
- static struct context *create_context(uint16_t version, gconstpointer data)
- {
- return context_new(version, 672, 672, data);
- }
- static gboolean sep_getcap_ind(struct avdtp *session,
- struct avdtp_local_sep *sep,
- GSList **caps, uint8_t *err,
- void *user_data)
- {
- struct avdtp_service_capability *media_transport, *media_codec;
- struct avdtp_media_codec_capability *codec_caps;
- uint8_t cap[4] = { 0xff, 0xff, 2, 64 };
- *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);
- return TRUE;
- }
- static gboolean sep_open_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-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,
- struct avdtp_stream *stream,
- struct avdtp_error *err, void *user_data)
- {
- struct context *context = user_data;
- int ret;
- if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BV-09-C")) {
- context_quit(context);
- return;
- }
- 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;
- }
- g_assert(err == NULL);
- 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);
- 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);
- 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)
- {
- int ret;
- g_assert(err == NULL);
- g_assert(transport_open(stream));
- ret = avdtp_start(session, stream);
- g_assert_cmpint(ret, ==, 0);
- }
- static void sep_start_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;
- 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"))
- ret = avdtp_close(session, stream, FALSE);
- else
- ret = avdtp_suspend(session, stream);
- 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)
- {
- struct context *context = create_context(0x0100, data);
- struct avdtp_local_sep *sep;
- sep = avdtp_register_sep(context->lseps, AVDTP_SEP_TYPE_SOURCE,
- AVDTP_MEDIA_TYPE_AUDIO,
- 0x00, FALSE, &sep_ind, &sep_cfm,
- context);
- g_assert(sep);
- g_idle_add(send_pdu, context);
- }
- static void test_server_1_3(gconstpointer data)
- {
- struct context *context = create_context(0x0103, data);
- struct avdtp_local_sep *sep;
- sep = avdtp_register_sep(context->lseps, AVDTP_SEP_TYPE_SOURCE,
- AVDTP_MEDIA_TYPE_AUDIO,
- 0x00, TRUE, &sep_ind, NULL, context);
- g_assert(sep);
- g_idle_add(send_pdu, context);
- }
- 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(context->lseps, AVDTP_SEP_TYPE_SINK,
- AVDTP_MEDIA_TYPE_AUDIO,
- 0x00, TRUE, &sep_ind, NULL, context);
- g_assert(sep);
- g_idle_add(send_pdu, context);
- }
- static void test_server_0_sep(gconstpointer data)
- {
- struct context *context = create_context(0x0100, data);
- g_idle_add(send_pdu, context);
- }
- static void test_server_seid(gconstpointer data)
- {
- struct context *context = create_context(0x0103, data);
- struct avdtp_local_sep *sep;
- unsigned int i;
- for (i = 0; i < MAX_SEID; i++) {
- sep = avdtp_register_sep(context->lseps, AVDTP_SEP_TYPE_SINK,
- AVDTP_MEDIA_TYPE_AUDIO,
- 0x00, TRUE, &sep_ind, NULL,
- context);
- g_assert(sep);
- }
- /* Now add (MAX_SEID + 1) SEP -> it shall fail */
- sep = avdtp_register_sep(context->lseps, AVDTP_SEP_TYPE_SINK,
- AVDTP_MEDIA_TYPE_AUDIO,
- 0x00, TRUE, &sep_ind, NULL,
- context);
- g_assert(!sep);
- context_quit(context);
- }
- static void test_server_seid_duplicate(gconstpointer data)
- {
- struct context *context = create_context(0x0103, data);
- struct avdtp_local_sep *sep;
- int i;
- for (i = 0; i < 2; i++) {
- sep = avdtp_register_sep(context->lseps, AVDTP_SEP_TYPE_SINK,
- AVDTP_MEDIA_TYPE_AUDIO,
- 0x00, TRUE, &sep_ind, NULL,
- context);
- g_assert(sep);
- }
- /* Remove 1st element */
- sep = queue_peek_head(context->lseps);
- g_assert(sep);
- avdtp_unregister_sep(context->lseps, sep);
- /* Now register new element */
- sep = avdtp_register_sep(context->lseps, AVDTP_SEP_TYPE_SINK,
- AVDTP_MEDIA_TYPE_AUDIO,
- 0x00, TRUE, &sep_ind, NULL,
- context);
- g_assert(sep);
- /* Check SEID ids with DISCOVER */
- g_idle_add(send_pdu, context);
- }
- static gboolean sep_getcap_ind_frg(struct avdtp *session,
- struct avdtp_local_sep *sep,
- 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(context->lseps, AVDTP_SEP_TYPE_SOURCE,
- AVDTP_MEDIA_TYPE_AUDIO,
- 0x00, TRUE, &sep_ind_frg,
- NULL, context);
- g_assert(sep);
- g_idle_add(send_pdu, context);
- }
- static void discover_cb(struct avdtp *session, GSList *seps,
- struct avdtp_error *err, void *user_data)
- {
- struct context *context = user_data;
- struct avdtp_stream *stream;
- struct avdtp_remote_sep *rsep;
- struct avdtp_service_capability *media_transport, *media_codec;
- struct avdtp_media_codec_capability *cap;
- GSList *caps;
- uint8_t data[4] = { 0x21, 0x02, 2, 32 };
- int ret;
- if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BV-05-C") ||
- g_str_equal(context->data->test_name, "/TP/SIG/SMG/BV-07-C") ||
- g_str_equal(context->data->test_name, "/TP/SIG/SMG/BV-25-C"))
- return;
- if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BI-01-C")) {
- g_assert(err != NULL);
- g_assert_cmpint(avdtp_error_error_code(err), ==, 0x01);
- context_quit(context);
- return;
- }
- 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);
- return;
- }
- 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);
- media_transport = avdtp_service_cap_new(AVDTP_MEDIA_TRANSPORT,
- NULL, 0);
- caps = g_slist_append(NULL, media_transport);
- cap = g_malloc0(sizeof(*cap) + sizeof(data));
- cap->media_type = AVDTP_MEDIA_TYPE_AUDIO;
- cap->media_codec_type = 0x00;
- memcpy(cap->data, data, sizeof(data));
- media_codec = avdtp_service_cap_new(AVDTP_MEDIA_CODEC, cap,
- sizeof(*cap) + sizeof(data));
- caps = g_slist_append(caps, media_codec);
- g_free(cap);
- ret = avdtp_set_configuration(session, rsep, context->sep, caps,
- &stream);
- g_assert_cmpint(ret, ==, 0);
- g_slist_free_full(caps, g_free);
- }
- static void test_client(gconstpointer data)
- {
- struct context *context = create_context(0x0100, data);
- struct avdtp_local_sep *sep;
- sep = avdtp_register_sep(context->lseps, AVDTP_SEP_TYPE_SINK,
- AVDTP_MEDIA_TYPE_AUDIO,
- 0x00, FALSE, NULL, &sep_cfm, context);
- context->sep = sep;
- avdtp_discover(context->session, discover_cb, context);
- }
- static void test_client_1_3(gconstpointer data)
- {
- struct context *context = create_context(0x0103, data);
- struct avdtp_local_sep *sep;
- sep = avdtp_register_sep(context->lseps, AVDTP_SEP_TYPE_SINK,
- AVDTP_MEDIA_TYPE_AUDIO,
- 0x00, TRUE, NULL, &sep_cfm, context);
- context->sep = sep;
- avdtp_discover(context->session, discover_cb, context);
- }
- 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(context->lseps, AVDTP_SEP_TYPE_SINK,
- AVDTP_MEDIA_TYPE_AUDIO,
- 0x00, TRUE, NULL, &sep_cfm, context);
- context->sep = sep;
- avdtp_discover(context->session, discover_cb, context);
- }
- int main(int argc, char *argv[])
- {
- tester_init(&argc, &argv);
- __btd_log_init("*", 0);
- /*
- * Stream Management Service
- *
- * To verify that the following procedures are implemented according to
- * their specification in AVDTP.
- */
- define_test("/TP/SIG/SMG/BV-06-C-SEID-1", test_server_seid,
- raw_pdu(0x00));
- define_test("/TP/SIG/SMG/BV-06-C-SEID-2", test_server_seid_duplicate,
- raw_pdu(0x00, 0x01),
- raw_pdu(0x02, 0x01, 0x08, 0x08, 0x04, 0x08));
- define_test("/TP/SIG/SMG/BV-05-C", test_client,
- raw_pdu(0x00, 0x01));
- define_test("/TP/SIG/SMG/BV-06-C", test_server,
- raw_pdu(0x00, 0x01),
- raw_pdu(0x02, 0x01, 0x04, 0x00));
- define_test("/TP/SIG/SMG/BV-07-C", test_client,
- raw_pdu(0x10, 0x01),
- raw_pdu(0x12, 0x01, 0x04, 0x00),
- raw_pdu(0x20, 0x02, 0x04));
- define_test("/TP/SIG/SMG/BV-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));
- define_test("/TP/SIG/SMG/BV-09-C", test_client,
- raw_pdu(0x30, 0x01),
- raw_pdu(0x32, 0x01, 0x04, 0x00),
- raw_pdu(0x40, 0x02, 0x04),
- raw_pdu(0x42, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
- 0xff, 0xff, 0x02, 0x40),
- raw_pdu(0x50, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
- 0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
- raw_pdu(0x52, 0x03));
- define_test("/TP/SIG/SMG/BV-10-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));
- define_test("/TP/SIG/SMG/BV-11-C", test_client,
- raw_pdu(0x60, 0x01),
- raw_pdu(0x62, 0x01, 0x04, 0x00),
- raw_pdu(0x70, 0x02, 0x04),
- raw_pdu(0x72, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
- 0xff, 0xff, 0x02, 0x40),
- raw_pdu(0x80, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
- 0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
- raw_pdu(0x82, 0x03),
- raw_pdu(0x90, 0x04, 0x04));
- define_test("/TP/SIG/SMG/BV-12-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, 0x04),
- raw_pdu(0x32, 0x04, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
- 0x21, 0x02, 0x02, 0x20));
- define_test("/TP/SIG/SMG/BV-15-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));
- define_test("/TP/SIG/SMG/BV-16-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));
- define_test("/TP/SIG/SMG/BV-17-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(0x02, 0x03),
- raw_pdu(0x10, 0x06, 0x04),
- raw_pdu(0x12, 0x06),
- raw_pdu(0x20, 0x07, 0x04));
- define_test("/TP/SIG/SMG/BV-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(0x32, 0x06),
- raw_pdu(0x40, 0x07, 0x04),
- raw_pdu(0x42, 0x07));
- define_test("/TP/SIG/SMG/BV-19-C", test_client,
- raw_pdu(0x30, 0x01),
- raw_pdu(0x32, 0x01, 0x04, 0x00),
- raw_pdu(0x40, 0x02, 0x04),
- raw_pdu(0x42, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
- 0xff, 0xff, 0x02, 0x40),
- raw_pdu(0x50, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
- 0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
- raw_pdu(0x52, 0x03),
- raw_pdu(0x60, 0x06, 0x04),
- raw_pdu(0x62, 0x06),
- raw_pdu(0x70, 0x07, 0x04),
- raw_pdu(0x72, 0x07),
- raw_pdu(0x80, 0x08, 0x04));
- define_test("/TP/SIG/SMG/BV-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, 0x06, 0x04),
- raw_pdu(0x32, 0x06),
- raw_pdu(0x40, 0x07, 0x04),
- raw_pdu(0x42, 0x07),
- raw_pdu(0x50, 0x08, 0x04),
- raw_pdu(0x52, 0x08));
- define_test("/TP/SIG/SMG/BV-21-C", test_client,
- raw_pdu(0x90, 0x01),
- raw_pdu(0x92, 0x01, 0x04, 0x00),
- raw_pdu(0xa0, 0x02, 0x04),
- raw_pdu(0xa2, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
- 0xff, 0xff, 0x02, 0x40),
- raw_pdu(0xb0, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
- 0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
- raw_pdu(0xb2, 0x03),
- raw_pdu(0xc0, 0x06, 0x04),
- raw_pdu(0xc2, 0x06),
- raw_pdu(0xd0, 0x07, 0x04),
- raw_pdu(0xd2, 0x07),
- raw_pdu(0xe0, 0x09, 0x04));
- define_test("/TP/SIG/SMG/BV-22-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(0x52, 0x09));
- define_test("/TP/SIG/SMG/BV-23-C", test_client,
- raw_pdu(0xf0, 0x01),
- raw_pdu(0xf2, 0x01, 0x04, 0x00),
- raw_pdu(0x00, 0x02, 0x04),
- raw_pdu(0x02, 0x02, 0x01, 0x00, 0x07, 0x06, 0x00, 0x00,
- 0xff, 0xff, 0x02, 0x40),
- raw_pdu(0x10, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
- 0x00, 0x00, 0x21, 0x02, 0x02, 0x20),
- raw_pdu(0x12, 0x03),
- raw_pdu(0x20, 0x0a, 0x04));
- define_test("/TP/SIG/SMG/BV-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, 0x0a, 0x04),
- raw_pdu(0x32, 0x0a));
- define_test("/TP/SIG/SMG/BV-25-C", test_client_1_3,
- raw_pdu(0x30, 0x01),
- raw_pdu(0x32, 0x01, 0x04, 0x00),
- raw_pdu(0x40, 0x0c, 0x04));
- define_test("/TP/SIG/SMG/BV-26-C", test_server_1_3,
- raw_pdu(0x00, 0x01),
- 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, 0x08, 0x00));
- define_test("/TP/SIG/SMG/BV-27-C", test_server_1_3,
- 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));
- define_test("/TP/SIG/SMG/BV-28-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, 0x07, 0x06, 0x00, 0x00,
- 0xff, 0xff, 0x02, 0x40, 0x0f, 0x00),
- raw_pdu(0x70, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
- 0x00, 0x00, 0x21, 0x02, 0x02, 0x20));
- define_test("/TP/SIG/SMG/BV-31-C", test_client_1_3,
- raw_pdu(0x80, 0x01),
- raw_pdu(0x82, 0x01, 0x04, 0x00),
- raw_pdu(0x90, 0x0c, 0x04),
- raw_pdu(0x92, 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(0xa0, 0x03, 0x04, 0x04, 0x01, 0x00, 0x07, 0x06,
- 0x00, 0x00, 0x21, 0x02, 0x02, 0x20, 0x08,
- 0x00));
- define_test("/TP/SIG/SMG/BI-01-C", test_client,
- raw_pdu(0xb0, 0x01),
- raw_pdu(0xb3, 0x01, 0x01));
- define_test("/TP/SIG/SMG/BI-02-C", test_server,
- raw_pdu(0x01, 0x01));
- define_test("/TP/SIG/SMG/BI-03-C", test_server_0_sep,
- raw_pdu(0x00, 0x01),
- raw_pdu(0x03, 0x01, 0x19));
- define_test("/TP/SIG/SMG/BI-04-C", test_client,
- raw_pdu(0xc0, 0x01),
- raw_pdu(0xc2, 0x01, 0x04, 0x00),
- raw_pdu(0xd0, 0x02, 0x04),
- raw_pdu(0xd3, 0x02, 0x11));
- define_test("/TP/SIG/SMG/BI-05-C", test_server,
- raw_pdu(0x00, 0x01),
- 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));
- define_test("/TP/SIG/SYN/BV-05-C", test_server_1_3,
- raw_pdu(0x00, 0x01),
- 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, 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(0x30, 0x06, 0x04),
- raw_pdu(0x32, 0x06),
- raw_pdu(0x40, 0x0d, 0x04, 0x00, 0x00),
- raw_pdu(0x42, 0x0d));
- define_test("/TP/SIG/SYN/BV-06-C", test_server_1_3,
- raw_pdu(0x00, 0x01),
- 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, 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(0x30, 0x06, 0x04),
- raw_pdu(0x32, 0x06),
- raw_pdu(0x40, 0x07, 0x04),
- raw_pdu(0x42, 0x07),
- raw_pdu(0x50, 0x0d, 0x04, 0x00, 0x00),
- raw_pdu(0x52, 0x0d));
- return tester_run();
- }
|