test-gatt.c 136 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. *
  4. * BlueZ - Bluetooth protocol stack for Linux
  5. *
  6. * Copyright (C) 2014 Intel Corporation. All rights reserved.
  7. *
  8. *
  9. */
  10. #ifdef HAVE_CONFIG_H
  11. #include <config.h>
  12. #endif
  13. #include <unistd.h>
  14. #include <stdlib.h>
  15. #include <stdbool.h>
  16. #include <inttypes.h>
  17. #include <string.h>
  18. #include <fcntl.h>
  19. #include <sys/socket.h>
  20. #include <glib.h>
  21. #include "lib/bluetooth.h"
  22. #include "lib/uuid.h"
  23. #include "src/shared/util.h"
  24. #include "src/shared/att.h"
  25. #include "src/shared/gatt-helpers.h"
  26. #include "src/shared/queue.h"
  27. #include "src/shared/gatt-db.h"
  28. #include "src/shared/gatt-server.h"
  29. #include "src/shared/gatt-client.h"
  30. #include "src/shared/tester.h"
  31. struct test_pdu {
  32. bool valid;
  33. uint8_t *data;
  34. size_t size;
  35. };
  36. enum context_type {
  37. ATT,
  38. CLIENT,
  39. SERVER
  40. };
  41. struct test_data {
  42. char *test_name;
  43. struct test_pdu *pdu_list;
  44. enum context_type context_type;
  45. bt_uuid_t *uuid;
  46. struct gatt_db *source_db;
  47. const void *step;
  48. };
  49. struct context {
  50. struct bt_gatt_client *client;
  51. struct bt_gatt_server *server;
  52. struct bt_att *att;
  53. struct gatt_db *client_db;
  54. struct gatt_db *server_db;
  55. guint source;
  56. guint process;
  57. int fd;
  58. unsigned int pdu_offset;
  59. const struct test_data *data;
  60. struct bt_gatt_request *req;
  61. };
  62. #define data(args...) ((const unsigned char[]) { args })
  63. #define raw_pdu(args...) \
  64. { \
  65. .valid = true, \
  66. .data = g_memdup(data(args), sizeof(data(args))), \
  67. .size = sizeof(data(args)), \
  68. }
  69. #define false_pdu() \
  70. { \
  71. .valid = false, \
  72. }
  73. #define define_test(name, function, type, bt_uuid, db, \
  74. test_step, args...) \
  75. do { \
  76. const struct test_pdu pdus[] = { \
  77. args, { } \
  78. }; \
  79. static struct test_data data; \
  80. data.test_name = g_strdup(name); \
  81. data.context_type = type; \
  82. data.uuid = bt_uuid; \
  83. data.step = test_step; \
  84. data.source_db = db; \
  85. data.pdu_list = g_memdup(pdus, sizeof(pdus)); \
  86. tester_add(name, &data, NULL, function, NULL); \
  87. } while (0)
  88. #define define_test_att(name, function, bt_uuid, test_step, args...) \
  89. define_test(name, function, ATT, bt_uuid, NULL, test_step, args)
  90. #define define_test_client(name, function, source_db, test_step, args...)\
  91. define_test(name, function, CLIENT, NULL, source_db, test_step, args)
  92. #define define_test_server(name, function, source_db, test_step, args...)\
  93. define_test(name, function, SERVER, NULL, source_db, test_step, args)
  94. #define MTU_EXCHANGE_CLIENT_PDUS \
  95. raw_pdu(0x02, 0x00, 0x02), \
  96. raw_pdu(0x03, 0x00, 0x02)
  97. #define READ_SERVER_FEAT_PDUS \
  98. raw_pdu(0x08, 0x01, 0x00, 0xff, 0xff, 0x3a, 0x2b), \
  99. raw_pdu(0x01, 0x08, 0x01, 0x00, 0x0a)
  100. #define CLIENT_INIT_PDUS \
  101. MTU_EXCHANGE_CLIENT_PDUS, \
  102. READ_SERVER_FEAT_PDUS
  103. #define SERVICE_DATA_1_PDUS \
  104. CLIENT_INIT_PDUS, \
  105. raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28), \
  106. raw_pdu(0x11, 0x06, 0x01, 0x00, 0x04, 0x00, 0x01, 0x18),\
  107. raw_pdu(0x10, 0x05, 0x00, 0xff, 0xff, 0x00, 0x28), \
  108. raw_pdu(0x11, 0x06, 0x05, 0x00, 0x08, 0x00, 0x0d, 0x18),\
  109. raw_pdu(0x10, 0x09, 0x00, 0xff, 0xff, 0x00, 0x28), \
  110. raw_pdu(0x01, 0x10, 0x09, 0x00, 0x0a), \
  111. raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x01, 0x28), \
  112. raw_pdu(0x01, 0x10, 0x01, 0x00, 0x0a), \
  113. raw_pdu(0x08, 0x01, 0x00, 0x08, 0x00, 0x02, 0x28), \
  114. raw_pdu(0x01, 0x08, 0x01, 0x00, 0x0a), \
  115. raw_pdu(0x08, 0x01, 0x00, 0x08, 0x00, 0x03, 0x28), \
  116. raw_pdu(0x09, 0x07, 0x02, 0x00, 0x02, 0x03, 0x00, 0x00, \
  117. 0x2a), \
  118. raw_pdu(0x08, 0x03, 0x00, 0x08, 0x00, 0x03, 0x28), \
  119. raw_pdu(0x09, 0x07, 0x06, 0x00, 0x0a, 0x07, 0x00, 0x29, \
  120. 0x2a), \
  121. raw_pdu(0x08, 0x07, 0x00, 0x08, 0x00, 0x03, 0x28), \
  122. raw_pdu(0x01, 0x08, 0x07, 0x00, 0x0a), \
  123. raw_pdu(0x04, 0x04, 0x00, 0x04, 0x00), \
  124. raw_pdu(0x05, 0x01, 0x04, 0x00, 0x01, 0x29), \
  125. raw_pdu(0x04, 0x08, 0x00, 0x08, 0x00), \
  126. raw_pdu(0x05, 0x01, 0x08, 0x00, 0x01, 0x29)
  127. #define SERVICE_DATA_2_PDUS \
  128. CLIENT_INIT_PDUS, \
  129. raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28), \
  130. raw_pdu(0x11, 0x06, 0x01, 0x00, 0x04, 0x00, 0x01, 0x18),\
  131. raw_pdu(0x10, 0x05, 0x00, 0xff, 0xff, 0x00, 0x28), \
  132. raw_pdu(0x11, 0x06, 0x05, 0x00, 0x0a, 0x00, 0x0d, 0x18),\
  133. raw_pdu(0x10, 0x0b, 0x00, 0xff, 0xff, 0x00, 0x28), \
  134. raw_pdu(0x01, 0x10, 0x0b, 0x00, 0x0a), \
  135. raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x01, 0x28), \
  136. raw_pdu(0x01, 0x10, 0x01, 0x00, 0x0a), \
  137. raw_pdu(0x08, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x28), \
  138. raw_pdu(0x01, 0x08, 0x01, 0x00, 0x0a), \
  139. raw_pdu(0x08, 0x01, 0x00, 0x0a, 0x00, 0x03, 0x28), \
  140. raw_pdu(0x09, 0x07, 0x02, 0x00, 0x02, 0x03, 0x00, 0x00, \
  141. 0x2a), \
  142. raw_pdu(0x08, 0x03, 0x00, 0x0a, 0x00, 0x03, 0x28), \
  143. raw_pdu(0x09, 0x07, 0x07, 0x00, 0x0a, 0x08, 0x00, 0x29, \
  144. 0x2a), \
  145. raw_pdu(0x08, 0x08, 0x00, 0x0a, 0x00, 0x03, 0x28), \
  146. raw_pdu(0x01, 0x08, 0x08, 0x00, 0x0a), \
  147. raw_pdu(0x04, 0x04, 0x00, 0x04, 0x00), \
  148. raw_pdu(0x05, 0x01, 0x04, 0x00, 0x01, 0x29), \
  149. raw_pdu(0x04, 0x09, 0x00, 0x0a, 0x00), \
  150. raw_pdu(0x05, 0x01, 0x0a, 0x00, 0x01, 0x29)
  151. #define SERVICE_DATA_3_PDUS \
  152. CLIENT_INIT_PDUS, \
  153. raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28), \
  154. raw_pdu(0x11, 0x06, 0x00, 0x01, 0x21, 0x01, 0x00, 0x18, \
  155. 0x00, 0x02, 0x00, 0x02, 0x01, 0x18), \
  156. raw_pdu(0x10, 0x01, 0x02, 0xff, 0xff, 0x00, 0x28), \
  157. raw_pdu(0x11, 0x06, 0x00, 0x03, 0x20, 0x03, 0x0d, 0x18),\
  158. raw_pdu(0x10, 0x21, 0x03, 0xff, 0xff, 0x00, 0x28), \
  159. raw_pdu(0x01, 0x10, 0x21, 0x03, 0x0a), \
  160. raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x01, 0x28), \
  161. raw_pdu(0x01, 0x10, 0x01, 0x00, 0x0a), \
  162. raw_pdu(0x08, 0x00, 0x01, 0x20, 0x03, 0x02, 0x28), \
  163. raw_pdu(0x01, 0x08, 0x00, 0x01, 0x0a), \
  164. raw_pdu(0x08, 0x00, 0x01, 0x20, 0x03, 0x03, 0x28), \
  165. raw_pdu(0x09, 0x07, 0x10, 0x01, 0x02, 0x11, 0x01, 0x00, \
  166. 0x2a, 0x20, 0x01, 0x02, 0x21, 0x01, 0x01, 0x2a),\
  167. raw_pdu(0x08, 0x21, 0x01, 0x20, 0x03, 0x03, 0x28), \
  168. raw_pdu(0x09, 0x07, 0x10, 0x03, 0x0a, 0x11, 0x03, 0x29, \
  169. 0x2a), \
  170. raw_pdu(0x08, 0x11, 0x03, 0x20, 0x03, 0x03, 0x28), \
  171. raw_pdu(0x01, 0x08, 0x11, 0x03, 0x0a), \
  172. raw_pdu(0x04, 0x12, 0x01, 0x1f, 0x01), \
  173. raw_pdu(0x01, 0x04, 0x12, 0x01, 0x0a), \
  174. raw_pdu(0x04, 0x12, 0x03, 0x20, 0x03), \
  175. raw_pdu(0x05, 0x01, 0x20, 0x03, 0x02, 0x29)
  176. #define PRIMARY_DISC_SMALL_DB \
  177. raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28), \
  178. raw_pdu(0x11, 0x06, 0x10, 0xF0, 0x18, 0xF0, 0x00, 0x18, \
  179. 0xFF, 0xFF, 0xFF, 0xFF, 0x0a, 0x18)
  180. #define PRIMARY_DISC_LARGE_DB_1 \
  181. raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28), \
  182. raw_pdu(0x11, 0x06, 0x10, 0x00, 0x13, 0x00, 0x01, 0x18, \
  183. 0x20, 0x00, 0x29, 0x00, 0x0A, 0xA0, \
  184. 0x30, 0x00, 0x32, 0x00, 0x0B, 0xA0), \
  185. raw_pdu(0x10, 0x33, 0x00, 0xff, 0xff, 0x00, 0x28), \
  186. raw_pdu(0x11, 0x06, 0x40, 0x00, 0x46, 0x00, 0x00, 0x18, \
  187. 0x50, 0x00, 0x52, 0x00, 0x0B, 0xA0, \
  188. 0x60, 0x00, 0x6B, 0x00, 0x0B, 0xA0), \
  189. raw_pdu(0x10, 0x6C, 0x00, 0xff, 0xff, 0x00, 0x28), \
  190. raw_pdu(0x11, 0x06, 0x70, 0x00, 0x76, 0x00, 0x0B, 0xA0, \
  191. 0x80, 0x00, 0x86, 0x00, 0x0B, 0xA0), \
  192. raw_pdu(0x10, 0x86, 0x00, 0xff, 0xff, 0x00, 0x28), \
  193. raw_pdu(0x11, 0x14, 0x90, 0x00, 0x96, 0x00, \
  194. 0xef, 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01, \
  195. 0x00, 0x00, 0x00, 0x00, 0x0C, 0xA0, 0x00, 0x00),\
  196. raw_pdu(0x10, 0x97, 0x00, 0xff, 0xff, 0x00, 0x28), \
  197. raw_pdu(0x11, 0x06, 0xa0, 0x00, 0xb1, 0x00, 0x0f, 0xa0),\
  198. raw_pdu(0x10, 0xb2, 0x00, 0xff, 0xff, 0x00, 0x28), \
  199. raw_pdu(0x11, 0x14, 0xC0, 0x00, 0xDD, 0x00, \
  200. 0xef, 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01, \
  201. 0x00, 0x00, 0x00, 0x00, 0x0C, 0xA0, 0x00, 0x00),\
  202. raw_pdu(0x10, 0xde, 0x00, 0xff, 0xff, 0x00, 0x28), \
  203. raw_pdu(0x01, 0x10, 0xde, 0x00, 0x0a)
  204. #define SECONDARY_DISC_SMALL_DB \
  205. raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x01, 0x28), \
  206. raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x0a, 0x18),\
  207. raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x01, 0x28), \
  208. raw_pdu(0x01, 0x10, 0x11, 0x00, 0x0a)
  209. #define INCLUDE_DISC_SMALL_DB \
  210. raw_pdu(0x08, 0x01, 0x00, 0xff, 0xff, 0x02, 0x28), \
  211. raw_pdu(0x09, 0x08, 0x11, 0xf0, 0x01, 0x00, 0x0f, 0x00, \
  212. 0x0a, 0x18), \
  213. raw_pdu(0x08, 0x12, 0xf0, 0xff, 0xff, 0x02, 0x28), \
  214. raw_pdu(0x01, 0x08, 0x12, 0xf0, 0x0a)
  215. #define CHARACTERISTIC_DISC_SMALL_DB \
  216. raw_pdu(0x08, 0x01, 0x00, 0xff, 0xff, 0x03, 0x28), \
  217. raw_pdu(0x09, 0x07, 0x02, 0x00, 0xb2, 0x03, 0x00, 0x29, \
  218. 0x2a, 0x07, 0x00, 0x22, 0x08, 0x00, 0x28, 0x2a),\
  219. raw_pdu(0x08, 0x08, 0x00, 0xff, 0xff, 0x03, 0x28), \
  220. raw_pdu(0x09, 0x07, 0x12, 0xf0, 0x02, 0x13, 0xf0, 0x00, \
  221. 0x2a), \
  222. raw_pdu(0x08, 0x13, 0xf0, 0xff, 0xff, 0x03, 0x28), \
  223. raw_pdu(0x09, 0x15, 0x14, 0xf0, 0x82, 0x15, 0xf0, 0xef, \
  224. 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01, 0x00, \
  225. 0x00, 0x00, 0x00, 0x09, 0xB0, 0x00, 0x00), \
  226. raw_pdu(0x08, 0x15, 0xf0, 0xff, 0xff, 0x03, 0x28), \
  227. raw_pdu(0x09, 0x07, 0x17, 0xf0, 0x02, 0x18, 0xf0, 0x01, \
  228. 0x2a), \
  229. raw_pdu(0x08, 0x18, 0xf0, 0xff, 0xff, 0x03, 0x28), \
  230. raw_pdu(0x01, 0x08, 0x18, 0xf0, 0x0a)
  231. #define DESCRIPTOR_DISC_SMALL_DB \
  232. raw_pdu(0x04, 0x04, 0x00, 0x06, 0x00), \
  233. raw_pdu(0x05, 0x01, 0x04, 0x00, 0x02, 0x29, 0x05, 0x00, \
  234. 0x01, 0x29), \
  235. raw_pdu(0x04, 0x06, 0x00, 0x06, 0x00), \
  236. raw_pdu(0x05, 0x01, 0x06, 0x00, 0x00, 0x29), \
  237. raw_pdu(0x0a, 0x06, 0x00), \
  238. raw_pdu(0x0b, 0x01, 0x00), \
  239. raw_pdu(0x04, 0x09, 0x00, 0x10, 0x00), \
  240. raw_pdu(0x05, 0x01, 0x09, 0x00, 0x02, 0x29), \
  241. raw_pdu(0x04, 0x0a, 0x00, 0x10, 0x00), \
  242. raw_pdu(0x01, 0x04, 0x0a, 0x00, 0x0a), \
  243. raw_pdu(0x04, 0x16, 0xf0, 0x16, 0xf0), \
  244. raw_pdu(0x05, 0x01, 0x16, 0xf0, 0x00, 0x29), \
  245. raw_pdu(0x0a, 0x16, 0xf0), \
  246. raw_pdu(0x0b, 0x01, 0x00)
  247. #define SMALL_DB_DISCOVERY_PDUS \
  248. PRIMARY_DISC_SMALL_DB, \
  249. SECONDARY_DISC_SMALL_DB, \
  250. INCLUDE_DISC_SMALL_DB, \
  251. CHARACTERISTIC_DISC_SMALL_DB, \
  252. DESCRIPTOR_DISC_SMALL_DB
  253. #define SERVER_MTU_EXCHANGE_PDU raw_pdu(0x02, 0x17, 0x00)
  254. static bt_uuid_t uuid_16 = {
  255. .type = BT_UUID16,
  256. .value.u16 = 0x1800
  257. };
  258. static bt_uuid_t uuid_char_16 = {
  259. .type = BT_UUID16,
  260. .value.u16 = 0x2a0d
  261. };
  262. static bt_uuid_t uuid_128 = {
  263. .type = BT_UUID128,
  264. .value.u128.data = {0x00, 0x00, 0x18, 0x0d, 0x00, 0x00, 0x10, 0x00,
  265. 0x80, 0x00, 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb}
  266. };
  267. static bt_uuid_t uuid_char_128 = {
  268. .type = BT_UUID128,
  269. .value.u128.data = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
  270. 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}
  271. };
  272. static void test_free(gconstpointer user_data)
  273. {
  274. const struct test_data *data = user_data;
  275. struct test_pdu *pdu;
  276. int i;
  277. for (i = 0; (pdu = &data->pdu_list[i]) && pdu->valid; i++)
  278. g_free(pdu->data);
  279. g_free(data->test_name);
  280. g_free(data->pdu_list);
  281. }
  282. typedef void (*test_step_t)(struct context *context);
  283. struct test_step {
  284. test_step_t func;
  285. test_step_t post_func;
  286. uint16_t handle;
  287. uint16_t end_handle;
  288. uint8_t uuid[16];
  289. uint8_t expected_att_ecode;
  290. const uint8_t *value;
  291. uint16_t length;
  292. };
  293. static void destroy_context(struct context *context)
  294. {
  295. if (context->source > 0)
  296. g_source_remove(context->source);
  297. if (context->req)
  298. bt_gatt_request_unref(context->req);
  299. bt_gatt_client_unref(context->client);
  300. bt_gatt_server_unref(context->server);
  301. gatt_db_unref(context->client_db);
  302. gatt_db_unref(context->server_db);
  303. if (context->att)
  304. bt_att_unref(context->att);
  305. test_free(context->data);
  306. g_free(context);
  307. }
  308. static gboolean context_quit(gpointer user_data)
  309. {
  310. struct context *context = user_data;
  311. const struct test_step *step = context->data->step;
  312. if (context->process > 0)
  313. g_source_remove(context->process);
  314. if (step && step->post_func)
  315. step->post_func(context);
  316. if (context->data->pdu_list[context->pdu_offset].valid)
  317. tester_test_abort();
  318. else
  319. tester_test_passed();
  320. destroy_context(context);
  321. return FALSE;
  322. }
  323. static void test_debug(const char *str, void *user_data)
  324. {
  325. const char *prefix = user_data;
  326. tester_debug("%s%s", prefix, str);
  327. }
  328. static gboolean send_pdu(gpointer user_data)
  329. {
  330. struct context *context = user_data;
  331. const struct test_pdu *pdu;
  332. ssize_t len;
  333. pdu = &context->data->pdu_list[context->pdu_offset++];
  334. len = write(context->fd, pdu->data, pdu->size);
  335. tester_monitor('<', 0x0004, 0x0000, pdu->data, len);
  336. g_assert_cmpint(len, ==, pdu->size);
  337. context->process = 0;
  338. pdu = &context->data->pdu_list[context->pdu_offset];
  339. if (pdu->valid && (pdu->size == 0)) {
  340. test_debug("(no action expected)", "GATT: ");
  341. context->pdu_offset++;
  342. /* Quit the context if we processed the last PDU */
  343. if (!context->data->pdu_list[context->pdu_offset].valid) {
  344. context_quit(context);
  345. return FALSE;
  346. }
  347. return send_pdu(context);
  348. }
  349. return FALSE;
  350. }
  351. static void context_process(struct context *context)
  352. {
  353. /* Quit the context if we processed the last PDU */
  354. if (!context->data->pdu_list[context->pdu_offset].valid) {
  355. context_quit(context);
  356. return;
  357. }
  358. context->process = g_idle_add(send_pdu, context);
  359. }
  360. static gboolean test_handler(GIOChannel *channel, GIOCondition cond,
  361. gpointer user_data)
  362. {
  363. struct context *context = user_data;
  364. const struct test_step *step = context->data->step;
  365. const struct test_pdu *pdu;
  366. unsigned char buf[512];
  367. ssize_t len;
  368. int fd;
  369. pdu = &context->data->pdu_list[context->pdu_offset++];
  370. if (cond & (G_IO_NVAL | G_IO_ERR | G_IO_HUP)) {
  371. context->source = 0;
  372. g_print("%s: cond %x\n", __func__, cond);
  373. return FALSE;
  374. }
  375. fd = g_io_channel_unix_get_fd(channel);
  376. len = read(fd, buf, sizeof(buf));
  377. g_assert(len > 0);
  378. tester_monitor('>', 0x0004, 0x0000, buf, len);
  379. util_hexdump('=', pdu->data, pdu->size, test_debug, "PDU: ");
  380. g_assert_cmpint(len, ==, pdu->size);
  381. g_assert(memcmp(buf, pdu->data, pdu->size) == 0);
  382. /* Empty client PDU means to trigger something out-of-band. */
  383. pdu = &context->data->pdu_list[context->pdu_offset];
  384. if (pdu->valid && (pdu->size == 0)) {
  385. context->pdu_offset++;
  386. test_debug("triggering server action", "Empty client pdu: ");
  387. g_assert(step && step->func);
  388. step->func(context);
  389. return TRUE;
  390. }
  391. context_process(context);
  392. return TRUE;
  393. }
  394. static void print_debug(const char *str, void *user_data)
  395. {
  396. const char *prefix = user_data;
  397. tester_debug("%s%s", prefix, str);
  398. }
  399. struct db_attribute_test_data {
  400. struct gatt_db_attribute *match;
  401. bool found;
  402. };
  403. static bool matching_desc_data(struct gatt_db_attribute *a,
  404. struct gatt_db_attribute *b)
  405. {
  406. uint16_t a_handle, b_handle;
  407. const bt_uuid_t *a_uuid, *b_uuid;
  408. a_handle = gatt_db_attribute_get_handle(a);
  409. b_handle = gatt_db_attribute_get_handle(b);
  410. a_uuid = gatt_db_attribute_get_type(a);
  411. b_uuid = gatt_db_attribute_get_type(b);
  412. return a_handle == b_handle && !bt_uuid_cmp(a_uuid, b_uuid);
  413. }
  414. static void find_matching_desc(struct gatt_db_attribute *source_desc_attr,
  415. void *user_data)
  416. {
  417. struct db_attribute_test_data *desc_test_data = user_data;
  418. if (desc_test_data->found)
  419. return;
  420. desc_test_data->found = matching_desc_data(desc_test_data->match,
  421. source_desc_attr);
  422. }
  423. static void match_descs(struct gatt_db_attribute *client_desc_attr,
  424. void *user_data)
  425. {
  426. struct gatt_db_attribute *source_char_attr = user_data;
  427. struct db_attribute_test_data desc_test_data;
  428. desc_test_data.match = client_desc_attr;
  429. desc_test_data.found = false;
  430. gatt_db_service_foreach_desc(source_char_attr, find_matching_desc,
  431. &desc_test_data);
  432. g_assert(desc_test_data.found);
  433. }
  434. static bool matching_char_data(struct gatt_db_attribute *a,
  435. struct gatt_db_attribute *b)
  436. {
  437. uint16_t a_handle, b_handle, a_value_handle, b_value_handle;
  438. uint8_t a_properties, b_properties;
  439. bt_uuid_t a_uuid, b_uuid;
  440. gatt_db_attribute_get_char_data(a, &a_handle, &a_value_handle,
  441. &a_properties, NULL, &a_uuid);
  442. gatt_db_attribute_get_char_data(b, &b_handle, &b_value_handle,
  443. &b_properties, NULL, &b_uuid);
  444. return a_handle == b_handle && a_value_handle == b_value_handle &&
  445. a_properties == b_properties &&
  446. !bt_uuid_cmp(&a_uuid, &b_uuid);
  447. }
  448. static void find_matching_char(struct gatt_db_attribute *source_char_attr,
  449. void *user_data)
  450. {
  451. struct db_attribute_test_data *char_test_data = user_data;
  452. if (char_test_data->found)
  453. return;
  454. if (matching_char_data(char_test_data->match, source_char_attr)) {
  455. gatt_db_service_foreach_desc(char_test_data->match, match_descs,
  456. source_char_attr);
  457. char_test_data->found = true;
  458. }
  459. }
  460. static void match_chars(struct gatt_db_attribute *client_char_attr,
  461. void *user_data)
  462. {
  463. struct gatt_db_attribute *source_serv_attr = user_data;
  464. struct db_attribute_test_data char_test_data;
  465. char_test_data.match = client_char_attr;
  466. char_test_data.found = false;
  467. gatt_db_service_foreach_char(source_serv_attr, find_matching_char,
  468. &char_test_data);
  469. g_assert(char_test_data.found);
  470. }
  471. static bool matching_service_data(struct gatt_db_attribute *a,
  472. struct gatt_db_attribute *b)
  473. {
  474. uint16_t a_start, b_start, a_end, b_end;
  475. bool a_primary, b_primary;
  476. bt_uuid_t a_uuid, b_uuid;
  477. gatt_db_attribute_get_service_data(a, &a_start, &a_end, &a_primary,
  478. &a_uuid);
  479. gatt_db_attribute_get_service_data(b, &b_start, &b_end, &b_primary,
  480. &b_uuid);
  481. return a_start == b_start && a_end == b_end && a_primary == b_primary &&
  482. !bt_uuid_cmp(&a_uuid, &b_uuid);
  483. }
  484. static void find_matching_service(struct gatt_db_attribute *source_serv_attr,
  485. void *user_data)
  486. {
  487. struct db_attribute_test_data *serv_test_data = user_data;
  488. if (serv_test_data->found)
  489. return;
  490. if (matching_service_data(serv_test_data->match, source_serv_attr)) {
  491. gatt_db_service_foreach_char(serv_test_data->match, match_chars,
  492. source_serv_attr);
  493. serv_test_data->found = true;
  494. }
  495. }
  496. static void match_services(struct gatt_db_attribute *client_serv_attr,
  497. void *user_data)
  498. {
  499. struct gatt_db *source_db = user_data;
  500. struct db_attribute_test_data serv_test_data;
  501. serv_test_data.match = client_serv_attr;
  502. serv_test_data.found = false;
  503. gatt_db_foreach_service(source_db, NULL,
  504. find_matching_service, &serv_test_data);
  505. g_assert(serv_test_data.found);
  506. }
  507. static void client_ready_cb(bool success, uint8_t att_ecode, void *user_data)
  508. {
  509. struct context *context = user_data;
  510. g_assert(success);
  511. if (!context->data->source_db) {
  512. context_quit(context);
  513. return;
  514. }
  515. g_assert(context->client);
  516. g_assert(context->client_db);
  517. gatt_db_foreach_service(context->client_db, NULL, match_services,
  518. context->data->source_db);
  519. if (context->data->step) {
  520. const struct test_step *step = context->data->step;
  521. /* Auto elevate security for test that don't expect error */
  522. if (!step->expected_att_ecode)
  523. bt_att_set_security(context->att, BT_ATT_SECURITY_AUTO);
  524. step->func(context);
  525. return;
  526. }
  527. context_quit(context);
  528. }
  529. static struct context *create_context(uint16_t mtu, gconstpointer data)
  530. {
  531. struct context *context = g_new0(struct context, 1);
  532. const struct test_data *test_data = data;
  533. GIOChannel *channel;
  534. int err, sv[2];
  535. err = socketpair(AF_UNIX, SOCK_SEQPACKET | SOCK_CLOEXEC, 0, sv);
  536. g_assert(err == 0);
  537. context->att = bt_att_new(sv[0], false);
  538. g_assert(context->att);
  539. switch (test_data->context_type) {
  540. case ATT:
  541. bt_att_set_debug(context->att, 1, print_debug, "bt_att:", NULL);
  542. bt_gatt_exchange_mtu(context->att, mtu, NULL, NULL, NULL);
  543. break;
  544. case SERVER:
  545. context->server_db = gatt_db_ref(test_data->source_db);
  546. g_assert(context->server_db);
  547. context->server = bt_gatt_server_new(context->server_db,
  548. context->att, mtu, 0);
  549. g_assert(context->server);
  550. bt_gatt_server_set_debug(context->server, print_debug,
  551. "bt_gatt_server:", NULL);
  552. break;
  553. case CLIENT:
  554. context->client_db = gatt_db_new();
  555. g_assert(context->client_db);
  556. context->client = bt_gatt_client_new(context->client_db,
  557. context->att, mtu, 0);
  558. g_assert(context->client);
  559. bt_gatt_client_set_debug(context->client, print_debug,
  560. "bt_gatt_client:", NULL);
  561. bt_gatt_client_ready_register(context->client, client_ready_cb,
  562. context, NULL);
  563. break;
  564. default:
  565. break;
  566. }
  567. channel = g_io_channel_unix_new(sv[1]);
  568. g_io_channel_set_close_on_unref(channel, TRUE);
  569. g_io_channel_set_encoding(channel, NULL, NULL);
  570. g_io_channel_set_buffered(channel, FALSE);
  571. context->source = g_io_add_watch(channel,
  572. G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
  573. test_handler, context);
  574. g_assert(context->source > 0);
  575. g_io_channel_unref(channel);
  576. context->fd = sv[1];
  577. context->data = data;
  578. return context;
  579. }
  580. static void generic_search_cb(bool success, uint8_t att_ecode,
  581. struct bt_gatt_result *result,
  582. void *user_data)
  583. {
  584. struct context *context = user_data;
  585. bt_gatt_request_unref(context->req);
  586. context->req = NULL;
  587. g_assert(success);
  588. context_quit(context);
  589. }
  590. static void test_read_cb(bool success, uint8_t att_ecode,
  591. const uint8_t *value, uint16_t length,
  592. void *user_data)
  593. {
  594. struct context *context = user_data;
  595. const struct test_step *step = context->data->step;
  596. g_assert(att_ecode == step->expected_att_ecode);
  597. if (success) {
  598. g_assert(length == step->length);
  599. g_assert(memcmp(value, step->value, length) == 0);
  600. }
  601. context_quit(context);
  602. }
  603. static void test_read(struct context *context)
  604. {
  605. const struct test_step *step = context->data->step;
  606. g_assert(bt_gatt_client_read_value(context->client, step->handle,
  607. test_read_cb, context, NULL));
  608. }
  609. static const uint8_t read_data_1[] = {0x01, 0x02, 0x03};
  610. static const struct test_step test_read_1 = {
  611. .handle = 0x0003,
  612. .func = test_read,
  613. .expected_att_ecode = 0,
  614. .value = read_data_1,
  615. .length = 0x03
  616. };
  617. static const struct test_step test_read_2 = {
  618. .handle = 0x0000,
  619. .func = test_read,
  620. .expected_att_ecode = 0x01,
  621. };
  622. static const struct test_step test_read_3 = {
  623. .handle = 0x0003,
  624. .func = test_read,
  625. .expected_att_ecode = 0x02,
  626. };
  627. static const struct test_step test_read_4 = {
  628. .handle = 0x0003,
  629. .func = test_read,
  630. .expected_att_ecode = 0x08,
  631. };
  632. static const struct test_step test_read_5 = {
  633. .handle = 0x0003,
  634. .func = test_read,
  635. .expected_att_ecode = 0x05,
  636. };
  637. static const struct test_step test_read_6 = {
  638. .handle = 0x0003,
  639. .func = test_read,
  640. .expected_att_ecode = 0x0c,
  641. };
  642. static const struct test_step test_read_7 = {
  643. .handle = 0x0004,
  644. .func = test_read,
  645. .expected_att_ecode = 0x00,
  646. .value = read_data_1,
  647. .length = 0x03
  648. };
  649. static const struct test_step test_read_8 = {
  650. .handle = 0x0004,
  651. .func = test_read,
  652. .expected_att_ecode = 0x02,
  653. };
  654. static const struct test_step test_read_9 = {
  655. .handle = 0x0004,
  656. .func = test_read,
  657. .expected_att_ecode = 0x08,
  658. };
  659. static const struct test_step test_read_10 = {
  660. .handle = 0x0004,
  661. .func = test_read,
  662. .expected_att_ecode = 0x05,
  663. };
  664. static const struct test_step test_read_11 = {
  665. .handle = 0x0004,
  666. .func = test_read,
  667. .expected_att_ecode = 0x0c,
  668. };
  669. static const struct test_step test_read_12 = {
  670. .handle = 0x0003,
  671. .func = test_read,
  672. .expected_att_ecode = 0x80,
  673. };
  674. static void test_write_cb(bool success, uint8_t att_ecode, void *user_data)
  675. {
  676. struct context *context = user_data;
  677. const struct test_step *step = context->data->step;
  678. g_assert(att_ecode == step->expected_att_ecode);
  679. context_quit(context);
  680. }
  681. static void test_write(struct context *context)
  682. {
  683. const struct test_step *step = context->data->step;
  684. g_assert(bt_gatt_client_write_value(context->client, step->handle,
  685. step->value, step->length, test_write_cb,
  686. context, NULL));
  687. }
  688. static const uint8_t write_data_1[] = {0x01, 0x02, 0x03};
  689. static const struct test_step test_write_1 = {
  690. .handle = 0x0007,
  691. .func = test_write,
  692. .expected_att_ecode = 0,
  693. .value = write_data_1,
  694. .length = 0x03
  695. };
  696. static const struct test_step test_write_2 = {
  697. .handle = 0x0000,
  698. .func = test_write,
  699. .expected_att_ecode = 0x01,
  700. .value = write_data_1,
  701. .length = 0x03
  702. };
  703. static const struct test_step test_write_3 = {
  704. .handle = 0x0007,
  705. .func = test_write,
  706. .expected_att_ecode = 0x03,
  707. .value = write_data_1,
  708. .length = 0x03
  709. };
  710. static const struct test_step test_write_4 = {
  711. .handle = 0x0007,
  712. .func = test_write,
  713. .expected_att_ecode = 0x08,
  714. .value = write_data_1,
  715. .length = 0x03
  716. };
  717. static const struct test_step test_write_5 = {
  718. .handle = 0x0007,
  719. .func = test_write,
  720. .expected_att_ecode = 0x05,
  721. .value = write_data_1,
  722. .length = 0x03
  723. };
  724. static const struct test_step test_write_6 = {
  725. .handle = 0x0007,
  726. .func = test_write,
  727. .expected_att_ecode = 0x0c,
  728. .value = write_data_1,
  729. .length = 0x03
  730. };
  731. static const struct test_step test_write_7 = {
  732. .handle = 0x0008,
  733. .func = test_write,
  734. .expected_att_ecode = 0,
  735. .value = write_data_1,
  736. .length = 0x03
  737. };
  738. static const struct test_step test_write_8 = {
  739. .handle = 0x0000,
  740. .func = test_write,
  741. .expected_att_ecode = 0x01,
  742. .value = write_data_1,
  743. .length = 0x03
  744. };
  745. static const struct test_step test_write_9 = {
  746. .handle = 0x0008,
  747. .func = test_write,
  748. .expected_att_ecode = 0x03,
  749. .value = write_data_1,
  750. .length = 0x03
  751. };
  752. static const struct test_step test_write_10 = {
  753. .handle = 0x0008,
  754. .func = test_write,
  755. .expected_att_ecode = 0x08,
  756. .value = write_data_1,
  757. .length = 0x03
  758. };
  759. static const struct test_step test_write_11 = {
  760. .handle = 0x0008,
  761. .func = test_write,
  762. .expected_att_ecode = 0x05,
  763. .value = write_data_1,
  764. .length = 0x03
  765. };
  766. static const struct test_step test_write_12 = {
  767. .handle = 0x0008,
  768. .func = test_write,
  769. .expected_att_ecode = 0x0c,
  770. .value = write_data_1,
  771. .length = 0x03
  772. };
  773. static void test_write_without_response(struct context *context)
  774. {
  775. const struct test_step *step = context->data->step;
  776. g_assert(bt_gatt_client_write_without_response(context->client,
  777. step->handle,
  778. false, step->value,
  779. step->length));
  780. }
  781. static const struct test_step test_write_without_response_1 = {
  782. .handle = 0x0007,
  783. .func = test_write_without_response,
  784. .expected_att_ecode = 0,
  785. .value = write_data_1,
  786. .length = 0x03
  787. };
  788. static bool local_counter(uint32_t *sign_cnt, void *user_data)
  789. {
  790. static uint32_t cnt = 0;
  791. *sign_cnt = cnt++;
  792. return true;
  793. }
  794. static void test_signed_write(struct context *context)
  795. {
  796. const struct test_step *step = context->data->step;
  797. uint8_t key[16] = {0xD8, 0x51, 0x59, 0x48, 0x45, 0x1F, 0xEA, 0x32, 0x0D,
  798. 0xC0, 0x5A, 0x2E, 0x88, 0x30, 0x81, 0x88 };
  799. if (!bt_att_has_crypto(context->att)) {
  800. context_quit(context);
  801. return;
  802. }
  803. g_assert(bt_att_set_local_key(context->att, key, local_counter,
  804. context));
  805. g_assert(bt_gatt_client_write_without_response(context->client,
  806. step->handle,
  807. true, step->value,
  808. step->length));
  809. }
  810. static const struct test_step test_signed_write_1 = {
  811. .handle = 0x0007,
  812. .func = test_signed_write,
  813. .expected_att_ecode = 0,
  814. .value = write_data_1,
  815. .length = 0x03
  816. };
  817. static void test_signed_write_seclevel(struct context *context)
  818. {
  819. const struct test_step *step = context->data->step;
  820. uint8_t key[16] = {0xD8, 0x51, 0x59, 0x48, 0x45, 0x1F, 0xEA, 0x32, 0x0D,
  821. 0xC0, 0x5A, 0x2E, 0x88, 0x30, 0x81, 0x88 };
  822. g_assert(bt_att_set_local_key(context->att, key, local_counter,
  823. context));
  824. g_assert(bt_att_set_security(context->att, BT_ATT_SECURITY_MEDIUM));
  825. g_assert(bt_gatt_client_write_without_response(context->client,
  826. step->handle,
  827. true, step->value,
  828. step->length));
  829. }
  830. static const struct test_step test_signed_write_seclevel_1 = {
  831. .handle = 0x0007,
  832. .func = test_signed_write_seclevel,
  833. .expected_att_ecode = 0,
  834. .value = write_data_1,
  835. .length = 0x03
  836. };
  837. static void test_long_write_cb(bool success, bool reliable_error,
  838. uint8_t att_ecode, void *user_data)
  839. {
  840. struct context *context = user_data;
  841. const struct test_step *step = context->data->step;
  842. g_assert(att_ecode == step->expected_att_ecode);
  843. context_quit(context);
  844. }
  845. static void test_long_write(struct context *context)
  846. {
  847. const struct test_step *step = context->data->step;
  848. g_assert(bt_gatt_client_write_long_value(context->client, false,
  849. step->handle, 0, step->value,
  850. step->length, test_long_write_cb,
  851. context, NULL));
  852. }
  853. /* The maximum length of an attribute value shall be 512 octets. */
  854. static const uint8_t long_data_2[512] = { [0 ... 511] = 0xff };
  855. static const struct test_step test_long_write_1 = {
  856. .handle = 0x0007,
  857. .func = test_long_write,
  858. .expected_att_ecode = 0,
  859. .value = long_data_2,
  860. .length = sizeof(long_data_2)
  861. };
  862. static const struct test_step test_long_write_2 = {
  863. .handle = 0x0000,
  864. .func = test_long_write,
  865. .expected_att_ecode = 0x01,
  866. .value = write_data_1,
  867. .length = 0x03
  868. };
  869. static const struct test_step test_long_write_3 = {
  870. .handle = 0x0003,
  871. .func = test_long_write,
  872. .expected_att_ecode = 0x03,
  873. .value = write_data_1,
  874. .length = 0x03
  875. };
  876. static const struct test_step test_long_write_4 = {
  877. .handle = 0x0007,
  878. .func = test_long_write,
  879. .expected_att_ecode = 0x08,
  880. .value = write_data_1,
  881. .length = 0x03
  882. };
  883. static const struct test_step test_long_write_5 = {
  884. .handle = 0x0007,
  885. .func = test_long_write,
  886. .expected_att_ecode = 0x05,
  887. .value = write_data_1,
  888. .length = 0x03
  889. };
  890. static const struct test_step test_long_write_6 = {
  891. .handle = 0x0007,
  892. .func = test_long_write,
  893. .expected_att_ecode = 0x0c,
  894. .value = write_data_1,
  895. .length = 0x03
  896. };
  897. static const struct test_step test_long_write_7 = {
  898. .handle = 0x0008,
  899. .func = test_long_write,
  900. .expected_att_ecode = 0,
  901. .value = long_data_2,
  902. .length = sizeof(long_data_2)
  903. };
  904. static const struct test_step test_long_write_8 = {
  905. .handle = 0x0000,
  906. .func = test_long_write,
  907. .expected_att_ecode = 0x01,
  908. .value = write_data_1,
  909. .length = 0x03
  910. };
  911. static const struct test_step test_long_write_9 = {
  912. .handle = 0x0008,
  913. .func = test_long_write,
  914. .expected_att_ecode = 0x03,
  915. .value = write_data_1,
  916. .length = 0x03
  917. };
  918. static const struct test_step test_long_write_10 = {
  919. .handle = 0x0008,
  920. .func = test_long_write,
  921. .expected_att_ecode = 0x08,
  922. .value = write_data_1,
  923. .length = 0x03
  924. };
  925. static const struct test_step test_long_write_11 = {
  926. .handle = 0x0008,
  927. .func = test_long_write,
  928. .expected_att_ecode = 0x05,
  929. .value = write_data_1,
  930. .length = 0x03
  931. };
  932. static const struct test_step test_long_write_12 = {
  933. .handle = 0x0008,
  934. .func = test_long_write,
  935. .expected_att_ecode = 0x0c,
  936. .value = write_data_1,
  937. .length = 0x03
  938. };
  939. static void test_reliable_write_cb(bool success, bool reliable_error,
  940. uint8_t att_ecode, void *user_data)
  941. {
  942. struct context *context = user_data;
  943. const struct test_step *step = context->data->step;
  944. g_assert(att_ecode == step->expected_att_ecode);
  945. g_assert(!reliable_error);
  946. context_quit(context);
  947. }
  948. static void test_reliable_write(struct context *context)
  949. {
  950. const struct test_step *step = context->data->step;
  951. g_assert(bt_gatt_client_write_long_value(context->client, true,
  952. step->handle, 0, step->value,
  953. step->length, test_reliable_write_cb,
  954. context, NULL));
  955. }
  956. static const struct test_step test_reliable_write_1 = {
  957. .handle = 0x0007,
  958. .func = test_reliable_write,
  959. .expected_att_ecode = 0,
  960. .value = write_data_1,
  961. .length = 0x03
  962. };
  963. static const struct test_step test_reliable_write_2 = {
  964. .handle = 0x0000,
  965. .func = test_reliable_write,
  966. .expected_att_ecode = 0x01,
  967. .value = write_data_1,
  968. .length = 0x03
  969. };
  970. static const struct test_step test_reliable_write_3 = {
  971. .handle = 0x0003,
  972. .func = test_reliable_write,
  973. .expected_att_ecode = 0x03,
  974. .value = write_data_1,
  975. .length = 0x03
  976. };
  977. static const struct test_step test_reliable_write_4 = {
  978. .handle = 0x0007,
  979. .func = test_reliable_write,
  980. .expected_att_ecode = 0x08,
  981. .value = write_data_1,
  982. .length = 0x03
  983. };
  984. static const struct test_step test_reliable_write_5 = {
  985. .handle = 0x0007,
  986. .func = test_reliable_write,
  987. .expected_att_ecode = 0x05,
  988. .value = write_data_1,
  989. .length = 0x03
  990. };
  991. static const struct test_step test_reliable_write_6 = {
  992. .handle = 0x0007,
  993. .func = test_reliable_write,
  994. .expected_att_ecode = 0x0c,
  995. .value = write_data_1,
  996. .length = 0x03
  997. };
  998. static void att_write_cb(struct gatt_db_attribute *att, int err,
  999. void *user_data)
  1000. {
  1001. g_assert(!err);
  1002. }
  1003. static struct gatt_db_attribute *
  1004. add_char_with_value(struct gatt_db_attribute *service_att, uint16_t handle,
  1005. bt_uuid_t *uuid, uint32_t att_permissions,
  1006. uint8_t char_properties, const void *value,
  1007. size_t len)
  1008. {
  1009. struct gatt_db_attribute *attrib;
  1010. if (handle)
  1011. attrib = gatt_db_service_insert_characteristic(service_att,
  1012. handle, uuid,
  1013. att_permissions,
  1014. char_properties,
  1015. NULL, NULL,
  1016. NULL);
  1017. else
  1018. attrib = gatt_db_service_add_characteristic(service_att, uuid,
  1019. att_permissions,
  1020. char_properties,
  1021. NULL, NULL,
  1022. NULL);
  1023. g_assert(attrib != NULL);
  1024. gatt_db_attribute_write(attrib, 0, value, len, 0x00, NULL,
  1025. att_write_cb, NULL);
  1026. return attrib;
  1027. }
  1028. static struct gatt_db_attribute *
  1029. add_desc_with_value(struct gatt_db_attribute *att, uint16_t handle,
  1030. bt_uuid_t *uuid, uint32_t att_perms,
  1031. const uint8_t *value, size_t len)
  1032. {
  1033. struct gatt_db_attribute *desc_att;
  1034. if (handle)
  1035. desc_att = gatt_db_service_insert_descriptor(att, handle, uuid,
  1036. att_perms, NULL, NULL,
  1037. NULL);
  1038. else
  1039. desc_att = gatt_db_service_add_descriptor(att, uuid, att_perms,
  1040. NULL, NULL, NULL);
  1041. gatt_db_attribute_write(desc_att, 0, value, len, 0x00, NULL,
  1042. att_write_cb, NULL);
  1043. return desc_att;
  1044. }
  1045. enum gatt_type {
  1046. PRIMARY,
  1047. SECONDARY,
  1048. INCLUDE,
  1049. CHARACTERISTIC,
  1050. DESCRIPTOR
  1051. };
  1052. struct att_handle_spec {
  1053. uint16_t handle;
  1054. const char *uuid;
  1055. enum gatt_type type;
  1056. uint8_t char_properties;
  1057. uint32_t att_permissions;
  1058. const uint8_t *value;
  1059. size_t len;
  1060. bool valid;
  1061. };
  1062. #define PRIMARY_SERVICE(start_handle, srv_uuid, num_handles) \
  1063. { \
  1064. .valid = true, \
  1065. .handle = start_handle, \
  1066. .type = PRIMARY, \
  1067. .uuid = srv_uuid, \
  1068. .len = num_handles, \
  1069. }
  1070. #define SECONDARY_SERVICE(start_handle, srv_uuid, num_handles) \
  1071. { \
  1072. .valid = true, \
  1073. .handle = start_handle, \
  1074. .type = SECONDARY, \
  1075. .uuid = srv_uuid, \
  1076. .len = num_handles, \
  1077. }
  1078. #define INCLUDE(include_handle) \
  1079. { \
  1080. .valid = true, \
  1081. .type = INCLUDE, \
  1082. .handle = include_handle, \
  1083. }
  1084. #define STR(x) #x
  1085. #define CHARACTERISTIC(chr_uuid, permissions, properties, bytes...) \
  1086. { \
  1087. .valid = true, \
  1088. .type = CHARACTERISTIC, \
  1089. .uuid = STR(chr_uuid), \
  1090. .att_permissions = permissions, \
  1091. .char_properties = properties, \
  1092. .value = data(bytes), \
  1093. .len = sizeof(data(bytes)), \
  1094. }
  1095. #define CHARACTERISTIC_STR(chr_uuid, permissions, properties, string) \
  1096. { \
  1097. .valid = true, \
  1098. .type = CHARACTERISTIC, \
  1099. .uuid = STR(chr_uuid), \
  1100. .att_permissions = permissions, \
  1101. .char_properties = properties, \
  1102. .value = (uint8_t *)string, \
  1103. .len = strlen(string), \
  1104. }
  1105. #define DESCRIPTOR(desc_uuid, permissions, bytes...) \
  1106. { \
  1107. .valid = true, \
  1108. .type = DESCRIPTOR, \
  1109. .uuid = STR(desc_uuid), \
  1110. .att_permissions = permissions, \
  1111. .value = data(bytes), \
  1112. .len = sizeof(data(bytes)), \
  1113. }
  1114. #define DESCRIPTOR_STR(desc_uuid, permissions, string) \
  1115. { \
  1116. .valid = true, \
  1117. .type = DESCRIPTOR, \
  1118. .uuid = STR(desc_uuid), \
  1119. .att_permissions = permissions, \
  1120. .value = (uint8_t *)string, \
  1121. .len = strlen(string), \
  1122. }
  1123. static struct gatt_db *make_db(const struct att_handle_spec *spec)
  1124. {
  1125. struct gatt_db *db = gatt_db_new();
  1126. struct gatt_db_attribute *att, *include_att;
  1127. bt_uuid_t uuid;
  1128. att = include_att = NULL;
  1129. for (; spec->valid; spec++) {
  1130. switch (spec->type) {
  1131. case PRIMARY:
  1132. case SECONDARY:
  1133. bt_string_to_uuid(&uuid, spec->uuid);
  1134. if (att)
  1135. gatt_db_service_set_active(att, true);
  1136. att = gatt_db_insert_service(db, spec->handle, &uuid,
  1137. spec->type == PRIMARY, spec->len);
  1138. break;
  1139. case INCLUDE:
  1140. include_att = gatt_db_get_attribute(db, spec->handle);
  1141. gatt_db_service_add_included(att, include_att);
  1142. break;
  1143. case CHARACTERISTIC:
  1144. bt_string_to_uuid(&uuid, spec->uuid);
  1145. add_char_with_value(att, spec->handle, &uuid,
  1146. spec->att_permissions,
  1147. spec->char_properties,
  1148. spec->value, spec->len);
  1149. break;
  1150. case DESCRIPTOR:
  1151. bt_string_to_uuid(&uuid, spec->uuid);
  1152. add_desc_with_value(att, spec->handle, &uuid,
  1153. spec->att_permissions,
  1154. spec->value, spec->len);
  1155. break;
  1156. };
  1157. }
  1158. if (att)
  1159. gatt_db_service_set_active(att, true);
  1160. return db;
  1161. }
  1162. static struct gatt_db *make_service_data_1_db(void)
  1163. {
  1164. const struct att_handle_spec specs[] = {
  1165. PRIMARY_SERVICE(0x0001, GATT_UUID, 4),
  1166. CHARACTERISTIC_STR(GATT_CHARAC_DEVICE_NAME, BT_ATT_PERM_READ,
  1167. BT_GATT_CHRC_PROP_READ, "BlueZ"),
  1168. DESCRIPTOR_STR(GATT_CHARAC_USER_DESC_UUID, BT_ATT_PERM_READ,
  1169. "Device Name"),
  1170. PRIMARY_SERVICE(0x0005, HEART_RATE_UUID, 4),
  1171. CHARACTERISTIC_STR(GATT_CHARAC_MANUFACTURER_NAME_STRING,
  1172. BT_ATT_PERM_READ,
  1173. BT_GATT_CHRC_PROP_READ |
  1174. BT_GATT_CHRC_PROP_WRITE, ""),
  1175. DESCRIPTOR_STR(GATT_CHARAC_USER_DESC_UUID, BT_ATT_PERM_READ,
  1176. "Manufacturer Name"),
  1177. { }
  1178. };
  1179. return make_db(specs);
  1180. }
  1181. #define CHARACTERISTIC_STR_AT(chr_handle, chr_uuid, permissions, properties, \
  1182. string) \
  1183. { \
  1184. .valid = true, \
  1185. .handle = chr_handle, \
  1186. .type = CHARACTERISTIC, \
  1187. .uuid = STR(chr_uuid), \
  1188. .att_permissions = permissions, \
  1189. .char_properties = properties, \
  1190. .value = (uint8_t *)string, \
  1191. .len = strlen(string), \
  1192. }
  1193. #define DESCRIPTOR_STR_AT(desc_handle, desc_uuid, permissions, string) \
  1194. { \
  1195. .valid = true, \
  1196. .handle = desc_handle, \
  1197. .type = DESCRIPTOR, \
  1198. .uuid = STR(desc_uuid), \
  1199. .att_permissions = permissions, \
  1200. .value = (uint8_t *)string, \
  1201. .len = strlen(string), \
  1202. }
  1203. static struct gatt_db *make_service_data_2_db(void)
  1204. {
  1205. const struct att_handle_spec specs[] = {
  1206. PRIMARY_SERVICE(0x0001, GATT_UUID, 4),
  1207. CHARACTERISTIC_STR(GATT_CHARAC_DEVICE_NAME, BT_ATT_PERM_READ,
  1208. BT_GATT_CHRC_PROP_READ, "BlueZ"),
  1209. DESCRIPTOR_STR(GATT_CHARAC_USER_DESC_UUID, BT_ATT_PERM_READ,
  1210. "Device Name"),
  1211. PRIMARY_SERVICE(0x0005, HEART_RATE_UUID, 6),
  1212. CHARACTERISTIC_STR_AT(0x0008,
  1213. GATT_CHARAC_MANUFACTURER_NAME_STRING,
  1214. BT_ATT_PERM_READ,
  1215. BT_GATT_CHRC_PROP_READ |
  1216. BT_GATT_CHRC_PROP_WRITE, ""),
  1217. DESCRIPTOR_STR_AT(0x000a, GATT_CHARAC_USER_DESC_UUID,
  1218. BT_ATT_PERM_READ, "Manufacturer Name"),
  1219. { }
  1220. };
  1221. return make_db(specs);
  1222. }
  1223. #define CHARACTERISTIC_AT(chr_handle, chr_uuid, permissions, properties, \
  1224. bytes...) \
  1225. { \
  1226. .valid = true, \
  1227. .handle = chr_handle, \
  1228. .type = CHARACTERISTIC, \
  1229. .uuid = STR(chr_uuid), \
  1230. .att_permissions = permissions, \
  1231. .char_properties = properties, \
  1232. .value = data(bytes), \
  1233. .len = sizeof(data(bytes)), \
  1234. }
  1235. #define DESCRIPTOR_AT(desc_handle, desc_uuid, permissions, bytes...) \
  1236. { \
  1237. .valid = true, \
  1238. .handle = desc_handle, \
  1239. .type = DESCRIPTOR, \
  1240. .uuid = STR(desc_uuid), \
  1241. .att_permissions = permissions, \
  1242. .value = data(bytes), \
  1243. .len = sizeof(data(bytes)), \
  1244. }
  1245. static struct gatt_db *make_service_data_3_db(void)
  1246. {
  1247. const struct att_handle_spec specs[] = {
  1248. PRIMARY_SERVICE(0x0100, GAP_UUID, 0x0121 - 0x0100 + 1),
  1249. CHARACTERISTIC_STR_AT(0x0111, GATT_CHARAC_DEVICE_NAME,
  1250. BT_ATT_PERM_READ,
  1251. BT_GATT_CHRC_PROP_READ, "BlueZ"),
  1252. CHARACTERISTIC_AT(0x0121, GATT_CHARAC_APPEARANCE,
  1253. BT_ATT_PERM_READ,
  1254. BT_GATT_CHRC_PROP_READ, 0x00, 0x00),
  1255. PRIMARY_SERVICE(0x0200, GATT_UUID, 0x0200 - 0x0200 + 1),
  1256. PRIMARY_SERVICE(0x0300, HEART_RATE_UUID, 0x0320 - 0x0300 + 1),
  1257. CHARACTERISTIC_STR_AT(0x0311,
  1258. GATT_CHARAC_MANUFACTURER_NAME_STRING,
  1259. BT_ATT_PERM_READ,
  1260. BT_GATT_CHRC_PROP_READ |
  1261. BT_GATT_CHRC_PROP_WRITE, ""),
  1262. DESCRIPTOR_AT(0x0320, GATT_CLIENT_CHARAC_CFG_UUID,
  1263. BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1264. 0x00, 0x00),
  1265. { }
  1266. };
  1267. return make_db(specs);
  1268. }
  1269. /*
  1270. * Defined Test database 1:
  1271. * Tiny database fits into a single minimum sized-pdu.
  1272. * Satisfies requirements:
  1273. * 3. At least one primary service at the MAX handle
  1274. * 7. at least one service uuid with multiple instances
  1275. * 8. Some simple services, some with included services
  1276. * 9. an instance where handle of included service comes before the including
  1277. * service
  1278. * 11. Simple characteristics (no desc) and complex characteristics
  1279. * (multiple descriptors)
  1280. * 12. Instances of complex chars with 16-bit and 128-bit uuids
  1281. * (although not in scrambled order)
  1282. */
  1283. static struct gatt_db *make_test_spec_small_db(void)
  1284. {
  1285. const struct att_handle_spec specs[] = {
  1286. SECONDARY_SERVICE(0x0001, DEVICE_INFORMATION_UUID, 16),
  1287. CHARACTERISTIC_STR(GATT_CHARAC_MANUFACTURER_NAME_STRING,
  1288. BT_ATT_PERM_READ |
  1289. BT_ATT_PERM_WRITE,
  1290. BT_GATT_CHRC_PROP_READ |
  1291. BT_GATT_CHRC_PROP_NOTIFY |
  1292. BT_GATT_CHRC_PROP_INDICATE |
  1293. BT_GATT_CHRC_PROP_EXT_PROP,
  1294. "BlueZ"),
  1295. DESCRIPTOR(GATT_CLIENT_CHARAC_CFG_UUID, BT_ATT_PERM_READ |
  1296. BT_ATT_PERM_WRITE, 0x00, 0x00),
  1297. DESCRIPTOR_STR(GATT_CHARAC_USER_DESC_UUID, BT_ATT_PERM_READ,
  1298. "Manufacturer Name"),
  1299. DESCRIPTOR(GATT_CHARAC_EXT_PROPER_UUID, BT_ATT_PERM_READ, 0x01,
  1300. 0x00),
  1301. CHARACTERISTIC_STR(GATT_CHARAC_SOFTWARE_REVISION_STRING,
  1302. BT_ATT_PERM_READ,
  1303. BT_GATT_CHRC_PROP_READ |
  1304. BT_GATT_CHRC_PROP_INDICATE,
  1305. "5.59"),
  1306. DESCRIPTOR(GATT_CLIENT_CHARAC_CFG_UUID, BT_ATT_PERM_READ
  1307. | BT_ATT_PERM_WRITE, 0x00, 0x00),
  1308. PRIMARY_SERVICE(0xF010, GAP_UUID, 9),
  1309. INCLUDE(0x0001),
  1310. CHARACTERISTIC_STR(GATT_CHARAC_DEVICE_NAME, BT_ATT_PERM_READ,
  1311. BT_GATT_CHRC_PROP_READ,
  1312. "BlueZ Unit Tester"),
  1313. CHARACTERISTIC(0000B009-0000-0000-0123-456789abcdef,
  1314. BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1315. BT_GATT_CHRC_PROP_READ |
  1316. BT_GATT_CHRC_PROP_EXT_PROP, 0x09),
  1317. DESCRIPTOR(GATT_CHARAC_EXT_PROPER_UUID, BT_ATT_PERM_READ, 0x01,
  1318. 0x00),
  1319. CHARACTERISTIC(GATT_CHARAC_APPEARANCE, BT_ATT_PERM_READ,
  1320. BT_GATT_CHRC_PROP_READ, 0x00, 0x00),
  1321. PRIMARY_SERVICE(0xFFFF, DEVICE_INFORMATION_UUID, 1),
  1322. { }
  1323. };
  1324. return make_db(specs);
  1325. }
  1326. /*
  1327. * Defined Test database 2:
  1328. * Large Database with 128-bit services at the end
  1329. * Satisfies requirements:
  1330. * 4. at least one primary service without any include or characteristic
  1331. * at the max handle.
  1332. * 6. at least one secondary service
  1333. * 7. at least one each of 16-bit and 128-bit UUID with multiple instances
  1334. * 8. some simple services, some some with included services
  1335. * 9. one instance where an included service comes before the including
  1336. * 10. one or more services with both 16-bit and 128-bit service UUIDs
  1337. * 11. simple and complex characteristics
  1338. * 12. complex chars with 16-bit and 128-bit uuids
  1339. */
  1340. #define STRING_512BYTES "11111222223333344444555556666677777888889999900000" \
  1341. "11111222223333344444555556666677777888889999900000" \
  1342. "11111222223333344444555556666677777888889999900000" \
  1343. "11111222223333344444555556666677777888889999900000" \
  1344. "11111222223333344444555556666677777888889999900000" \
  1345. "11111222223333344444555556666677777888889999900000" \
  1346. "11111222223333344444555556666677777888889999900000" \
  1347. "11111222223333344444555556666677777888889999900000" \
  1348. "11111222223333344444555556666677777888889999900000" \
  1349. "11111222223333344444555556666677777888889999900000" \
  1350. "111112222233"
  1351. static struct gatt_db *make_test_spec_large_db_1(void)
  1352. {
  1353. const struct att_handle_spec specs[] = {
  1354. PRIMARY_SERVICE(0x0080, "a00b", 7),
  1355. CHARACTERISTIC(0xb008, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1356. BT_GATT_CHRC_PROP_READ |
  1357. BT_GATT_CHRC_PROP_WRITE |
  1358. BT_GATT_CHRC_PROP_EXT_PROP,
  1359. 0x08),
  1360. DESCRIPTOR(0xb015, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE, 0x01),
  1361. DESCRIPTOR(0xb016, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE, 0x02),
  1362. DESCRIPTOR(0xb017, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE |
  1363. BT_ATT_PERM_ENCRYPT, 0x03),
  1364. DESCRIPTOR(GATT_CHARAC_EXT_PROPER_UUID, BT_ATT_PERM_READ, 0x01,
  1365. 0x00),
  1366. SECONDARY_SERVICE(0x0001, "a00d", 6),
  1367. INCLUDE(0x0080),
  1368. CHARACTERISTIC(0xb00c, BT_ATT_PERM_READ, BT_GATT_CHRC_PROP_READ,
  1369. 0x0C),
  1370. CHARACTERISTIC(0000b00b-0000-0000-0123-456789abcdef,
  1371. BT_ATT_PERM_READ, BT_GATT_CHRC_PROP_READ, 0x0B),
  1372. PRIMARY_SERVICE(0x0010, GATT_UUID, 4),
  1373. CHARACTERISTIC(GATT_CHARAC_SERVICE_CHANGED, BT_ATT_PERM_READ,
  1374. BT_GATT_CHRC_PROP_INDICATE,
  1375. 0x01, 0x00, 0xFF, 0xFF),
  1376. DESCRIPTOR(GATT_CLIENT_CHARAC_CFG_UUID,
  1377. BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1378. 0x00, 0x00),
  1379. PRIMARY_SERVICE(0x0020, "a00a", 10),
  1380. INCLUDE(0x0001),
  1381. CHARACTERISTIC(0xb001, BT_ATT_PERM_READ, BT_GATT_CHRC_PROP_READ,
  1382. 0x01),
  1383. CHARACTERISTIC_STR(0xb002, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1384. BT_GATT_CHRC_PROP_READ |
  1385. BT_GATT_CHRC_PROP_WRITE,
  1386. STRING_512BYTES),
  1387. CHARACTERISTIC_STR(0xb002, BT_ATT_PERM_WRITE,
  1388. BT_GATT_CHRC_PROP_WRITE,
  1389. "1111122222333334444455555"
  1390. "6666677777888889999900000"),
  1391. CHARACTERISTIC(0xb003, BT_ATT_PERM_WRITE,
  1392. BT_GATT_CHRC_PROP_WRITE, 0x03),
  1393. PRIMARY_SERVICE(0x0030, "a00b", 3),
  1394. CHARACTERISTIC(0xb007, BT_ATT_PERM_WRITE,
  1395. BT_GATT_CHRC_PROP_WRITE, 0x07),
  1396. PRIMARY_SERVICE(0x0040, GAP_UUID, 7),
  1397. CHARACTERISTIC_STR(GATT_CHARAC_DEVICE_NAME, BT_ATT_PERM_READ,
  1398. BT_GATT_CHRC_PROP_READ,
  1399. "Test Database"),
  1400. CHARACTERISTIC(GATT_CHARAC_APPEARANCE, BT_ATT_PERM_READ,
  1401. BT_GATT_CHRC_PROP_READ, 17),
  1402. CHARACTERISTIC(GATT_CHARAC_PERIPHERAL_PREF_CONN,
  1403. BT_ATT_PERM_READ, BT_GATT_CHRC_PROP_READ,
  1404. 0x64, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x07, 0xD0),
  1405. PRIMARY_SERVICE(0x0050, "a00b", 3),
  1406. CHARACTERISTIC(0xb006, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1407. BT_GATT_CHRC_PROP_READ |
  1408. BT_GATT_CHRC_PROP_WRITE |
  1409. BT_GATT_CHRC_PROP_WRITE_WITHOUT_RESP |
  1410. BT_GATT_CHRC_PROP_NOTIFY |
  1411. BT_GATT_CHRC_PROP_INDICATE, 0x06),
  1412. PRIMARY_SERVICE(0x0060, "a00b", 12),
  1413. CHARACTERISTIC(0xb004, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1414. BT_GATT_CHRC_PROP_READ | BT_GATT_CHRC_PROP_WRITE, 0x04),
  1415. CHARACTERISTIC(0xb004, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1416. BT_GATT_CHRC_PROP_READ | BT_GATT_CHRC_PROP_WRITE, 0x04),
  1417. DESCRIPTOR(GATT_SERVER_CHARAC_CFG_UUID,
  1418. BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1419. 0x00, 0x00),
  1420. CHARACTERISTIC(0xb004, 0, 0, 0x04),
  1421. DESCRIPTOR(0xb012, 0, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
  1422. 0x88, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
  1423. 0x66, 0x77, 0x88, 0x99, 0x00, 0x11, 0x22, 0x33,
  1424. 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0x11,
  1425. 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
  1426. 0x00, 0x11, 0x22, 0x33),
  1427. CHARACTERISTIC(0xb004, BT_ATT_PERM_READ, BT_GATT_CHRC_PROP_READ,
  1428. 0x04),
  1429. DESCRIPTOR(0xb012, BT_ATT_PERM_READ, 0x11, 0x22, 0x33, 0x44,
  1430. 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0x11, 0x22,
  1431. 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
  1432. 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
  1433. 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66,
  1434. 0x77, 0x88, 0x99, 0x00, 0x11, 0x22, 0x33),
  1435. PRIMARY_SERVICE(0x0070, "a00b", 7),
  1436. CHARACTERISTIC(0xb005, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1437. BT_GATT_CHRC_PROP_READ |
  1438. BT_GATT_CHRC_PROP_WRITE |
  1439. BT_GATT_CHRC_PROP_EXT_PROP,
  1440. 0x05),
  1441. DESCRIPTOR(GATT_CHARAC_EXT_PROPER_UUID, BT_ATT_PERM_READ, 0x03,
  1442. 0x00),
  1443. DESCRIPTOR_STR(GATT_CHARAC_USER_DESC_UUID,
  1444. BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1445. "ABCDEFGHIJKLMNOPQRSTUVWXYZ"),
  1446. DESCRIPTOR(GATT_CHARAC_FMT_UUID, 0x04, 0x00, 0x01, 0x30, 0x01,
  1447. 0x11, 0x31),
  1448. DESCRIPTOR(0000d5d4-0000-0000-0123-456789abcdef,
  1449. BT_ATT_PERM_READ, 0x44),
  1450. /* 0x0080 service defined earlier, included in 0x0001 */
  1451. PRIMARY_SERVICE(0x0090, "0000a00c-0000-0000-0123-456789abcdef",
  1452. 7),
  1453. INCLUDE(0x0001),
  1454. CHARACTERISTIC(0000b009-0000-0000-0123-456789abcdef,
  1455. BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1456. BT_GATT_CHRC_PROP_READ |
  1457. BT_GATT_CHRC_PROP_WRITE |
  1458. BT_GATT_CHRC_PROP_EXT_PROP, 0x09),
  1459. DESCRIPTOR(GATT_CHARAC_EXT_PROPER_UUID, BT_ATT_PERM_READ, 0x01,
  1460. 0x00),
  1461. DESCRIPTOR(0000d9d2-0000-0000-0123-456789abcdef,
  1462. BT_ATT_PERM_READ | BT_ATT_PERM_WRITE, 0x22),
  1463. DESCRIPTOR(0000d9d3-0000-0000-0123-456789abcdef,
  1464. BT_ATT_PERM_WRITE, 0x33),
  1465. PRIMARY_SERVICE(0x00a0, "a00f", 18),
  1466. CHARACTERISTIC_STR(0xb00e, BT_ATT_PERM_READ,
  1467. BT_GATT_CHRC_PROP_READ, "Length is "),
  1468. DESCRIPTOR(GATT_CHARAC_FMT_UUID, BT_ATT_PERM_READ, 0x19, 0x00,
  1469. 0x00, 0x30, 0x01, 0x00, 0x00),
  1470. CHARACTERISTIC(0xb00f, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1471. BT_GATT_CHRC_PROP_READ |
  1472. BT_GATT_CHRC_PROP_WRITE, 0x65),
  1473. DESCRIPTOR(GATT_CHARAC_FMT_UUID, BT_ATT_PERM_READ, 0x04, 0x00,
  1474. 0x01, 0x27, 0x01, 0x01, 0x00),
  1475. CHARACTERISTIC(0xb006, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1476. BT_GATT_CHRC_PROP_READ |
  1477. BT_GATT_CHRC_PROP_WRITE,
  1478. 0x34, 0x12),
  1479. DESCRIPTOR(GATT_CHARAC_FMT_UUID, BT_ATT_PERM_READ, 0x06, 0x00,
  1480. 0x10, 0x27, 0x01, 0x02, 0x00),
  1481. CHARACTERISTIC(0xb007, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1482. BT_GATT_CHRC_PROP_READ |
  1483. BT_GATT_CHRC_PROP_WRITE,
  1484. 0x04, 0x03, 0x02, 0x01),
  1485. DESCRIPTOR(GATT_CHARAC_FMT_UUID, BT_ATT_PERM_READ, 0x08, 0x00,
  1486. 0x17, 0x27, 0x01, 0x03, 0x00),
  1487. CHARACTERISTIC(0xb010, BT_ATT_PERM_READ, BT_GATT_CHRC_PROP_READ,
  1488. 0x65, 0x34, 0x12, 0x04, 0x03, 0x02,
  1489. 0x01),
  1490. DESCRIPTOR(GATT_CHARAC_AGREG_FMT_UUID, BT_ATT_PERM_READ, 0xA6,
  1491. 0x00, 0xa9, 0x00, 0xac, 0x00),
  1492. CHARACTERISTIC(0xb011, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1493. BT_GATT_CHRC_PROP_READ |
  1494. BT_GATT_CHRC_PROP_AUTH, 0x012),
  1495. PRIMARY_SERVICE(0x00C0, "0000a00c-0000-0000-0123-456789abcdef",
  1496. 30),
  1497. CHARACTERISTIC(0xb00a, BT_ATT_PERM_READ, BT_GATT_CHRC_PROP_READ,
  1498. 0x0A),
  1499. CHARACTERISTIC_STR(0xb002, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1500. BT_GATT_CHRC_PROP_READ |
  1501. BT_GATT_CHRC_PROP_WRITE,
  1502. "111112222233333444445"),
  1503. DESCRIPTOR(0xb012, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1504. 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
  1505. 0x99, 0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x11),
  1506. CHARACTERISTIC_STR(0xb002, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1507. BT_GATT_CHRC_PROP_READ |
  1508. BT_GATT_CHRC_PROP_WRITE,
  1509. "2222233333444445555566"),
  1510. DESCRIPTOR(0xb013, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1511. 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
  1512. 0x99, 0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x11,
  1513. 0x22),
  1514. CHARACTERISTIC_STR(0xb002, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1515. BT_GATT_CHRC_PROP_READ |
  1516. BT_GATT_CHRC_PROP_WRITE,
  1517. "33333444445555566666777"),
  1518. DESCRIPTOR(0xb014, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1519. 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
  1520. 0x99, 0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x11,
  1521. 0x22, 0x33),
  1522. CHARACTERISTIC(0xb002, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1523. BT_GATT_CHRC_PROP_READ |
  1524. BT_GATT_CHRC_PROP_WRITE,
  1525. 0x11, 0x22, 0x33, 0x44, 0x55,
  1526. 0x66, 0x77, 0x88, 0x99, 0x00,
  1527. 0x11, 0x22, 0x33, 0x44, 0x55,
  1528. 0x66, 0x77, 0x88, 0x99, 0x00,
  1529. 0x11, 0x22, 0x33, 0x44, 0x55,
  1530. 0x66, 0x77, 0x88, 0x99, 0x00,
  1531. 0x11, 0x22, 0x33, 0x44, 0x55,
  1532. 0x66, 0x77, 0x88, 0x99, 0x00,
  1533. 0x11, 0x22, 0x33),
  1534. DESCRIPTOR(0xb012, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1535. 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
  1536. 0x99, 0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12,
  1537. 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78,
  1538. 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x11, 0x22,
  1539. 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
  1540. 0x11, 0x22, 0x33),
  1541. CHARACTERISTIC(0xb002, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1542. BT_GATT_CHRC_PROP_READ |
  1543. BT_GATT_CHRC_PROP_WRITE,
  1544. 0x11, 0x22, 0x33, 0x44, 0x55,
  1545. 0x66, 0x77, 0x88, 0x99, 0x00,
  1546. 0x11, 0x22, 0x33, 0x44, 0x55,
  1547. 0x66, 0x77, 0x88, 0x99, 0x00,
  1548. 0x11, 0x22, 0x33, 0x44, 0x55,
  1549. 0x66, 0x77, 0x88, 0x99, 0x00,
  1550. 0x11, 0x22, 0x33, 0x44, 0x55,
  1551. 0x66, 0x77, 0x88, 0x99, 0x00,
  1552. 0x11, 0x22, 0x33, 0x44),
  1553. DESCRIPTOR(0xb013, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1554. 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
  1555. 0x99, 0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12,
  1556. 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78,
  1557. 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x11, 0x22,
  1558. 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
  1559. 0x11, 0x22, 0x33, 0x44),
  1560. CHARACTERISTIC(0xb002, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1561. BT_GATT_CHRC_PROP_READ |
  1562. BT_GATT_CHRC_PROP_WRITE,
  1563. 0x11, 0x22, 0x33, 0x44, 0x55,
  1564. 0x66, 0x77, 0x88, 0x99, 0x00,
  1565. 0x11, 0x22, 0x33, 0x44, 0x55,
  1566. 0x66, 0x77, 0x88, 0x99, 0x00,
  1567. 0x11, 0x22, 0x33, 0x44, 0x55,
  1568. 0x66, 0x77, 0x88, 0x99, 0x00,
  1569. 0x11, 0x22, 0x33, 0x44, 0x55,
  1570. 0x66, 0x77, 0x88, 0x99, 0x00,
  1571. 0x11, 0x22, 0x33, 0x44, 0x55),
  1572. DESCRIPTOR(0xb014, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1573. 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
  1574. 0x99, 0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12,
  1575. 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78,
  1576. 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x11, 0x22,
  1577. 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
  1578. 0x11, 0x22, 0x33, 0x44, 0x55),
  1579. CHARACTERISTIC_STR(0xb002, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1580. BT_GATT_CHRC_PROP_READ |
  1581. BT_GATT_CHRC_PROP_WRITE,
  1582. "1111122222333334444455555"
  1583. "666667777788888999"),
  1584. DESCRIPTOR(0xb012, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1585. 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
  1586. 0x99, 0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12,
  1587. 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78,
  1588. 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x11, 0x22,
  1589. 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
  1590. 0x11, 0x22, 0x33),
  1591. CHARACTERISTIC_STR(0xb002, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1592. BT_GATT_CHRC_PROP_READ |
  1593. BT_GATT_CHRC_PROP_WRITE,
  1594. "2222233333444445555566666"
  1595. "7777788888999990000"),
  1596. DESCRIPTOR(0xb013, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1597. 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
  1598. 0x99, 0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12,
  1599. 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78,
  1600. 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x11, 0x22,
  1601. 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
  1602. 0x11, 0x22, 0x33, 0x44),
  1603. CHARACTERISTIC_STR(0xb002, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1604. BT_GATT_CHRC_PROP_READ |
  1605. BT_GATT_CHRC_PROP_WRITE,
  1606. "3333344444555556666677777"
  1607. "88888999990000011111"),
  1608. DESCRIPTOR(0xb014, BT_ATT_PERM_READ | BT_ATT_PERM_WRITE,
  1609. 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
  1610. 0x99, 0x00, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12,
  1611. 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78,
  1612. 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x11, 0x22,
  1613. 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00,
  1614. 0x11, 0x22, 0x33, 0x44, 0x55),
  1615. { }
  1616. };
  1617. return make_db(specs);
  1618. }
  1619. static void test_client(gconstpointer data)
  1620. {
  1621. create_context(512, data);
  1622. }
  1623. static void test_server(gconstpointer data)
  1624. {
  1625. struct context *context = create_context(512, data);
  1626. ssize_t len;
  1627. const struct test_pdu pdu = SERVER_MTU_EXCHANGE_PDU;
  1628. len = write(context->fd, pdu.data, pdu.size);
  1629. g_assert_cmpint(len, ==, pdu.size);
  1630. tester_monitor('<', 0x0004, 0x0000, pdu.data, len);
  1631. g_free(pdu.data);
  1632. }
  1633. static void test_search_primary(gconstpointer data)
  1634. {
  1635. struct context *context = create_context(512, data);
  1636. const struct test_data *test_data = data;
  1637. context->req = bt_gatt_discover_all_primary_services(context->att,
  1638. test_data->uuid,
  1639. generic_search_cb,
  1640. context, NULL);
  1641. }
  1642. static void test_search_included(gconstpointer data)
  1643. {
  1644. struct context *context = create_context(512, data);
  1645. context->req = bt_gatt_discover_included_services(context->att,
  1646. 0x0001, 0xffff,
  1647. generic_search_cb,
  1648. context, NULL);
  1649. }
  1650. static void test_search_chars(gconstpointer data)
  1651. {
  1652. struct context *context = create_context(512, data);
  1653. context->req = bt_gatt_discover_characteristics(context->att,
  1654. 0x0010, 0x0020,
  1655. generic_search_cb,
  1656. context, NULL);
  1657. g_assert(context->req);
  1658. }
  1659. static void test_search_descs(gconstpointer data)
  1660. {
  1661. struct context *context = create_context(512, data);
  1662. context->req = bt_gatt_discover_descriptors(context->att,
  1663. 0x0013, 0x0016,
  1664. generic_search_cb,
  1665. context, NULL);
  1666. g_assert(context->req);
  1667. }
  1668. static const struct test_step test_read_by_type_1 = {
  1669. .handle = 0x0001,
  1670. .end_handle = 0xffff,
  1671. .expected_att_ecode = 0x0a,
  1672. .value = read_data_1,
  1673. .length = 0x03
  1674. };
  1675. static const struct test_step test_read_by_type_2 = {
  1676. .handle = 0x0001,
  1677. .end_handle = 0xffff,
  1678. .expected_att_ecode = 0x02,
  1679. };
  1680. static const struct test_step test_read_by_type_3 = {
  1681. .handle = 0x0001,
  1682. .end_handle = 0xffff,
  1683. .expected_att_ecode = 0x0a,
  1684. };
  1685. static const struct test_step test_read_by_type_4 = {
  1686. .handle = 0x0001,
  1687. .end_handle = 0xffff,
  1688. .expected_att_ecode = 0x08,
  1689. };
  1690. static const struct test_step test_read_by_type_5 = {
  1691. .handle = 0x0001,
  1692. .end_handle = 0xffff,
  1693. .expected_att_ecode = 0x05,
  1694. };
  1695. static const struct test_step test_read_by_type_6 = {
  1696. .handle = 0x0001,
  1697. .end_handle = 0xffff,
  1698. .expected_att_ecode = 0x0c,
  1699. };
  1700. static void multiple_read_cb(bool success, uint8_t att_ecode,
  1701. const uint8_t *value, uint16_t length,
  1702. void *user_data)
  1703. {
  1704. struct context *context = user_data;
  1705. const struct test_step *step = context->data->step;
  1706. g_assert_cmpint(att_ecode, ==, step->expected_att_ecode);
  1707. if (success) {
  1708. g_assert_cmpint(length, ==, step->length);
  1709. g_assert(memcmp(value, step->value, length) == 0);
  1710. }
  1711. context_quit(context);
  1712. }
  1713. static void test_multiple_read(struct context *context)
  1714. {
  1715. const struct test_step *step = context->data->step;
  1716. uint16_t handles[2];
  1717. handles[0] = step->handle;
  1718. handles[1] = step->end_handle;
  1719. g_assert(bt_gatt_client_read_multiple(context->client, handles, 2,
  1720. multiple_read_cb, context,
  1721. NULL));
  1722. }
  1723. static const struct test_step test_multiple_read_1 = {
  1724. .handle = 0x0003,
  1725. .end_handle = 0x0007,
  1726. .func = test_multiple_read,
  1727. .value = read_data_1,
  1728. .length = 0x03
  1729. };
  1730. static const struct test_step test_multiple_read_2 = {
  1731. .handle = 0x0003,
  1732. .end_handle = 0x0007,
  1733. .func = test_multiple_read,
  1734. .expected_att_ecode = 0x02
  1735. };
  1736. static const struct test_step test_multiple_read_3 = {
  1737. .handle = 0x0003,
  1738. .end_handle = 0x0007,
  1739. .func = test_multiple_read,
  1740. .expected_att_ecode = 0x01
  1741. };
  1742. static const struct test_step test_multiple_read_4 = {
  1743. .handle = 0x0003,
  1744. .end_handle = 0x0007,
  1745. .func = test_multiple_read,
  1746. .expected_att_ecode = 0x08
  1747. };
  1748. static const struct test_step test_multiple_read_5 = {
  1749. .handle = 0x0003,
  1750. .end_handle = 0x0007,
  1751. .func = test_multiple_read,
  1752. .expected_att_ecode = 0x05
  1753. };
  1754. static const struct test_step test_multiple_read_6 = {
  1755. .handle = 0x0003,
  1756. .end_handle = 0x0007,
  1757. .func = test_multiple_read,
  1758. .expected_att_ecode = 0x0c
  1759. };
  1760. static void read_by_type_cb(bool success, uint8_t att_ecode,
  1761. struct bt_gatt_result *result,
  1762. void *user_data)
  1763. {
  1764. struct context *context = user_data;
  1765. const struct test_step *step = context->data->step;
  1766. struct bt_gatt_iter iter;
  1767. g_assert(att_ecode == step->expected_att_ecode);
  1768. if (success) {
  1769. uint16_t length, handle;
  1770. const uint8_t *value;
  1771. g_assert(bt_gatt_iter_init(&iter, result));
  1772. g_assert(bt_gatt_iter_next_read_by_type(&iter, &handle, &length,
  1773. &value));
  1774. g_assert(length == step->length);
  1775. g_assert(!memcmp(value, step->value, length));
  1776. g_assert(!bt_gatt_iter_next_read_by_type(&iter, &handle,
  1777. &length, &value));
  1778. }
  1779. context_quit(context);
  1780. }
  1781. static void test_read_by_type(gconstpointer data)
  1782. {
  1783. struct context *context = create_context(512, data);
  1784. const struct test_data *test_data = data;
  1785. const struct test_step *step = context->data->step;
  1786. g_assert(bt_gatt_read_by_type(context->att, step->handle,
  1787. step->end_handle, test_data->uuid,
  1788. read_by_type_cb, context, NULL));
  1789. }
  1790. static void test_long_read(struct context *context)
  1791. {
  1792. const struct test_step *step = context->data->step;
  1793. g_assert(bt_gatt_client_read_long_value(context->client, step->handle,
  1794. 0, multiple_read_cb, context,
  1795. NULL));
  1796. }
  1797. static const struct test_step test_long_read_1 = {
  1798. .handle = 0x0003,
  1799. .func = test_long_read,
  1800. .expected_att_ecode = 0,
  1801. .value = read_data_1,
  1802. .length = 0x03
  1803. };
  1804. static const struct test_step test_long_read_2 = {
  1805. .handle = 0x0003,
  1806. .func = test_long_read,
  1807. .expected_att_ecode = 0,
  1808. .value = long_data_2,
  1809. .length = sizeof(long_data_2)
  1810. };
  1811. static const struct test_step test_long_read_3 = {
  1812. .handle = 0x0003,
  1813. .func = test_long_read,
  1814. .expected_att_ecode = 0x02
  1815. };
  1816. static const struct test_step test_long_read_4 = {
  1817. .handle = 0x0003,
  1818. .func = test_long_read,
  1819. .expected_att_ecode = 0x07
  1820. };
  1821. static const struct test_step test_long_read_5 = {
  1822. .handle = 0x0000,
  1823. .func = test_long_read,
  1824. .expected_att_ecode = 0x01
  1825. };
  1826. static const struct test_step test_long_read_6 = {
  1827. .handle = 0x0003,
  1828. .func = test_long_read,
  1829. .expected_att_ecode = 0x08
  1830. };
  1831. static const struct test_step test_long_read_7 = {
  1832. .handle = 0x0003,
  1833. .func = test_long_read,
  1834. .expected_att_ecode = 0x05
  1835. };
  1836. static const struct test_step test_long_read_8 = {
  1837. .handle = 0x0003,
  1838. .func = test_long_read,
  1839. .expected_att_ecode = 0x0c
  1840. };
  1841. /* Descriptor test data's */
  1842. static const struct test_step test_long_read_9 = {
  1843. .handle = 0x0004,
  1844. .func = test_long_read,
  1845. .expected_att_ecode = 0,
  1846. .value = read_data_1,
  1847. .length = 0x03
  1848. };
  1849. static const struct test_step test_long_read_10 = {
  1850. .handle = 0x0004,
  1851. .func = test_long_read,
  1852. .expected_att_ecode = 0,
  1853. .value = long_data_2,
  1854. .length = sizeof(long_data_2)
  1855. };
  1856. static const struct test_step test_long_read_11 = {
  1857. .handle = 0x0004,
  1858. .func = test_long_read,
  1859. .expected_att_ecode = 0x02
  1860. };
  1861. static const struct test_step test_long_read_12 = {
  1862. .handle = 0x0004,
  1863. .func = test_long_read,
  1864. .expected_att_ecode = 0x07
  1865. };
  1866. static const struct test_step test_long_read_13 = {
  1867. .handle = 0x0004,
  1868. .func = test_long_read,
  1869. .expected_att_ecode = 0x08
  1870. };
  1871. static const struct test_step test_long_read_14 = {
  1872. .handle = 0x0004,
  1873. .func = test_long_read,
  1874. .expected_att_ecode = 0x05
  1875. };
  1876. static const struct test_step test_long_read_15 = {
  1877. .handle = 0x0004,
  1878. .func = test_long_read,
  1879. .expected_att_ecode = 0x0c
  1880. };
  1881. static void notification_cb(uint16_t value_handle, const uint8_t *value,
  1882. uint16_t length, void *user_data)
  1883. {
  1884. struct context *context = user_data;
  1885. const struct test_step *step = context->data->step;
  1886. if (value_handle == step->handle) {
  1887. g_assert_cmpint(length, ==, step->length);
  1888. g_assert(memcmp(value, step->value, length) == 0);
  1889. context_quit(context);
  1890. }
  1891. }
  1892. static void notification_register_cb(uint16_t att_ecode, void *user_data)
  1893. {
  1894. g_assert(!att_ecode);
  1895. }
  1896. static void test_notification(struct context *context)
  1897. {
  1898. const struct test_step *step = context->data->step;
  1899. g_assert(bt_gatt_client_register_notify(context->client, step->handle,
  1900. notification_register_cb,
  1901. notification_cb, context,
  1902. NULL));
  1903. }
  1904. static const struct test_step test_notification_1 = {
  1905. .handle = 0x0003,
  1906. .func = test_notification,
  1907. .value = read_data_1,
  1908. .length = 0x03,
  1909. };
  1910. static void test_server_notification(struct context *context)
  1911. {
  1912. const struct test_step *step = context->data->step;
  1913. bt_gatt_server_send_notification(context->server, step->handle,
  1914. step->value, step->length, false);
  1915. }
  1916. static const struct test_step test_notification_server_1 = {
  1917. .handle = 0x0003,
  1918. .func = test_server_notification,
  1919. .value = read_data_1,
  1920. .length = 0x03,
  1921. };
  1922. static uint8_t indication_received;
  1923. static void test_indication_cb(void *user_data)
  1924. {
  1925. struct context *context = user_data;
  1926. indication_received = 1;
  1927. context_quit(context);
  1928. }
  1929. static void test_server_indication_confirm(struct context *context)
  1930. {
  1931. g_assert(indication_received == 1);
  1932. }
  1933. static void indication_cb(uint16_t value_handle, const uint8_t *value,
  1934. uint16_t length, void *user_data)
  1935. {
  1936. struct context *context = user_data;
  1937. const struct test_step *step = context->data->step;
  1938. if (value_handle == step->handle) {
  1939. g_assert_cmpint(length, ==, step->length);
  1940. g_assert(memcmp(value, step->value, length) == 0);
  1941. }
  1942. }
  1943. static void test_indication(struct context *context)
  1944. {
  1945. const struct test_step *step = context->data->step;
  1946. g_assert(bt_gatt_client_register_notify(context->client, step->handle,
  1947. notification_register_cb,
  1948. indication_cb, context,
  1949. NULL));
  1950. }
  1951. static const struct test_step test_indication_1 = {
  1952. .handle = 0x0008,
  1953. .func = test_indication,
  1954. .value = read_data_1,
  1955. .length = 0x03,
  1956. };
  1957. static void test_server_indication(struct context *context)
  1958. {
  1959. const struct test_step *step = context->data->step;
  1960. bt_gatt_server_send_indication(context->server, step->handle,
  1961. step->value, step->length,
  1962. test_indication_cb,
  1963. context, NULL);
  1964. }
  1965. static const struct test_step test_indication_server_1 = {
  1966. .handle = 0x0003,
  1967. .func = test_server_indication,
  1968. .post_func = test_server_indication_confirm,
  1969. .value = read_data_1,
  1970. .length = 0x03,
  1971. };
  1972. int main(int argc, char *argv[])
  1973. {
  1974. struct gatt_db *service_db_1, *service_db_2, *service_db_3;
  1975. struct gatt_db *ts_small_db, *ts_large_db_1;
  1976. tester_init(&argc, &argv);
  1977. service_db_1 = make_service_data_1_db();
  1978. service_db_2 = make_service_data_2_db();
  1979. service_db_3 = make_service_data_3_db();
  1980. ts_small_db = make_test_spec_small_db();
  1981. ts_large_db_1 = make_test_spec_large_db_1();
  1982. /*
  1983. * Server Configuration
  1984. *
  1985. * The test group objective is to verify Generic Attribute Profile
  1986. * Server Configuration.
  1987. */
  1988. define_test_client("/TP/GAC/CL/BV-01-C", test_client, NULL, NULL,
  1989. raw_pdu(0x02, 0x00, 0x02));
  1990. define_test_server("/TP/GAC/SR/BV-01-C", test_server, service_db_1,
  1991. NULL,
  1992. raw_pdu(0x03, 0x00, 0x02));
  1993. /*
  1994. * Discovery
  1995. *
  1996. * The test group objective is to verify Generic Attribute Profile
  1997. * Discovery of Services and Service Characteristics.
  1998. */
  1999. define_test_att("/TP/GAD/CL/BV-01-C", test_search_primary, NULL, NULL,
  2000. MTU_EXCHANGE_CLIENT_PDUS,
  2001. raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
  2002. raw_pdu(0x11, 0x06, 0x10, 0x00, 0x13, 0x00, 0x00, 0x18,
  2003. 0x20, 0x00, 0x29, 0x00, 0xb0, 0x68,
  2004. 0x30, 0x00, 0x32, 0x00, 0x19, 0x18),
  2005. raw_pdu(0x10, 0x33, 0x00, 0xff, 0xff, 0x00, 0x28),
  2006. raw_pdu(0x11, 0x14, 0x90, 0x00, 0x96, 0x00, 0xef, 0xcd,
  2007. 0xab, 0x89, 0x67, 0x45, 0x23, 0x01,
  2008. 0x00, 0x00, 0x00, 0x00, 0x85, 0x60,
  2009. 0x00, 0x00),
  2010. raw_pdu(0x10, 0x97, 0x00, 0xff, 0xff, 0x00, 0x28),
  2011. raw_pdu(0x01, 0x10, 0x97, 0x00, 0x0a));
  2012. define_test_att("/TP/GAD/CL/BV-01-C-small", test_search_primary, NULL,
  2013. NULL,
  2014. MTU_EXCHANGE_CLIENT_PDUS,
  2015. PRIMARY_DISC_SMALL_DB);
  2016. define_test_server("/TP/GAD/SR/BV-01-C", test_server, service_db_1,
  2017. NULL,
  2018. raw_pdu(0x03, 0x00, 0x02),
  2019. raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
  2020. raw_pdu(0x11, 0x06, 0x01, 0x00, 0x04, 0x00, 0x01, 0x18,
  2021. 0x05, 0x00, 0x08, 0x00, 0x0d, 0x18),
  2022. raw_pdu(0x10, 0x06, 0x00, 0xff, 0xff, 0x00, 0x28),
  2023. raw_pdu(0x01, 0x10, 0x06, 0x00, 0x0a));
  2024. define_test_server("/TP/GAD/SR/BV-01-C-small", test_server, ts_small_db,
  2025. NULL,
  2026. raw_pdu(0x03, 0x00, 0x02),
  2027. PRIMARY_DISC_SMALL_DB);
  2028. define_test_server("/TP/GAD/SR/BV-01-C-large-1", test_server,
  2029. ts_large_db_1, NULL,
  2030. raw_pdu(0x03, 0x00, 0x02),
  2031. PRIMARY_DISC_LARGE_DB_1);
  2032. define_test_att("/TP/GAD/CL/BV-02-C-1", test_search_primary, &uuid_16,
  2033. NULL,
  2034. MTU_EXCHANGE_CLIENT_PDUS,
  2035. raw_pdu(0x06, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28, 0x00,
  2036. 0x18),
  2037. raw_pdu(0x07, 0x01, 0x00, 0x07, 0x00),
  2038. raw_pdu(0x06, 0x08, 0x00, 0xff, 0xff, 0x00, 0x28, 0x00,
  2039. 0x18),
  2040. raw_pdu(0x01, 0x06, 0x08, 0x00, 0x0a));
  2041. define_test_att("/TP/GAD/CL/BV-02-C-1-alternative",
  2042. test_search_primary, &uuid_16,
  2043. NULL,
  2044. MTU_EXCHANGE_CLIENT_PDUS,
  2045. raw_pdu(0x06, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28, 0x00,
  2046. 0x18),
  2047. raw_pdu(0x07, 0x01, 0x00, 0xFF, 0xFF));
  2048. define_test_att("/TP/GAD/CL/BV-02-C-2", test_search_primary, &uuid_128,
  2049. NULL,
  2050. MTU_EXCHANGE_CLIENT_PDUS,
  2051. raw_pdu(0x06, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28, 0xfb,
  2052. 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00,
  2053. 0x80, 0x00, 0x10, 0x00, 0x00, 0x0d,
  2054. 0x18, 0x00, 0x00),
  2055. raw_pdu(0x07, 0x10, 0x00, 0x17, 0x00),
  2056. raw_pdu(0x06, 0x18, 0x00, 0xff, 0xff, 0x00, 0x28, 0xfb,
  2057. 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00,
  2058. 0x80, 0x00, 0x10, 0x00, 0x00, 0x0d,
  2059. 0x18, 0x00, 0x00),
  2060. raw_pdu(0x01, 0x06, 0x18, 0x00, 0x0a));
  2061. define_test_server("/TP/GAD/SR/BV-02-C/exists-16/small", test_server,
  2062. ts_small_db, NULL,
  2063. raw_pdu(0x03, 0x00, 0x02),
  2064. raw_pdu(0x06, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28, 0x00,
  2065. 0x18),
  2066. raw_pdu(0x07, 0x10, 0xf0, 0x18, 0xf0),
  2067. raw_pdu(0x06, 0x18, 0xf0, 0xff, 0xff, 0x00, 0x28, 0x00,
  2068. 0x18),
  2069. raw_pdu(0x01, 0x06, 0x18, 0xf0, 0x0a));
  2070. define_test_server("/TP/GAD/SR/BV-02-C/exists-16/large-1", test_server,
  2071. ts_large_db_1, NULL,
  2072. raw_pdu(0x03, 0x00, 0x02),
  2073. raw_pdu(0x06, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28, 0x0b,
  2074. 0xa0),
  2075. raw_pdu(0x07, 0x30, 0x00, 0x32, 0x00, 0x50, 0x00, 0x52,
  2076. 0x00, 0x60, 0x00, 0x6b, 0x00, 0x70, 0x00, 0x76,
  2077. 0x00, 0x80, 0x00, 0x86, 0x00),
  2078. raw_pdu(0x06, 0x86, 0x00, 0xff, 0xff, 0x00, 0x28, 0x0b,
  2079. 0xa0),
  2080. raw_pdu(0x01, 0x06, 0x86, 0x00, 0x0a));
  2081. define_test_server("/TP/GAD/SR/BV-02-C/missing-16/small", test_server,
  2082. ts_small_db, NULL,
  2083. raw_pdu(0x03, 0x00, 0x02),
  2084. raw_pdu(0x06, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28, 0x01,
  2085. 0x18),
  2086. raw_pdu(0x01, 0x06, 0x01, 0x00, 0x0a));
  2087. define_test_server("/TP/GAD/SR/BV-02-C/missing-16/large-1", test_server,
  2088. ts_large_db_1, NULL,
  2089. raw_pdu(0x03, 0x00, 0x02),
  2090. raw_pdu(0x06, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28, 0x0f,
  2091. 0xf0),
  2092. raw_pdu(0x01, 0x06, 0x01, 0x00, 0x0a));
  2093. define_test_server("/TP/GAD/SR/BV-02-C/exists-128/large-1", test_server,
  2094. ts_large_db_1, NULL,
  2095. raw_pdu(0x03, 0x00, 0x02),
  2096. raw_pdu(0x06, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28, 0xef,
  2097. 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01, 0x00,
  2098. 0x00, 0x00, 0x00, 0x0c, 0xa0, 0x00, 0x00),
  2099. raw_pdu(0x07, 0x90, 0x00, 0x96, 0x00, 0xc0, 0x00, 0xdd,
  2100. 0x00),
  2101. raw_pdu(0x06, 0xde, 0x00, 0xff, 0xff, 0x00, 0x28, 0xef,
  2102. 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01, 0x00,
  2103. 0x00, 0x00, 0x00, 0x0c, 0xa0, 0x00, 0x00),
  2104. raw_pdu(0x01, 0x06, 0xde, 0x00, 0x0a));
  2105. define_test_server("/TP/GAD/SR/BV-02-C/missing-128/large-1",
  2106. test_server, ts_large_db_1, NULL,
  2107. raw_pdu(0x03, 0x00, 0x02),
  2108. raw_pdu(0x06, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28, 0xff,
  2109. 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01, 0x00,
  2110. 0x00, 0x00, 0x00, 0x0c, 0xa0, 0x00, 0x00),
  2111. raw_pdu(0x01, 0x06, 0x01, 0x00, 0x0a));
  2112. define_test_att("/TP/GAD/CL/BV-03-C", test_search_included, NULL,
  2113. NULL,
  2114. MTU_EXCHANGE_CLIENT_PDUS,
  2115. raw_pdu(0x08, 0x01, 0x00, 0xff, 0xff, 0x02, 0x28),
  2116. raw_pdu(0x09, 0x08, 0x02, 0x00, 0x10, 0x00, 0x1f, 0x00,
  2117. 0x0f, 0x18),
  2118. raw_pdu(0x08, 0x03, 0x00, 0xff, 0xff, 0x02, 0x28),
  2119. raw_pdu(0x09, 0x06, 0x03, 0x00, 0x20, 0x00, 0x2f, 0x00,
  2120. 0x04, 0x00, 0x30, 0x00, 0x3f, 0x00),
  2121. raw_pdu(0x0a, 0x20, 0x00),
  2122. raw_pdu(0x0b, 0x00, 0x00, 0x3e, 0x39, 0x00, 0x00, 0x00,
  2123. 0x00, 0x01, 0x23, 0x45, 0x67, 0x89,
  2124. 0xab, 0xcd, 0xef),
  2125. raw_pdu(0x0a, 0x30, 0x00),
  2126. raw_pdu(0x0b, 0x00, 0x00, 0x3b, 0x39, 0x00, 0x00, 0x00,
  2127. 0x00, 0x01, 0x23, 0x45, 0x67, 0x89,
  2128. 0xab, 0xcd, 0xef),
  2129. raw_pdu(0x08, 0x05, 0x00, 0xff, 0xff, 0x02, 0x28),
  2130. raw_pdu(0x09, 0x08, 0x05, 0x00, 0x40, 0x00, 0x4f, 0x00,
  2131. 0x0a, 0x18),
  2132. raw_pdu(0x08, 0x06, 0x00, 0xff, 0xff, 0x02, 0x28),
  2133. raw_pdu(0x01, 0x08, 0x06, 0x00, 0x0a));
  2134. define_test_server("/TP/GAD/SR/BV-03-C/small", test_server,
  2135. ts_small_db, NULL,
  2136. raw_pdu(0x03, 0x00, 0x02),
  2137. raw_pdu(0x08, 0x01, 0x00, 0xff, 0xff, 0x02, 0x28),
  2138. raw_pdu(0x09, 0x08, 0x11, 0xf0, 0x01, 0x00, 0x10, 0x00,
  2139. 0x0a, 0x18),
  2140. raw_pdu(0x08, 0x12, 0xf0, 0xff, 0xff, 0x02, 0x28),
  2141. raw_pdu(0x01, 0x08, 0x12, 0xf0, 0x0a));
  2142. define_test_server("/TP/GAD/SR/BV-03-C/large-1", test_server,
  2143. ts_large_db_1, NULL,
  2144. raw_pdu(0x03, 0x00, 0x02),
  2145. raw_pdu(0x08, 0x01, 0x00, 0xff, 0xff, 0x02, 0x28),
  2146. raw_pdu(0x09, 0x08, 0x02, 0x00, 0x80, 0x00, 0x86, 0x00,
  2147. 0x0b, 0xa0, 0x21, 0x00, 0x01, 0x00, 0x06, 0x00,
  2148. 0x0d, 0xa0),
  2149. raw_pdu(0x08, 0x22, 0x00, 0xff, 0xff, 0x02, 0x28),
  2150. raw_pdu(0x09, 0x08, 0x91, 0x00, 0x01, 0x00, 0x06, 0x00,
  2151. 0x0d, 0xa0),
  2152. raw_pdu(0x08, 0x92, 0x00, 0xff, 0xff, 0x02, 0x28),
  2153. raw_pdu(0x01, 0x08, 0x92, 0x00, 0x0a));
  2154. define_test_att("/TP/GAD/CL/BV-04-C", test_search_chars, NULL,
  2155. NULL,
  2156. MTU_EXCHANGE_CLIENT_PDUS,
  2157. raw_pdu(0x08, 0x10, 0x00, 0x20, 0x00, 0x03, 0x28),
  2158. raw_pdu(0x09, 0x07, 0x11, 0x00, 0x02, 0x12, 0x00, 0x25,
  2159. 0x2a),
  2160. raw_pdu(0x08, 0x12, 0x00, 0x20, 0x00, 0x03, 0x28),
  2161. raw_pdu(0x09, 0x15, 0x13, 0x00, 0x02, 0x14, 0x00, 0x85,
  2162. 0x00, 0xef, 0xcd, 0xab, 0x89, 0x67,
  2163. 0x45, 0x23, 0x01, 0x00, 0x00, 0x00,
  2164. 0x00, 0x00, 0x00),
  2165. raw_pdu(0x08, 0x14, 0x00, 0x20, 0x00, 0x03, 0x28),
  2166. raw_pdu(0x01, 0x08, 0x12, 0x00, 0x0a));
  2167. define_test_server("/TP/GAD/SR/BV-04-C/small/1", test_server,
  2168. ts_small_db, NULL,
  2169. raw_pdu(0x03, 0x00, 0x02),
  2170. raw_pdu(0x08, 0x10, 0xf0, 0x18, 0xf0, 0x03, 0x28),
  2171. raw_pdu(0x09, 0x07, 0x12, 0xf0, 0x02, 0x13, 0xf0, 0x00,
  2172. 0x2a),
  2173. raw_pdu(0x08, 0x13, 0xf0, 0x18, 0xf0, 0x03, 0x28),
  2174. raw_pdu(0x09, 0x15, 0x14, 0xf0, 0x82, 0x15, 0xf0, 0xef,
  2175. 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23,
  2176. 0x01, 0x00, 0x00, 0x00, 0x00, 0x09,
  2177. 0xb0, 0x00, 0x00),
  2178. raw_pdu(0x08, 0x15, 0xf0, 0x18, 0xf0, 0x03, 0x28),
  2179. raw_pdu(0x09, 0x07, 0x17, 0xf0, 0x02, 0x18, 0xf0, 0x01,
  2180. 0x2a),
  2181. raw_pdu(0x08, 0x18, 0xf0, 0x18, 0xf0, 0x03, 0x28),
  2182. raw_pdu(0x01, 0x08, 0x18, 0xf0, 0x0a));
  2183. define_test_server("/TP/GAD/SR/BV-04-C/small/2", test_server,
  2184. ts_small_db, NULL,
  2185. raw_pdu(0x03, 0x00, 0x02),
  2186. raw_pdu(0x08, 0x01, 0x00, 0x0f, 0x00, 0x03, 0x28),
  2187. raw_pdu(0x09, 0x07, 0x02, 0x00, 0xb2, 0x03, 0x00, 0x29,
  2188. 0x2a, 0x07, 0x00, 0x22, 0x08, 0x00,
  2189. 0x28, 0x2a),
  2190. raw_pdu(0x08, 0x08, 0x00, 0x0f, 0x00, 0x03, 0x28),
  2191. raw_pdu(0x01, 0x08, 0x08, 0x00, 0x0a));
  2192. define_test_server("/TP/GAD/SR/BV-04-C/large-1", test_server,
  2193. ts_large_db_1, NULL,
  2194. raw_pdu(0x03, 0x00, 0x02),
  2195. raw_pdu(0x08, 0x20, 0x00, 0x29, 0x00, 0x03, 0x28),
  2196. raw_pdu(0x09, 0x07, 0x22, 0x00, 0x02, 0x23, 0x00, 0x01,
  2197. 0xb0, 0x24, 0x00, 0x0a, 0x25, 0x00, 0x02, 0xb0,
  2198. 0x26, 0x00, 0x08, 0x27, 0x00, 0x02, 0xb0),
  2199. raw_pdu(0x08, 0x27, 0x00, 0x29, 0x00, 0x03, 0x28),
  2200. raw_pdu(0x09, 0x07, 0x28, 0x00, 0x08, 0x29, 0x00, 0x03,
  2201. 0xb0),
  2202. raw_pdu(0x08, 0x29, 0x00, 0x29, 0x00, 0x03, 0x28),
  2203. raw_pdu(0x01, 0x08, 0x29, 0x00, 0x0a));
  2204. define_test_att("/TP/GAD/CL/BV-05-C", test_search_chars, NULL,
  2205. NULL,
  2206. MTU_EXCHANGE_CLIENT_PDUS,
  2207. raw_pdu(0x08, 0x10, 0x00, 0x20, 0x00, 0x03, 0x28),
  2208. raw_pdu(0x09, 0x07, 0x11, 0x00, 0x02, 0x12, 0x00, 0x25,
  2209. 0x2a),
  2210. raw_pdu(0x08, 0x12, 0x00, 0x20, 0x00, 0x03, 0x28),
  2211. raw_pdu(0x09, 0x15, 0x13, 0x00, 0x02, 0x14, 0x00, 0x85,
  2212. 0x00, 0xef, 0xcd, 0xab, 0x89, 0x67,
  2213. 0x45, 0x23, 0x01, 0x00, 0x00, 0x00,
  2214. 0x00, 0x00, 0x00),
  2215. raw_pdu(0x08, 0x14, 0x00, 0x20, 0x00, 0x03, 0x28),
  2216. raw_pdu(0x01, 0x08, 0x12, 0x00, 0x0a));
  2217. define_test_server("/TP/GAD/SR/BV-05-C/small/1", test_server,
  2218. ts_small_db, NULL,
  2219. raw_pdu(0x03, 0x00, 0x02),
  2220. raw_pdu(0x08, 0x10, 0xf0, 0x17, 0xf0, 0x03, 0x28),
  2221. raw_pdu(0x09, 0x07, 0x12, 0xf0, 0x02, 0x13, 0xf0, 0x00,
  2222. 0x2a),
  2223. raw_pdu(0x08, 0x13, 0xf0, 0x17, 0xf0, 0x03, 0x28),
  2224. raw_pdu(0x09, 0x15, 0x14, 0xf0, 0x82, 0x15, 0xf0, 0xef,
  2225. 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23,
  2226. 0x01, 0x00, 0x00, 0x00, 0x00, 0x09,
  2227. 0xb0, 0x00, 0x00),
  2228. raw_pdu(0x08, 0x15, 0xf0, 0x18, 0xf0, 0x03, 0x28),
  2229. raw_pdu(0x09, 0x07, 0x17, 0xf0, 0x02, 0x18, 0xf0, 0x01,
  2230. 0x2a),
  2231. raw_pdu(0x08, 0x18, 0xf0, 0x18, 0xf0, 0x03, 0x28),
  2232. raw_pdu(0x01, 0x08, 0x18, 0xf0, 0x0a));
  2233. define_test_server("/TP/GAD/SR/BV-05-C/small/2", test_server,
  2234. ts_small_db, NULL,
  2235. raw_pdu(0x03, 0x00, 0x02),
  2236. raw_pdu(0x08, 0x01, 0x00, 0x0f, 0x00, 0x03, 0x28),
  2237. raw_pdu(0x09, 0x07, 0x02, 0x00, 0xb2, 0x03, 0x00, 0x29,
  2238. 0x2a, 0x07, 0x00, 0x22, 0x08, 0x00,
  2239. 0x28, 0x2a),
  2240. raw_pdu(0x08, 0x08, 0x00, 0x0f, 0x00, 0x03, 0x28),
  2241. raw_pdu(0x01, 0x08, 0x08, 0x00, 0x0a));
  2242. define_test_server("/TP/GAD/SR/BV-05-C/large-1", test_server,
  2243. ts_large_db_1, NULL,
  2244. raw_pdu(0x03, 0x00, 0x02),
  2245. raw_pdu(0x08, 0x20, 0x00, 0x29, 0x00, 0x03, 0x28),
  2246. raw_pdu(0x09, 0x07, 0x22, 0x00, 0x02, 0x23, 0x00, 0x01,
  2247. 0xb0, 0x24, 0x00, 0x0a, 0x25, 0x00, 0x02, 0xb0,
  2248. 0x26, 0x00, 0x08, 0x27, 0x00, 0x02, 0xb0),
  2249. raw_pdu(0x08, 0x27, 0x00, 0x29, 0x00, 0x03, 0x28),
  2250. raw_pdu(0x09, 0x07, 0x28, 0x00, 0x08, 0x29, 0x00, 0x03,
  2251. 0xb0),
  2252. raw_pdu(0x08, 0x29, 0x00, 0x29, 0x00, 0x03, 0x28),
  2253. raw_pdu(0x01, 0x08, 0x29, 0x00, 0x0a));
  2254. define_test_att("/TP/GAD/CL/BV-06-C", test_search_descs, NULL, NULL,
  2255. MTU_EXCHANGE_CLIENT_PDUS,
  2256. raw_pdu(0x04, 0x13, 0x00, 0x16, 0x00),
  2257. raw_pdu(0x05, 0x01, 0x13, 0x00, 0x02, 0x29, 0x14, 0x00,
  2258. 0x03, 0x29),
  2259. raw_pdu(0x04, 0x15, 0x00, 0x16, 0x00),
  2260. raw_pdu(0x05, 0x01, 0x15, 0x00, 0x04, 0x29, 0x16, 0x00,
  2261. 0x05, 0x29));
  2262. define_test_client("/TP/GAD/CL/BV-06-C/client-1", test_client,
  2263. service_db_1, NULL,
  2264. SERVICE_DATA_1_PDUS);
  2265. define_test_client("/TP/GAD/CL/BV-06-C/client-2", test_client,
  2266. service_db_2, NULL,
  2267. SERVICE_DATA_2_PDUS);
  2268. define_test_client("/TP/GAD/CL/BV-06-C/client-3", test_client,
  2269. service_db_3, NULL,
  2270. SERVICE_DATA_3_PDUS);
  2271. define_test_server("/TP/GAD/SR/BV-06-C/small", test_server,
  2272. ts_small_db, NULL,
  2273. raw_pdu(0x03, 0x00, 0x02),
  2274. raw_pdu(0x04, 0x04, 0x00, 0x05, 0x00),
  2275. raw_pdu(0x05, 0x01, 0x04, 0x00, 0x02, 0x29, 0x05, 0x00,
  2276. 0x01, 0x29));
  2277. define_test_server("/TP/GAD/SR/BV-06-C/large-1", test_server,
  2278. ts_large_db_1, NULL,
  2279. raw_pdu(0x03, 0x00, 0x02),
  2280. raw_pdu(0x04, 0x73, 0x00, 0x76, 0x00),
  2281. raw_pdu(0x05, 0x01, 0x73, 0x00, 0x00, 0x29, 0x74, 0x00,
  2282. 0x01, 0x29, 0x75, 0x00, 0x04, 0x29),
  2283. raw_pdu(0x04, 0x76, 0x00, 0x76, 0x00),
  2284. raw_pdu(0x05, 0x02, 0x76, 0x00, 0xef, 0xcd, 0xab, 0x89,
  2285. 0x67, 0x45, 0x23, 0x01, 0x00, 0x00, 0x00, 0x00,
  2286. 0xd4, 0xd5, 0x00, 0x00));
  2287. define_test_client("/TP/GAR/CL/BV-01-C", test_client, service_db_1,
  2288. &test_read_1,
  2289. SERVICE_DATA_1_PDUS,
  2290. raw_pdu(0x0a, 0x03, 0x00),
  2291. raw_pdu(0x0b, 0x01, 0x02, 0x03));
  2292. define_test_client("/TP/GAR/CL/BI-01-C", test_client, service_db_1,
  2293. &test_read_2,
  2294. SERVICE_DATA_1_PDUS,
  2295. raw_pdu(0x0a, 0x00, 0x00),
  2296. raw_pdu(0x01, 0x0a, 0x00, 0x00, 0x01));
  2297. define_test_client("/TP/GAR/CL/BI-02-C", test_client, service_db_1,
  2298. &test_read_3,
  2299. SERVICE_DATA_1_PDUS,
  2300. raw_pdu(0x0a, 0x03, 0x00),
  2301. raw_pdu(0x01, 0x0a, 0x03, 0x00, 0x02));
  2302. define_test_client("/TP/GAR/CL/BI-03-C", test_client, service_db_1,
  2303. &test_read_4,
  2304. SERVICE_DATA_1_PDUS,
  2305. raw_pdu(0x0a, 0x03, 0x00),
  2306. raw_pdu(0x01, 0x0a, 0x03, 0x00, 0x08));
  2307. define_test_client("/TP/GAR/CL/BI-04-C", test_client, service_db_1,
  2308. &test_read_5,
  2309. SERVICE_DATA_1_PDUS,
  2310. raw_pdu(0x0a, 0x03, 0x00),
  2311. raw_pdu(0x01, 0x0a, 0x03, 0x00, 0x05));
  2312. define_test_client("/TP/GAR/CL/BI-04-C/auto", test_client, service_db_1,
  2313. &test_read_1,
  2314. SERVICE_DATA_1_PDUS,
  2315. raw_pdu(0x0a, 0x03, 0x00),
  2316. raw_pdu(0x01, 0x0a, 0x03, 0x00, 0x05),
  2317. raw_pdu(0x0a, 0x03, 0x00),
  2318. raw_pdu(0x0b, 0x01, 0x02, 0x03));
  2319. define_test_client("/TP/GAR/CL/BI-05-C", test_client, service_db_1,
  2320. &test_read_6,
  2321. SERVICE_DATA_1_PDUS,
  2322. raw_pdu(0x0a, 0x03, 0x00),
  2323. raw_pdu(0x01, 0x0a, 0x03, 0x00, 0x0c));
  2324. define_test_server("/TP/GAR/SR/BV-01-C/small", test_server,
  2325. ts_small_db, NULL,
  2326. raw_pdu(0x03, 0x00, 0x02),
  2327. raw_pdu(0x0a, 0x03, 0x00),
  2328. raw_pdu(0x0b, 0x42, 0x6c, 0x75, 0x65, 0x5a));
  2329. define_test_server("/TP/GAR/SR/BV-01-C/large-1", test_server,
  2330. ts_large_db_1, NULL,
  2331. raw_pdu(0x03, 0x00, 0x02),
  2332. raw_pdu(0x0a, 0xc4, 0x00),
  2333. raw_pdu(0x0b, '1', '1', '1', '1', '1', '2', '2', '2',
  2334. '2', '2', '3', '3', '3', '3', '3', '4', '4',
  2335. '4', '4', '4', '5'),
  2336. raw_pdu(0x0a, 0xca, 0x00),
  2337. raw_pdu(0x0b, '3', '3', '3', '3', '3', '4', '4', '4',
  2338. '4', '4', '5', '5', '5', '5', '5', '6', '6',
  2339. '6', '6', '6', '7', '7'));
  2340. define_test_server("/TP/GAR/SR/BI-02-C/small", test_server,
  2341. ts_small_db, NULL,
  2342. raw_pdu(0x03, 0x00, 0x02),
  2343. raw_pdu(0x0a, 0x00, 0x00),
  2344. raw_pdu(0x01, 0x0a, 0x00, 0x00, 0x01));
  2345. define_test_server("/TP/GAR/SR/BI-02-C/large", test_server,
  2346. ts_large_db_1, NULL,
  2347. raw_pdu(0x03, 0x00, 0x02),
  2348. raw_pdu(0x0a, 0x0f, 0xf0),
  2349. raw_pdu(0x01, 0x0a, 0x0f, 0xf0, 0x01));
  2350. define_test_att("/TP/GAR/CL/BV-03-C-1", test_read_by_type,
  2351. &uuid_char_16, &test_read_by_type_1,
  2352. raw_pdu(0x02, 0x00, 0x02),
  2353. raw_pdu(0x03, 0x00, 0x02),
  2354. raw_pdu(0x08, 0x01, 0x00, 0xff, 0xff, 0x0d, 0x2a),
  2355. raw_pdu(0x09, 0x05, 0x0a, 0x00, 0x01, 0x02, 0x03),
  2356. raw_pdu(0x08, 0x0b, 0x00, 0xff, 0xff, 0x0d, 0x2a),
  2357. raw_pdu(0x01, 0x08, 0x0b, 0x00, 0x0a));
  2358. define_test_att("/TP/GAR/CL/BV-03-C-2", test_read_by_type,
  2359. &uuid_char_128, &test_read_by_type_1,
  2360. raw_pdu(0x02, 0x00, 0x02),
  2361. raw_pdu(0x03, 0x00, 0x02),
  2362. raw_pdu(0x08, 0x01, 0x00, 0xff, 0xff, 0x0f, 0x0e, 0x0d,
  2363. 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07,
  2364. 0x06, 0x05, 0x04, 0x03, 0x02, 0x01,
  2365. 0x00),
  2366. raw_pdu(0x09, 0x05, 0x0a, 0x00, 0x01, 0x02, 0x03),
  2367. raw_pdu(0x08, 0x0b, 0x00, 0xff, 0xff, 0x0f, 0x0e, 0x0d,
  2368. 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07,
  2369. 0x06, 0x05, 0x04, 0x03, 0x02, 0x01,
  2370. 0x00),
  2371. raw_pdu(0x01, 0x08, 0x0b, 0x00, 0x0a));
  2372. define_test_att("/TP/GAR/CL/BI-06-C", test_read_by_type, &uuid_char_16,
  2373. &test_read_by_type_2,
  2374. MTU_EXCHANGE_CLIENT_PDUS,
  2375. raw_pdu(0x08, 0x01, 0x00, 0xff, 0xff, 0x0d, 0x2a),
  2376. raw_pdu(0x01, 0x08, 0x0b, 0x00, 0x02));
  2377. define_test_att("/TP/GAR/CL/BI-07-C", test_read_by_type, &uuid_char_16,
  2378. &test_read_by_type_3,
  2379. MTU_EXCHANGE_CLIENT_PDUS,
  2380. raw_pdu(0x08, 0x01, 0x00, 0xff, 0xff, 0x0d, 0x2a),
  2381. raw_pdu(0x01, 0x08, 0x0b, 0x00, 0x0a));
  2382. define_test_att("/TP/GAR/CL/BI-09-C", test_read_by_type, &uuid_char_16,
  2383. &test_read_by_type_4,
  2384. MTU_EXCHANGE_CLIENT_PDUS,
  2385. raw_pdu(0x08, 0x01, 0x00, 0xff, 0xff, 0x0d, 0x2a),
  2386. raw_pdu(0x01, 0x08, 0x0b, 0x00, 0x08));
  2387. define_test_att("/TP/GAR/CL/BI-10-C", test_read_by_type, &uuid_char_16,
  2388. &test_read_by_type_5,
  2389. MTU_EXCHANGE_CLIENT_PDUS,
  2390. raw_pdu(0x08, 0x01, 0x00, 0xff, 0xff, 0x0d, 0x2a),
  2391. raw_pdu(0x01, 0x08, 0x0b, 0x00, 0x05));
  2392. define_test_att("/TP/GAR/CL/BI-11-C", test_read_by_type, &uuid_char_16,
  2393. &test_read_by_type_6,
  2394. MTU_EXCHANGE_CLIENT_PDUS,
  2395. raw_pdu(0x08, 0x01, 0x00, 0xff, 0xff, 0x0d, 0x2a),
  2396. raw_pdu(0x01, 0x08, 0x0b, 0x00, 0x0c));
  2397. define_test_server("/TP/GAR/SR/BV-03-C/small", test_server, ts_small_db,
  2398. NULL,
  2399. raw_pdu(0x03, 0x00, 0x02),
  2400. raw_pdu(0x08, 0x01, 0x00, 0xFF, 0xFF, 0xef, 0xcd, 0xab,
  2401. 0x89, 0x67, 0x45, 0x23, 0x01, 0x00,
  2402. 0x00, 0x00, 0x00, 0x09, 0xB0, 0x00,
  2403. 0x00),
  2404. raw_pdu(0x09, 0x03, 0x15, 0xF0, 0x09),
  2405. raw_pdu(0x08, 0x01, 0x00, 0xFF, 0xFF, 0x01, 0x2a),
  2406. raw_pdu(0x09, 0x04, 0x18, 0xF0, 0x00, 0x00));
  2407. define_test_server("/TP/GAR/SR/BV-03-C/large-1", test_server,
  2408. ts_large_db_1, NULL,
  2409. raw_pdu(0x03, 0x00, 0x02),
  2410. raw_pdu(0x08, 0x01, 0x00, 0xFF, 0xFF, 0xef, 0xcd, 0xab,
  2411. 0x89, 0x67, 0x45, 0x23, 0x01, 0x00,
  2412. 0x00, 0x00, 0x00, 0xd4, 0xd5, 0x00,
  2413. 0x00),
  2414. raw_pdu(0x09, 0x03, 0x76, 0x00, 0x44),
  2415. raw_pdu(0x08, 0x01, 0x00, 0xFF, 0xFF, 0x02, 0xB0),
  2416. raw_pdu(0x09, 0x15, 0x25, 0x00, '1', '1', '1', '1', '1',
  2417. '2', '2', '2', '2', '2', '3', '3', '3', '3',
  2418. '3', '4', '4', '4', '4'));
  2419. define_test_server("/TP/GAR/SR/BI-06-C/large-1", test_server,
  2420. ts_large_db_1, NULL,
  2421. raw_pdu(0x03, 0x00, 0x02),
  2422. raw_pdu(0x08, 0x01, 0x00, 0xFF, 0xFF, 0x07, 0xB0),
  2423. raw_pdu(0x01, 0x08, 0x32, 0x00, 0x02));
  2424. define_test_server("/TP/GAR/SR/BI-07-C/small", test_server, ts_small_db,
  2425. NULL,
  2426. raw_pdu(0x03, 0x00, 0x02),
  2427. raw_pdu(0x08, 0x01, 0x00, 0xFF, 0xFF, 0xF0, 0x0F),
  2428. raw_pdu(0x01, 0x08, 0x01, 0x00, 0x0a));
  2429. define_test_server("/TP/GAR/SR/BI-07-C/large-1", test_server,
  2430. ts_large_db_1, NULL,
  2431. raw_pdu(0x03, 0x00, 0x02),
  2432. raw_pdu(0x08, 0x01, 0x00, 0xFF, 0xFF, 0xF0, 0x0F),
  2433. raw_pdu(0x01, 0x08, 0x01, 0x00, 0x0a));
  2434. define_test_server("/TP/GAR/SR/BI-08-C/small", test_server, ts_small_db,
  2435. NULL,
  2436. raw_pdu(0x03, 0x00, 0x02),
  2437. raw_pdu(0x08, 0x02, 0x00, 0x01, 0x00, 0x00, 0x28),
  2438. raw_pdu(0x01, 0x08, 0x02, 0x00, 0x01));
  2439. define_test_server("/TP/GAR/SR/BI-08-C/large-1", test_server,
  2440. ts_large_db_1, NULL,
  2441. raw_pdu(0x03, 0x00, 0x02),
  2442. raw_pdu(0x08, 0x02, 0x00, 0x01, 0x00, 0x00, 0x28),
  2443. raw_pdu(0x01, 0x08, 0x02, 0x00, 0x01));
  2444. define_test_server("/TP/GAR/SR/BV-04-C/large-1", test_server,
  2445. ts_large_db_1, NULL,
  2446. raw_pdu(0x03, 0x00, 0x02),
  2447. raw_pdu(0x0C, 0xD3, 0x00, 0x00, 0x00),
  2448. raw_pdu(0x0D, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
  2449. 0x88, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
  2450. 0x66, 0x77, 0x88, 0x99, 0x00, 0x11, 0x22),
  2451. raw_pdu(0x0C, 0xD3, 0x00, 0x16, 0x00),
  2452. raw_pdu(0x0D, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
  2453. 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
  2454. 0x88, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44),
  2455. raw_pdu(0x0C, 0xD3, 0x00, 0x2C, 0x00),
  2456. raw_pdu(0x0D, 0x55),
  2457. raw_pdu(0x0C, 0xD3, 0x00, 0x2D, 0x00),
  2458. raw_pdu(0x0D));
  2459. define_test_server("/TP/GAR/SR/BI-12-C/large-1", test_server,
  2460. ts_large_db_1, NULL,
  2461. raw_pdu(0x03, 0x00, 0x02),
  2462. raw_pdu(0x0C, 0x27, 0x00, 0x00, 0x00),
  2463. raw_pdu(0x01, 0x0C, 0x27, 0x00, 0x02));
  2464. define_test_server("/TP/GAR/SR/BI-13-C/small", test_server,
  2465. ts_small_db, NULL,
  2466. raw_pdu(0x03, 0x00, 0x02),
  2467. raw_pdu(0x0C, 0x13, 0xF0, 0xF0, 0x00),
  2468. raw_pdu(0x01, 0x0C, 0x13, 0xF0, 0x07));
  2469. define_test_server("/TP/GAR/SR/BI-13-C/large-1", test_server,
  2470. ts_large_db_1, NULL,
  2471. raw_pdu(0x03, 0x00, 0x02),
  2472. raw_pdu(0x0C, 0xD3, 0x00, 0xF0, 0x00),
  2473. raw_pdu(0x01, 0x0C, 0xD3, 0x00, 0x07));
  2474. define_test_server("/TP/GAR/SR/BI-14-C/small", test_server,
  2475. ts_small_db, NULL,
  2476. raw_pdu(0x03, 0x00, 0x02),
  2477. raw_pdu(0x0C, 0xF0, 0x0F, 0x00, 0x00),
  2478. raw_pdu(0x01, 0x0C, 0xF0, 0x0F, 0x01));
  2479. define_test_server("/TP/GAR/SR/BI-14-C/large-1", test_server,
  2480. ts_large_db_1, NULL,
  2481. raw_pdu(0x03, 0x00, 0x02),
  2482. raw_pdu(0x0C, 0xF0, 0x0F, 0x00, 0x00),
  2483. raw_pdu(0x01, 0x0C, 0xF0, 0x0F, 0x01));
  2484. define_test_client("/TP/GAR/CL/BV-04-C", test_client, service_db_1,
  2485. &test_long_read_1,
  2486. SERVICE_DATA_1_PDUS,
  2487. raw_pdu(0x0a, 0x03, 0x00),
  2488. raw_pdu(0x0b, 0x01, 0x02, 0x03));
  2489. define_test_client("/TP/GAR/CL/BV-04-C/512B", test_client, service_db_1,
  2490. &test_long_read_2,
  2491. SERVICE_DATA_1_PDUS,
  2492. raw_pdu(0x0a, 0x03, 0x00),
  2493. raw_pdu(0x0b, 0xff, 0xff, 0xff, 0xff,
  2494. 0xff, 0xff, 0xff, 0xff, 0xff,
  2495. 0xff, 0xff, 0xff, 0xff, 0xff,
  2496. 0xff, 0xff, 0xff, 0xff, 0xff,
  2497. 0xff, 0xff, 0xff, 0xff, 0xff,
  2498. 0xff, 0xff, 0xff, 0xff, 0xff,
  2499. 0xff, 0xff, 0xff, 0xff, 0xff,
  2500. 0xff, 0xff, 0xff, 0xff, 0xff,
  2501. 0xff, 0xff, 0xff, 0xff, 0xff,
  2502. 0xff, 0xff, 0xff, 0xff, 0xff,
  2503. 0xff, 0xff, 0xff, 0xff, 0xff,
  2504. 0xff, 0xff, 0xff, 0xff, 0xff,
  2505. 0xff, 0xff, 0xff, 0xff, 0xff,
  2506. 0xff, 0xff, 0xff, 0xff, 0xff,
  2507. 0xff, 0xff, 0xff, 0xff, 0xff,
  2508. 0xff, 0xff, 0xff, 0xff, 0xff,
  2509. 0xff, 0xff, 0xff, 0xff, 0xff,
  2510. 0xff, 0xff, 0xff, 0xff, 0xff,
  2511. 0xff, 0xff, 0xff, 0xff, 0xff,
  2512. 0xff, 0xff, 0xff, 0xff, 0xff,
  2513. 0xff, 0xff, 0xff, 0xff, 0xff,
  2514. 0xff, 0xff, 0xff, 0xff, 0xff,
  2515. 0xff, 0xff, 0xff, 0xff, 0xff,
  2516. 0xff, 0xff, 0xff, 0xff, 0xff,
  2517. 0xff, 0xff, 0xff, 0xff, 0xff,
  2518. 0xff, 0xff, 0xff, 0xff, 0xff,
  2519. 0xff, 0xff, 0xff, 0xff, 0xff,
  2520. 0xff, 0xff, 0xff, 0xff, 0xff,
  2521. 0xff, 0xff, 0xff, 0xff, 0xff,
  2522. 0xff, 0xff, 0xff, 0xff, 0xff,
  2523. 0xff, 0xff, 0xff, 0xff, 0xff,
  2524. 0xff, 0xff, 0xff, 0xff, 0xff,
  2525. 0xff, 0xff, 0xff, 0xff, 0xff,
  2526. 0xff, 0xff, 0xff, 0xff, 0xff,
  2527. 0xff, 0xff, 0xff, 0xff, 0xff,
  2528. 0xff, 0xff, 0xff, 0xff, 0xff,
  2529. 0xff, 0xff, 0xff, 0xff, 0xff,
  2530. 0xff, 0xff, 0xff, 0xff, 0xff,
  2531. 0xff, 0xff, 0xff, 0xff, 0xff,
  2532. 0xff, 0xff, 0xff, 0xff, 0xff,
  2533. 0xff, 0xff, 0xff, 0xff, 0xff,
  2534. 0xff, 0xff, 0xff, 0xff, 0xff,
  2535. 0xff, 0xff, 0xff, 0xff, 0xff,
  2536. 0xff, 0xff, 0xff, 0xff, 0xff,
  2537. 0xff, 0xff, 0xff, 0xff, 0xff,
  2538. 0xff, 0xff, 0xff, 0xff, 0xff,
  2539. 0xff, 0xff, 0xff, 0xff, 0xff,
  2540. 0xff, 0xff, 0xff, 0xff, 0xff,
  2541. 0xff, 0xff, 0xff, 0xff, 0xff,
  2542. 0xff, 0xff, 0xff, 0xff, 0xff,
  2543. 0xff, 0xff, 0xff, 0xff, 0xff,
  2544. 0xff, 0xff, 0xff, 0xff, 0xff,
  2545. 0xff, 0xff, 0xff, 0xff, 0xff,
  2546. 0xff, 0xff, 0xff, 0xff, 0xff,
  2547. 0xff, 0xff, 0xff, 0xff, 0xff,
  2548. 0xff, 0xff, 0xff, 0xff, 0xff,
  2549. 0xff, 0xff, 0xff, 0xff, 0xff,
  2550. 0xff, 0xff, 0xff, 0xff, 0xff,
  2551. 0xff, 0xff, 0xff, 0xff, 0xff,
  2552. 0xff, 0xff, 0xff, 0xff, 0xff,
  2553. 0xff, 0xff, 0xff, 0xff, 0xff,
  2554. 0xff, 0xff, 0xff, 0xff, 0xff,
  2555. 0xff, 0xff, 0xff, 0xff, 0xff,
  2556. 0xff, 0xff, 0xff, 0xff, 0xff,
  2557. 0xff, 0xff, 0xff, 0xff, 0xff,
  2558. 0xff, 0xff, 0xff, 0xff, 0xff,
  2559. 0xff, 0xff, 0xff, 0xff, 0xff,
  2560. 0xff, 0xff, 0xff, 0xff, 0xff,
  2561. 0xff, 0xff, 0xff, 0xff, 0xff,
  2562. 0xff, 0xff, 0xff, 0xff, 0xff,
  2563. 0xff, 0xff, 0xff, 0xff, 0xff,
  2564. 0xff, 0xff, 0xff, 0xff, 0xff,
  2565. 0xff, 0xff, 0xff, 0xff, 0xff,
  2566. 0xff, 0xff, 0xff, 0xff, 0xff,
  2567. 0xff, 0xff, 0xff, 0xff, 0xff,
  2568. 0xff, 0xff, 0xff, 0xff, 0xff,
  2569. 0xff, 0xff, 0xff, 0xff, 0xff,
  2570. 0xff, 0xff, 0xff, 0xff, 0xff,
  2571. 0xff, 0xff, 0xff, 0xff, 0xff,
  2572. 0xff, 0xff, 0xff, 0xff, 0xff,
  2573. 0xff, 0xff, 0xff, 0xff, 0xff,
  2574. 0xff, 0xff, 0xff, 0xff, 0xff,
  2575. 0xff, 0xff, 0xff, 0xff, 0xff,
  2576. 0xff, 0xff, 0xff, 0xff, 0xff,
  2577. 0xff, 0xff, 0xff, 0xff, 0xff,
  2578. 0xff, 0xff, 0xff, 0xff, 0xff,
  2579. 0xff, 0xff, 0xff, 0xff, 0xff,
  2580. 0xff, 0xff, 0xff, 0xff, 0xff,
  2581. 0xff, 0xff, 0xff, 0xff, 0xff,
  2582. 0xff, 0xff, 0xff, 0xff, 0xff,
  2583. 0xff, 0xff, 0xff, 0xff, 0xff,
  2584. 0xff, 0xff, 0xff, 0xff, 0xff,
  2585. 0xff, 0xff, 0xff, 0xff, 0xff,
  2586. 0xff, 0xff, 0xff, 0xff, 0xff,
  2587. 0xff, 0xff, 0xff, 0xff, 0xff,
  2588. 0xff, 0xff, 0xff, 0xff, 0xff,
  2589. 0xff, 0xff, 0xff, 0xff, 0xff,
  2590. 0xff, 0xff, 0xff, 0xff, 0xff,
  2591. 0xff, 0xff, 0xff, 0xff, 0xff,
  2592. 0xff, 0xff, 0xff, 0xff, 0xff,
  2593. 0xff, 0xff, 0xff, 0xff, 0xff,
  2594. 0xff, 0xff, 0xff, 0xff, 0xff,
  2595. 0xff, 0xff, 0xff),
  2596. raw_pdu(0x0c, 0x03, 0x00, 0xff, 0x01),
  2597. raw_pdu(0x0d, 0xff));
  2598. define_test_client("/TP/GAR/CL/BV-05-C", test_client, service_db_1,
  2599. &test_multiple_read_1,
  2600. SERVICE_DATA_1_PDUS,
  2601. raw_pdu(0x0e, 0x03, 0x00, 0x07, 0x00),
  2602. raw_pdu(0x0f, 0x01, 0x02, 0x03));
  2603. define_test_client("/TP/GAR/CL/BI-12-C", test_client, service_db_1,
  2604. &test_long_read_3,
  2605. SERVICE_DATA_1_PDUS,
  2606. raw_pdu(0x0a, 0x03, 0x00),
  2607. raw_pdu(0x01, 0x0a, 0x03, 0x00, 0x02));
  2608. define_test_client("/TP/GAR/CL/BI-13-C", test_client, service_db_1,
  2609. &test_long_read_4,
  2610. SERVICE_DATA_1_PDUS,
  2611. raw_pdu(0x0a, 0x03, 0x00),
  2612. raw_pdu(0x01, 0x0a, 0x03, 0x00, 0x07));
  2613. define_test_client("/TP/GAR/CL/BI-14-C", test_client, service_db_1,
  2614. &test_long_read_5,
  2615. SERVICE_DATA_1_PDUS,
  2616. raw_pdu(0x0a, 0x00, 0x00),
  2617. raw_pdu(0x01, 0x0a, 0x00, 0x00, 0x01));
  2618. define_test_client("/TP/GAR/CL/BI-15-C", test_client, service_db_1,
  2619. &test_long_read_6,
  2620. SERVICE_DATA_1_PDUS,
  2621. raw_pdu(0x0a, 0x03, 0x00),
  2622. raw_pdu(0x01, 0x0a, 0x03, 0x00, 0x08));
  2623. define_test_client("/TP/GAR/CL/BI-16-C", test_client, service_db_1,
  2624. &test_long_read_7,
  2625. SERVICE_DATA_1_PDUS,
  2626. raw_pdu(0x0a, 0x03, 0x00),
  2627. raw_pdu(0x01, 0x0a, 0x03, 0x00, 0x05));
  2628. define_test_client("/TP/GAR/CL/BI-16-C/auto", test_client, service_db_1,
  2629. &test_long_read_1,
  2630. SERVICE_DATA_1_PDUS,
  2631. raw_pdu(0x0a, 0x03, 0x00),
  2632. raw_pdu(0x01, 0x0a, 0x03, 0x00, 0x05),
  2633. raw_pdu(0x0a, 0x03, 0x00),
  2634. raw_pdu(0x0b, 0x01, 0x02, 0x03));
  2635. define_test_client("/TP/GAR/CL/BI-17-C", test_client, service_db_1,
  2636. &test_long_read_8,
  2637. SERVICE_DATA_1_PDUS,
  2638. raw_pdu(0x0a, 0x03, 0x00),
  2639. raw_pdu(0x01, 0x0a, 0x03, 0x00, 0x0c));
  2640. define_test_client("/TP/GAR/CL/BI-18-C", test_client, service_db_1,
  2641. &test_multiple_read_2,
  2642. SERVICE_DATA_1_PDUS,
  2643. raw_pdu(0x0e, 0x03, 0x00, 0x07, 0x00),
  2644. raw_pdu(0x01, 0x0e, 0x03, 0x00, 0x02));
  2645. define_test_client("/TP/GAR/CL/BI-19-C", test_client, service_db_1,
  2646. &test_multiple_read_3,
  2647. SERVICE_DATA_1_PDUS,
  2648. raw_pdu(0x0e, 0x03, 0x00, 0x07, 0x00),
  2649. raw_pdu(0x01, 0x0e, 0x03, 0x00, 0x01));
  2650. define_test_client("/TP/GAR/CL/BI-20-C", test_client, service_db_1,
  2651. &test_multiple_read_4,
  2652. SERVICE_DATA_1_PDUS,
  2653. raw_pdu(0x0e, 0x03, 0x00, 0x07, 0x00),
  2654. raw_pdu(0x01, 0x0e, 0x03, 0x00, 0x08));
  2655. define_test_client("/TP/GAR/CL/BI-21-C", test_client, service_db_1,
  2656. &test_multiple_read_5,
  2657. SERVICE_DATA_1_PDUS,
  2658. raw_pdu(0x0e, 0x03, 0x00, 0x07, 0x00),
  2659. raw_pdu(0x01, 0x0e, 0x03, 0x00, 0x05));
  2660. define_test_client("/TP/GAR/CL/BI-21-C/auto", test_client, service_db_1,
  2661. &test_multiple_read_1,
  2662. SERVICE_DATA_1_PDUS,
  2663. raw_pdu(0x0e, 0x03, 0x00, 0x07, 0x00),
  2664. raw_pdu(0x01, 0x0e, 0x03, 0x00, 0x05),
  2665. raw_pdu(0x0e, 0x03, 0x00, 0x07, 0x00),
  2666. raw_pdu(0x0f, 0x01, 0x02, 0x03));
  2667. define_test_client("/TP/GAR/CL/BI-22-C", test_client, service_db_1,
  2668. &test_multiple_read_6,
  2669. SERVICE_DATA_1_PDUS,
  2670. raw_pdu(0x0e, 0x03, 0x00, 0x07, 0x00),
  2671. raw_pdu(0x01, 0x0e, 0x03, 0x00, 0x0c));
  2672. define_test_server("/TP/GAR/SR/BV-05-C/small", test_server,
  2673. ts_small_db, NULL,
  2674. raw_pdu(0x03, 0x00, 0x02),
  2675. raw_pdu(0x0e, 0x15, 0xF0, 0x03, 0x00),
  2676. raw_pdu(0x0f, 0x09, 'B', 'l', 'u', 'e', 'Z'));
  2677. define_test_server("/TP/GAR/SR/BV-05-C/large-1", test_server,
  2678. ts_large_db_1, NULL,
  2679. raw_pdu(0x03, 0x00, 0x02),
  2680. raw_pdu(0x0e, 0x44, 0x00, 0x06, 0x00, 0xC4, 0x00),
  2681. raw_pdu(0x0f, 0x11, 0x0B, '1', '1', '1', '1', '1', '2',
  2682. '2', '2', '2', '2', '3', '3', '3', '3', '3',
  2683. '4', '4', '4', '4', '4'));
  2684. define_test_server("/TP/GAR/SR/BI-18-C/large-1", test_server,
  2685. ts_large_db_1, NULL,
  2686. raw_pdu(0x03, 0x00, 0x02),
  2687. raw_pdu(0x0e, 0x44, 0x00, 0x06, 0x00, 0x27, 0x00),
  2688. raw_pdu(0x01, 0x0e, 0x27, 0x00, 0x02));
  2689. define_test_server("/TP/GAR/SR/BI-19-C/small", test_server,
  2690. ts_small_db, NULL,
  2691. raw_pdu(0x03, 0x00, 0x02),
  2692. raw_pdu(0x0e, 0x15, 0xF0, 0xF0, 0x0F),
  2693. raw_pdu(0x01, 0x0e, 0xF0, 0x0F, 0x01));
  2694. define_test_server("/TP/GAR/SR/BI-19-C/large-1", test_server,
  2695. ts_large_db_1, NULL,
  2696. raw_pdu(0x03, 0x00, 0x02),
  2697. raw_pdu(0x0e, 0x44, 0x00, 0xF0, 0x0F),
  2698. raw_pdu(0x01, 0x0e, 0xF0, 0x0F, 0x01));
  2699. define_test_server("/TP/GAR/SR/BV-06-C/small", test_server,
  2700. ts_small_db, NULL,
  2701. raw_pdu(0x03, 0x00, 0x02),
  2702. raw_pdu(0x0A, 0x05, 0x00),
  2703. raw_pdu(0x0B, 'M', 'a', 'n', 'u', 'f', 'a', 'c', 't',
  2704. 'u', 'r', 'e', 'r', ' ', 'N', 'a', 'm', 'e'));
  2705. define_test_server("/TP/GAR/SR/BV-06-C/large-1", test_server,
  2706. ts_large_db_1, NULL,
  2707. raw_pdu(0x03, 0x00, 0x02),
  2708. raw_pdu(0x0A, 0xD4, 0x00),
  2709. raw_pdu(0x0B, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
  2710. 0x88, 0x99, 0x00, 0x12, 0x34, 0x56, 0x78, 0x90,
  2711. 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34));
  2712. define_test_server("/TP/GAR/SR/BI-23-C/large-1", test_server,
  2713. ts_large_db_1, NULL,
  2714. raw_pdu(0x03, 0x00, 0x02),
  2715. raw_pdu(0x0A, 0x96, 0x00),
  2716. raw_pdu(0x01, 0x0A, 0x96, 0x00, 0x02));
  2717. define_test_server("/TP/GAR/SR/BI-24-C/small", test_server,
  2718. ts_small_db, NULL,
  2719. raw_pdu(0x03, 0x00, 0x02),
  2720. raw_pdu(0x0A, 0xF0, 0x0F),
  2721. raw_pdu(0x01, 0x0A, 0xF0, 0x0F, 0x01));
  2722. define_test_server("/TP/GAR/SR/BI-24-C/large-1", test_server,
  2723. ts_large_db_1, NULL,
  2724. raw_pdu(0x03, 0x00, 0x02),
  2725. raw_pdu(0x0A, 0xF0, 0x0F),
  2726. raw_pdu(0x01, 0x0A, 0xF0, 0x0F, 0x01));
  2727. define_test_server("/TP/GAR/SR/BV-07-C/large-1", test_server,
  2728. ts_large_db_1, NULL,
  2729. raw_pdu(0x03, 0x00, 0x02),
  2730. raw_pdu(0x0C, 0xD1, 0x00, 0x00, 0x00),
  2731. raw_pdu(0x0D, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
  2732. 0x88, 0x99, 0x00, 0x12, 0x34, 0x56, 0x78, 0x90,
  2733. 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34),
  2734. raw_pdu(0x0C, 0xD1, 0x00, 0x16, 0x00),
  2735. raw_pdu(0x0D, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78,
  2736. 0x90, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
  2737. 0x88, 0x99, 0x00, 0x11, 0x22, 0x33, 0x44),
  2738. raw_pdu(0x0C, 0xD1, 0x00, 0x2C, 0x00),
  2739. raw_pdu(0x0D));
  2740. define_test_server("/TP/GAR/SR/BV-08-C/large-1", test_server,
  2741. ts_large_db_1, NULL,
  2742. raw_pdu(0x03, 0x00, 0x02),
  2743. raw_pdu(0x0C, 0xCE, 0x00, 0x00, 0x00),
  2744. raw_pdu(0x0D, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
  2745. 0x88, 0x99, 0x00, 0x12, 0x34, 0x56, 0x78, 0x90,
  2746. 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34),
  2747. raw_pdu(0x0C, 0xCE, 0x00, 0x16, 0x00),
  2748. raw_pdu(0x0D, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56, 0x78,
  2749. 0x90, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
  2750. 0x88, 0x99, 0x00, 0x11, 0x22, 0x33),
  2751. raw_pdu(0x0C, 0xCE, 0x00, 0x2B, 0x00),
  2752. raw_pdu(0x0D));
  2753. define_test_server("/TP/GAR/SR/BI-28-C/large-1", test_server,
  2754. ts_large_db_1, NULL,
  2755. raw_pdu(0x03, 0x00, 0x02),
  2756. raw_pdu(0x0C, 0x96, 0x00, 0x00, 0x00),
  2757. raw_pdu(0x01, 0x0C, 0x96, 0x00, 0x02));
  2758. define_test_server("/TP/GAR/SR/BI-29-C/small", test_server,
  2759. ts_small_db, NULL,
  2760. raw_pdu(0x03, 0x00, 0x02),
  2761. raw_pdu(0x0C, 0x05, 0x00, 0xF0, 0x00),
  2762. raw_pdu(0x01, 0x0C, 0x05, 0x00, 0x07));
  2763. define_test_server("/TP/GAR/SR/BI-29-C/large-1", test_server,
  2764. ts_large_db_1, NULL,
  2765. raw_pdu(0x03, 0x00, 0x02),
  2766. raw_pdu(0x0C, 0xCE, 0x00, 0xF0, 0x00),
  2767. raw_pdu(0x01, 0x0C, 0xCE, 0x00, 0x07));
  2768. define_test_server("/TP/GAR/SR/BI-30-C/small", test_server,
  2769. ts_small_db, NULL,
  2770. raw_pdu(0x03, 0x00, 0x02),
  2771. raw_pdu(0x0C, 0xF0, 0x0F, 0x00, 0x00),
  2772. raw_pdu(0x01, 0x0C, 0xF0, 0x0F, 0x01));
  2773. define_test_server("/TP/GAR/SR/BI-30-C/large-1", test_server,
  2774. ts_large_db_1, NULL,
  2775. raw_pdu(0x03, 0x00, 0x02),
  2776. raw_pdu(0x0C, 0xF0, 0x0F, 0x00, 0x00),
  2777. raw_pdu(0x01, 0x0C, 0xF0, 0x0F, 0x01));
  2778. define_test_client("/TP/GAN/CL/BV-01-C", test_client, ts_small_db,
  2779. &test_notification_1,
  2780. CLIENT_INIT_PDUS,
  2781. SMALL_DB_DISCOVERY_PDUS,
  2782. raw_pdu(0x12, 0x04, 0x00, 0x01, 0x00),
  2783. raw_pdu(0x13),
  2784. raw_pdu(),
  2785. raw_pdu(0x1B, 0x03, 0x00, 0x01, 0x02, 0x03));
  2786. define_test_server("/TP/GAN/SR/BV-01-C", test_server, ts_small_db,
  2787. &test_notification_server_1,
  2788. raw_pdu(0x03, 0x00, 0x02),
  2789. raw_pdu(0x12, 0x04, 0x00, 0x01, 0x00),
  2790. raw_pdu(0x13),
  2791. raw_pdu(),
  2792. raw_pdu(0x1B, 0x03, 0x00, 0x01, 0x02, 0x03));
  2793. define_test_server("/TP/GAI/SR/BV-01-C", test_server, ts_small_db,
  2794. &test_indication_server_1,
  2795. raw_pdu(0x03, 0x00, 0x02),
  2796. raw_pdu(0x12, 0x04, 0x00, 0x02, 0x00),
  2797. raw_pdu(0x13),
  2798. raw_pdu(),
  2799. raw_pdu(0x1D, 0x03, 0x00, 0x01, 0x02, 0x03),
  2800. raw_pdu(0x1E));
  2801. define_test_client("/TP/GAI/CL/BV-01-C", test_client, ts_small_db,
  2802. &test_indication_1,
  2803. CLIENT_INIT_PDUS,
  2804. SMALL_DB_DISCOVERY_PDUS,
  2805. raw_pdu(0x12, 0x09, 0x00, 0x02, 0x00),
  2806. raw_pdu(0x13),
  2807. raw_pdu(),
  2808. raw_pdu(0x1D, 0x03, 0x00, 0x01, 0x02, 0x03),
  2809. raw_pdu(0x1E));
  2810. define_test_client("/TP/GAR/CL/BV-06-C", test_client, service_db_1,
  2811. &test_read_7,
  2812. SERVICE_DATA_1_PDUS,
  2813. raw_pdu(0x0a, 0x04, 0x00),
  2814. raw_pdu(0x0b, 0x01, 0x02, 0x03));
  2815. define_test_client("/TP/GAR/CL/BI-23-C", test_client, service_db_1,
  2816. &test_read_8,
  2817. SERVICE_DATA_1_PDUS,
  2818. raw_pdu(0x0a, 0x04, 0x00),
  2819. raw_pdu(0x01, 0x0a, 0x04, 0x00, 0x02));
  2820. define_test_client("/TP/GAR/CL/BI-24-C", test_client, service_db_1,
  2821. &test_read_2,
  2822. SERVICE_DATA_1_PDUS,
  2823. raw_pdu(0x0a, 0x00, 0x00),
  2824. raw_pdu(0x01, 0x0a, 0x00, 0x00, 0x01));
  2825. define_test_client("/TP/GAR/CL/BI-25-C", test_client, service_db_1,
  2826. &test_read_9,
  2827. SERVICE_DATA_1_PDUS,
  2828. raw_pdu(0x0a, 0x04, 0x00),
  2829. raw_pdu(0x01, 0x0a, 0x04, 0x00, 0x08));
  2830. define_test_client("/TP/GAR/CL/BI-26-C", test_client, service_db_1,
  2831. &test_read_10,
  2832. SERVICE_DATA_1_PDUS,
  2833. raw_pdu(0x0a, 0x04, 0x00),
  2834. raw_pdu(0x01, 0x0a, 0x04, 0x00, 0x05));
  2835. define_test_client("/TP/GAR/CL/BI-26-C/auto", test_client, service_db_1,
  2836. &test_read_7,
  2837. SERVICE_DATA_1_PDUS,
  2838. raw_pdu(0x0a, 0x04, 0x00),
  2839. raw_pdu(0x01, 0x0a, 0x04, 0x00, 0x05),
  2840. raw_pdu(0x0a, 0x04, 0x00),
  2841. raw_pdu(0x0b, 0x01, 0x02, 0x03));
  2842. define_test_client("/TP/GAR/CL/BI-27-C", test_client, service_db_1,
  2843. &test_read_11,
  2844. SERVICE_DATA_1_PDUS,
  2845. raw_pdu(0x0a, 0x04, 0x00),
  2846. raw_pdu(0x01, 0x0a, 0x04, 0x00, 0x0c));
  2847. define_test_client("/TP/GAR/CL/BV-07-C", test_client, service_db_1,
  2848. &test_long_read_9,
  2849. SERVICE_DATA_1_PDUS,
  2850. raw_pdu(0x0a, 0x04, 0x00),
  2851. raw_pdu(0x0b, 0x01, 0x02, 0x03));
  2852. define_test_client("/TP/GAR/CL/BV-07-C/512B", test_client, service_db_1,
  2853. &test_long_read_10,
  2854. SERVICE_DATA_1_PDUS,
  2855. raw_pdu(0x0a, 0x04, 0x00),
  2856. raw_pdu(0x0b, 0xff, 0xff, 0xff, 0xff,
  2857. 0xff, 0xff, 0xff, 0xff, 0xff,
  2858. 0xff, 0xff, 0xff, 0xff, 0xff,
  2859. 0xff, 0xff, 0xff, 0xff, 0xff,
  2860. 0xff, 0xff, 0xff, 0xff, 0xff,
  2861. 0xff, 0xff, 0xff, 0xff, 0xff,
  2862. 0xff, 0xff, 0xff, 0xff, 0xff,
  2863. 0xff, 0xff, 0xff, 0xff, 0xff,
  2864. 0xff, 0xff, 0xff, 0xff, 0xff,
  2865. 0xff, 0xff, 0xff, 0xff, 0xff,
  2866. 0xff, 0xff, 0xff, 0xff, 0xff,
  2867. 0xff, 0xff, 0xff, 0xff, 0xff,
  2868. 0xff, 0xff, 0xff, 0xff, 0xff,
  2869. 0xff, 0xff, 0xff, 0xff, 0xff,
  2870. 0xff, 0xff, 0xff, 0xff, 0xff,
  2871. 0xff, 0xff, 0xff, 0xff, 0xff,
  2872. 0xff, 0xff, 0xff, 0xff, 0xff,
  2873. 0xff, 0xff, 0xff, 0xff, 0xff,
  2874. 0xff, 0xff, 0xff, 0xff, 0xff,
  2875. 0xff, 0xff, 0xff, 0xff, 0xff,
  2876. 0xff, 0xff, 0xff, 0xff, 0xff,
  2877. 0xff, 0xff, 0xff, 0xff, 0xff,
  2878. 0xff, 0xff, 0xff, 0xff, 0xff,
  2879. 0xff, 0xff, 0xff, 0xff, 0xff,
  2880. 0xff, 0xff, 0xff, 0xff, 0xff,
  2881. 0xff, 0xff, 0xff, 0xff, 0xff,
  2882. 0xff, 0xff, 0xff, 0xff, 0xff,
  2883. 0xff, 0xff, 0xff, 0xff, 0xff,
  2884. 0xff, 0xff, 0xff, 0xff, 0xff,
  2885. 0xff, 0xff, 0xff, 0xff, 0xff,
  2886. 0xff, 0xff, 0xff, 0xff, 0xff,
  2887. 0xff, 0xff, 0xff, 0xff, 0xff,
  2888. 0xff, 0xff, 0xff, 0xff, 0xff,
  2889. 0xff, 0xff, 0xff, 0xff, 0xff,
  2890. 0xff, 0xff, 0xff, 0xff, 0xff,
  2891. 0xff, 0xff, 0xff, 0xff, 0xff,
  2892. 0xff, 0xff, 0xff, 0xff, 0xff,
  2893. 0xff, 0xff, 0xff, 0xff, 0xff,
  2894. 0xff, 0xff, 0xff, 0xff, 0xff,
  2895. 0xff, 0xff, 0xff, 0xff, 0xff,
  2896. 0xff, 0xff, 0xff, 0xff, 0xff,
  2897. 0xff, 0xff, 0xff, 0xff, 0xff,
  2898. 0xff, 0xff, 0xff, 0xff, 0xff,
  2899. 0xff, 0xff, 0xff, 0xff, 0xff,
  2900. 0xff, 0xff, 0xff, 0xff, 0xff,
  2901. 0xff, 0xff, 0xff, 0xff, 0xff,
  2902. 0xff, 0xff, 0xff, 0xff, 0xff,
  2903. 0xff, 0xff, 0xff, 0xff, 0xff,
  2904. 0xff, 0xff, 0xff, 0xff, 0xff,
  2905. 0xff, 0xff, 0xff, 0xff, 0xff,
  2906. 0xff, 0xff, 0xff, 0xff, 0xff,
  2907. 0xff, 0xff, 0xff, 0xff, 0xff,
  2908. 0xff, 0xff, 0xff, 0xff, 0xff,
  2909. 0xff, 0xff, 0xff, 0xff, 0xff,
  2910. 0xff, 0xff, 0xff, 0xff, 0xff,
  2911. 0xff, 0xff, 0xff, 0xff, 0xff,
  2912. 0xff, 0xff, 0xff, 0xff, 0xff,
  2913. 0xff, 0xff, 0xff, 0xff, 0xff,
  2914. 0xff, 0xff, 0xff, 0xff, 0xff,
  2915. 0xff, 0xff, 0xff, 0xff, 0xff,
  2916. 0xff, 0xff, 0xff, 0xff, 0xff,
  2917. 0xff, 0xff, 0xff, 0xff, 0xff,
  2918. 0xff, 0xff, 0xff, 0xff, 0xff,
  2919. 0xff, 0xff, 0xff, 0xff, 0xff,
  2920. 0xff, 0xff, 0xff, 0xff, 0xff,
  2921. 0xff, 0xff, 0xff, 0xff, 0xff,
  2922. 0xff, 0xff, 0xff, 0xff, 0xff,
  2923. 0xff, 0xff, 0xff, 0xff, 0xff,
  2924. 0xff, 0xff, 0xff, 0xff, 0xff,
  2925. 0xff, 0xff, 0xff, 0xff, 0xff,
  2926. 0xff, 0xff, 0xff, 0xff, 0xff,
  2927. 0xff, 0xff, 0xff, 0xff, 0xff,
  2928. 0xff, 0xff, 0xff, 0xff, 0xff,
  2929. 0xff, 0xff, 0xff, 0xff, 0xff,
  2930. 0xff, 0xff, 0xff, 0xff, 0xff,
  2931. 0xff, 0xff, 0xff, 0xff, 0xff,
  2932. 0xff, 0xff, 0xff, 0xff, 0xff,
  2933. 0xff, 0xff, 0xff, 0xff, 0xff,
  2934. 0xff, 0xff, 0xff, 0xff, 0xff,
  2935. 0xff, 0xff, 0xff, 0xff, 0xff,
  2936. 0xff, 0xff, 0xff, 0xff, 0xff,
  2937. 0xff, 0xff, 0xff, 0xff, 0xff,
  2938. 0xff, 0xff, 0xff, 0xff, 0xff,
  2939. 0xff, 0xff, 0xff, 0xff, 0xff,
  2940. 0xff, 0xff, 0xff, 0xff, 0xff,
  2941. 0xff, 0xff, 0xff, 0xff, 0xff,
  2942. 0xff, 0xff, 0xff, 0xff, 0xff,
  2943. 0xff, 0xff, 0xff, 0xff, 0xff,
  2944. 0xff, 0xff, 0xff, 0xff, 0xff,
  2945. 0xff, 0xff, 0xff, 0xff, 0xff,
  2946. 0xff, 0xff, 0xff, 0xff, 0xff,
  2947. 0xff, 0xff, 0xff, 0xff, 0xff,
  2948. 0xff, 0xff, 0xff, 0xff, 0xff,
  2949. 0xff, 0xff, 0xff, 0xff, 0xff,
  2950. 0xff, 0xff, 0xff, 0xff, 0xff,
  2951. 0xff, 0xff, 0xff, 0xff, 0xff,
  2952. 0xff, 0xff, 0xff, 0xff, 0xff,
  2953. 0xff, 0xff, 0xff, 0xff, 0xff,
  2954. 0xff, 0xff, 0xff, 0xff, 0xff,
  2955. 0xff, 0xff, 0xff, 0xff, 0xff,
  2956. 0xff, 0xff, 0xff, 0xff, 0xff,
  2957. 0xff, 0xff, 0xff, 0xff, 0xff,
  2958. 0xff, 0xff, 0xff),
  2959. raw_pdu(0x0c, 0x04, 0x00, 0xff, 0x01),
  2960. raw_pdu(0x0d, 0xff));
  2961. define_test_client("/TP/GAR/CL/BI-28-C", test_client, service_db_1,
  2962. &test_long_read_11,
  2963. SERVICE_DATA_1_PDUS,
  2964. raw_pdu(0x0a, 0x04, 0x00),
  2965. raw_pdu(0x01, 0x0a, 0x04, 0x00, 0x02));
  2966. define_test_client("/TP/GAR/CL/BI-29-C", test_client, service_db_1,
  2967. &test_long_read_12,
  2968. SERVICE_DATA_1_PDUS,
  2969. raw_pdu(0x0a, 0x04, 0x00),
  2970. raw_pdu(0x01, 0x0a, 0x04, 0x00, 0x07));
  2971. define_test_client("/TP/GAR/CL/BI-30-C", test_client, service_db_1,
  2972. &test_long_read_5,
  2973. SERVICE_DATA_1_PDUS,
  2974. raw_pdu(0x0a, 0x00, 0x00),
  2975. raw_pdu(0x01, 0x0a, 0x00, 0x00, 0x01));
  2976. define_test_client("/TP/GAR/CL/BI-31-C", test_client, service_db_1,
  2977. &test_long_read_13,
  2978. SERVICE_DATA_1_PDUS,
  2979. raw_pdu(0x0a, 0x04, 0x00),
  2980. raw_pdu(0x01, 0x0a, 0x04, 0x00, 0x08));
  2981. define_test_client("/TP/GAR/CL/BI-32-C", test_client, service_db_1,
  2982. &test_long_read_14,
  2983. SERVICE_DATA_1_PDUS,
  2984. raw_pdu(0x0a, 0x04, 0x00),
  2985. raw_pdu(0x01, 0x0a, 0x04, 0x00, 0x05));
  2986. define_test_client("/TP/GAR/CL/BI-32-C/auto", test_client, service_db_1,
  2987. &test_long_read_9,
  2988. SERVICE_DATA_1_PDUS,
  2989. raw_pdu(0x0a, 0x04, 0x00),
  2990. raw_pdu(0x01, 0x0a, 0x04, 0x00, 0x05),
  2991. raw_pdu(0x0a, 0x04, 0x00),
  2992. raw_pdu(0x0b, 0x01, 0x02, 0x03));
  2993. define_test_client("/TP/GAR/CL/BI-33-C", test_client, service_db_1,
  2994. &test_long_read_15,
  2995. SERVICE_DATA_1_PDUS,
  2996. raw_pdu(0x0a, 0x04, 0x00),
  2997. raw_pdu(0x01, 0x0a, 0x04, 0x00, 0x0c));
  2998. define_test_client("/TP/GAR/CL/BI-34-C", test_client, service_db_1,
  2999. &test_read_12,
  3000. SERVICE_DATA_1_PDUS,
  3001. raw_pdu(0x0a, 0x03, 0x00),
  3002. raw_pdu(0x01, 0x0a, 0x03, 0x00, 0x80));
  3003. define_test_client("/TP/GAR/CL/BI-35-C", test_client, service_db_1,
  3004. &test_read_12,
  3005. SERVICE_DATA_1_PDUS,
  3006. raw_pdu(0x0a, 0x03, 0x00),
  3007. raw_pdu(0x01, 0x0a, 0x03, 0x00, 0x80));
  3008. define_test_client("/TP/GAW/CL/BV-01-C", test_client, service_db_1,
  3009. &test_write_without_response_1,
  3010. SERVICE_DATA_1_PDUS,
  3011. raw_pdu(0x52, 0x07, 0x00, 0x01, 0x02, 0x03));
  3012. define_test_client("/TP/GAW/CL/BV-02-C", test_client, service_db_1,
  3013. &test_signed_write_1,
  3014. SERVICE_DATA_1_PDUS,
  3015. raw_pdu(0xd2, 0x07, 0x00, 0x01, 0x02, 0x03, 0x00, 0x00,
  3016. 0x00, 0x00, 0x31, 0x1f, 0x0a, 0xcd, 0x1c, 0x3a,
  3017. 0x5b, 0x0a));
  3018. define_test_client("/TP/GAW/CL/BV-02-C/seclevel", test_client,
  3019. service_db_1, &test_signed_write_seclevel_1,
  3020. SERVICE_DATA_1_PDUS,
  3021. raw_pdu(0x52, 0x07, 0x00, 0x01, 0x02, 0x03));
  3022. define_test_client("/TP/GAW/CL/BV-03-C", test_client, service_db_1,
  3023. &test_write_1,
  3024. SERVICE_DATA_1_PDUS,
  3025. raw_pdu(0x12, 0x07, 0x00, 0x01, 0x02, 0x03),
  3026. raw_pdu(0x13));
  3027. define_test_client("/TP/GAW/CL/BI-02-C", test_client, service_db_1,
  3028. &test_write_2,
  3029. SERVICE_DATA_1_PDUS,
  3030. raw_pdu(0x12, 0x00, 0x00, 0x01, 0x02, 0x03),
  3031. raw_pdu(0x01, 0x12, 0x00, 0x00, 0x01));
  3032. define_test_client("/TP/GAW/CL/BI-03-C", test_client, service_db_1,
  3033. &test_write_3,
  3034. SERVICE_DATA_1_PDUS,
  3035. raw_pdu(0x12, 0x07, 0x00, 0x01, 0x02, 0x03),
  3036. raw_pdu(0x01, 0x12, 0x07, 0x00, 0x03));
  3037. define_test_client("/TP/GAW/CL/BI-04-C", test_client, service_db_1,
  3038. &test_write_4,
  3039. SERVICE_DATA_1_PDUS,
  3040. raw_pdu(0x12, 0x07, 0x00, 0x01, 0x02, 0x03),
  3041. raw_pdu(0x01, 0x12, 0x07, 0x00, 0x08));
  3042. define_test_client("/TP/GAW/CL/BI-05-C", test_client, service_db_1,
  3043. &test_write_5,
  3044. SERVICE_DATA_1_PDUS,
  3045. raw_pdu(0x12, 0x07, 0x00, 0x01, 0x02, 0x03),
  3046. raw_pdu(0x01, 0x12, 0x07, 0x00, 0x05));
  3047. define_test_client("/TP/GAW/CL/BI-05-C/auto", test_client, service_db_1,
  3048. &test_write_1,
  3049. SERVICE_DATA_1_PDUS,
  3050. raw_pdu(0x12, 0x07, 0x00, 0x01, 0x02, 0x03),
  3051. raw_pdu(0x01, 0x12, 0x07, 0x00, 0x05),
  3052. raw_pdu(0x12, 0x07, 0x00, 0x01, 0x02, 0x03),
  3053. raw_pdu(0x13));
  3054. define_test_client("/TP/GAW/CL/BI-06-C", test_client, service_db_1,
  3055. &test_write_6,
  3056. SERVICE_DATA_1_PDUS,
  3057. raw_pdu(0x12, 0x07, 0x00, 0x01, 0x02, 0x03),
  3058. raw_pdu(0x01, 0x12, 0x07, 0x00, 0x0c));
  3059. define_test_server("/TP/GAW/SR/BV-07-C/small", test_server,
  3060. ts_small_db, NULL,
  3061. raw_pdu(0x03, 0x00, 0x02),
  3062. raw_pdu(0x16, 0x03, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3063. raw_pdu(0x17, 0x03, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3064. raw_pdu(0x18, 0x00),
  3065. raw_pdu(0x19),
  3066. raw_pdu(0x0a, 0x03, 0x00),
  3067. raw_pdu(0x0b, 0x42, 0x6c, 0x75, 0x65, 0x5a));
  3068. define_test_server("/TP/GAW/SR/BV-07-C/large-1", test_server,
  3069. ts_large_db_1, NULL,
  3070. raw_pdu(0x03, 0x00, 0x02),
  3071. raw_pdu(0x16, 0xc4, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3072. raw_pdu(0x17, 0xc4, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3073. raw_pdu(0x18, 0x00),
  3074. raw_pdu(0x19),
  3075. raw_pdu(0x0a, 0xc4, 0x00),
  3076. raw_pdu(0x0b, '1', '1', '1', '1', '1', '2', '2', '2',
  3077. '2', '2', '3', '3', '3', '3', '3', '4', '4',
  3078. '4', '4', '4', '5'));
  3079. define_test_server("/TP/GAW/SR/BV-03-C/small", test_server,
  3080. ts_small_db, NULL,
  3081. raw_pdu(0x03, 0x00, 0x02),
  3082. raw_pdu(0x12, 0x03, 0x00, 0x01, 0x02, 0x03),
  3083. raw_pdu(0x13));
  3084. define_test_server("/TP/GAW/SR/BV-03-C/large-1", test_server,
  3085. ts_large_db_1, NULL,
  3086. raw_pdu(0x03, 0x00, 0x02),
  3087. raw_pdu(0x12, 0x82, 0x00, 0x01, 0x02, 0x03),
  3088. raw_pdu(0x13));
  3089. define_test_server("/TP/GAW/SR/BI-02-C/small", test_server,
  3090. ts_small_db, NULL,
  3091. raw_pdu(0x03, 0x00, 0x02),
  3092. raw_pdu(0x12, 0x00, 0x00, 0x01, 0x02, 0x03),
  3093. raw_pdu(0x01, 0x12, 0x00, 0x00, 0x01));
  3094. define_test_server("/TP/GAW/SR/BI-02-C/large-1", test_server,
  3095. ts_large_db_1, NULL,
  3096. raw_pdu(0x03, 0x00, 0x02),
  3097. raw_pdu(0x12, 0x0f, 0xf0, 0x01, 0x02, 0x03),
  3098. raw_pdu(0x01, 0x12, 0x0f, 0xf0, 0x01));
  3099. define_test_server("/TP/GAW/SR/BI-03-C/small", test_server,
  3100. ts_small_db, NULL,
  3101. raw_pdu(0x03, 0x00, 0x02),
  3102. raw_pdu(0x12, 0x13, 0xf0, 0x01, 0x02, 0x03),
  3103. raw_pdu(0x01, 0x12, 0x13, 0xf0, 0x03));
  3104. define_test_server("/TP/GAW/SR/BI-03-C/large-1", test_server,
  3105. ts_large_db_1, NULL,
  3106. raw_pdu(0x03, 0x00, 0x02),
  3107. raw_pdu(0x12, 0x04, 0x00, 0x01, 0x02, 0x03),
  3108. raw_pdu(0x01, 0x12, 0x04, 0x00, 0x03));
  3109. define_test_client("/TP/GAW/CL/BV-05-C", test_client, service_db_1,
  3110. &test_long_write_1,
  3111. SERVICE_DATA_1_PDUS,
  3112. raw_pdu(0x16, 0x07, 0x00, 0x00, 0x00,
  3113. 0xff, 0xff, 0xff, 0xff, 0xff,
  3114. 0xff, 0xff, 0xff, 0xff, 0xff,
  3115. 0xff, 0xff, 0xff, 0xff, 0xff,
  3116. 0xff, 0xff, 0xff, 0xff, 0xff,
  3117. 0xff, 0xff, 0xff, 0xff, 0xff,
  3118. 0xff, 0xff, 0xff, 0xff, 0xff,
  3119. 0xff, 0xff, 0xff, 0xff, 0xff,
  3120. 0xff, 0xff, 0xff, 0xff, 0xff,
  3121. 0xff, 0xff, 0xff, 0xff, 0xff,
  3122. 0xff, 0xff, 0xff, 0xff, 0xff,
  3123. 0xff, 0xff, 0xff, 0xff, 0xff,
  3124. 0xff, 0xff, 0xff, 0xff, 0xff,
  3125. 0xff, 0xff, 0xff, 0xff, 0xff,
  3126. 0xff, 0xff, 0xff, 0xff, 0xff,
  3127. 0xff, 0xff, 0xff, 0xff, 0xff,
  3128. 0xff, 0xff, 0xff, 0xff, 0xff,
  3129. 0xff, 0xff, 0xff, 0xff, 0xff,
  3130. 0xff, 0xff, 0xff, 0xff, 0xff,
  3131. 0xff, 0xff, 0xff, 0xff, 0xff,
  3132. 0xff, 0xff, 0xff, 0xff, 0xff,
  3133. 0xff, 0xff, 0xff, 0xff, 0xff,
  3134. 0xff, 0xff, 0xff, 0xff, 0xff,
  3135. 0xff, 0xff, 0xff, 0xff, 0xff,
  3136. 0xff, 0xff, 0xff, 0xff, 0xff,
  3137. 0xff, 0xff, 0xff, 0xff, 0xff,
  3138. 0xff, 0xff, 0xff, 0xff, 0xff,
  3139. 0xff, 0xff, 0xff, 0xff, 0xff,
  3140. 0xff, 0xff, 0xff, 0xff, 0xff,
  3141. 0xff, 0xff, 0xff, 0xff, 0xff,
  3142. 0xff, 0xff, 0xff, 0xff, 0xff,
  3143. 0xff, 0xff, 0xff, 0xff, 0xff,
  3144. 0xff, 0xff, 0xff, 0xff, 0xff,
  3145. 0xff, 0xff, 0xff, 0xff, 0xff,
  3146. 0xff, 0xff, 0xff, 0xff, 0xff,
  3147. 0xff, 0xff, 0xff, 0xff, 0xff,
  3148. 0xff, 0xff, 0xff, 0xff, 0xff,
  3149. 0xff, 0xff, 0xff, 0xff, 0xff,
  3150. 0xff, 0xff, 0xff, 0xff, 0xff,
  3151. 0xff, 0xff, 0xff, 0xff, 0xff,
  3152. 0xff, 0xff, 0xff, 0xff, 0xff,
  3153. 0xff, 0xff, 0xff, 0xff, 0xff,
  3154. 0xff, 0xff, 0xff, 0xff, 0xff,
  3155. 0xff, 0xff, 0xff, 0xff, 0xff,
  3156. 0xff, 0xff, 0xff, 0xff, 0xff,
  3157. 0xff, 0xff, 0xff, 0xff, 0xff,
  3158. 0xff, 0xff, 0xff, 0xff, 0xff,
  3159. 0xff, 0xff, 0xff, 0xff, 0xff,
  3160. 0xff, 0xff, 0xff, 0xff, 0xff,
  3161. 0xff, 0xff, 0xff, 0xff, 0xff,
  3162. 0xff, 0xff, 0xff, 0xff, 0xff,
  3163. 0xff, 0xff, 0xff, 0xff, 0xff,
  3164. 0xff, 0xff, 0xff, 0xff, 0xff,
  3165. 0xff, 0xff, 0xff, 0xff, 0xff,
  3166. 0xff, 0xff, 0xff, 0xff, 0xff,
  3167. 0xff, 0xff, 0xff, 0xff, 0xff,
  3168. 0xff, 0xff, 0xff, 0xff, 0xff,
  3169. 0xff, 0xff, 0xff, 0xff, 0xff,
  3170. 0xff, 0xff, 0xff, 0xff, 0xff,
  3171. 0xff, 0xff, 0xff, 0xff, 0xff,
  3172. 0xff, 0xff, 0xff, 0xff, 0xff,
  3173. 0xff, 0xff, 0xff, 0xff, 0xff,
  3174. 0xff, 0xff, 0xff, 0xff, 0xff,
  3175. 0xff, 0xff, 0xff, 0xff, 0xff,
  3176. 0xff, 0xff, 0xff, 0xff, 0xff,
  3177. 0xff, 0xff, 0xff, 0xff, 0xff,
  3178. 0xff, 0xff, 0xff, 0xff, 0xff,
  3179. 0xff, 0xff, 0xff, 0xff, 0xff,
  3180. 0xff, 0xff, 0xff, 0xff, 0xff,
  3181. 0xff, 0xff, 0xff, 0xff, 0xff,
  3182. 0xff, 0xff, 0xff, 0xff, 0xff,
  3183. 0xff, 0xff, 0xff, 0xff, 0xff,
  3184. 0xff, 0xff, 0xff, 0xff, 0xff,
  3185. 0xff, 0xff, 0xff, 0xff, 0xff,
  3186. 0xff, 0xff, 0xff, 0xff, 0xff,
  3187. 0xff, 0xff, 0xff, 0xff, 0xff,
  3188. 0xff, 0xff, 0xff, 0xff, 0xff,
  3189. 0xff, 0xff, 0xff, 0xff, 0xff,
  3190. 0xff, 0xff, 0xff, 0xff, 0xff,
  3191. 0xff, 0xff, 0xff, 0xff, 0xff,
  3192. 0xff, 0xff, 0xff, 0xff, 0xff,
  3193. 0xff, 0xff, 0xff, 0xff, 0xff,
  3194. 0xff, 0xff, 0xff, 0xff, 0xff,
  3195. 0xff, 0xff, 0xff, 0xff, 0xff,
  3196. 0xff, 0xff, 0xff, 0xff, 0xff,
  3197. 0xff, 0xff, 0xff, 0xff, 0xff,
  3198. 0xff, 0xff, 0xff, 0xff, 0xff,
  3199. 0xff, 0xff, 0xff, 0xff, 0xff,
  3200. 0xff, 0xff, 0xff, 0xff, 0xff,
  3201. 0xff, 0xff, 0xff, 0xff, 0xff,
  3202. 0xff, 0xff, 0xff, 0xff, 0xff,
  3203. 0xff, 0xff, 0xff, 0xff, 0xff,
  3204. 0xff, 0xff, 0xff, 0xff, 0xff,
  3205. 0xff, 0xff, 0xff, 0xff, 0xff,
  3206. 0xff, 0xff, 0xff, 0xff, 0xff,
  3207. 0xff, 0xff, 0xff, 0xff, 0xff,
  3208. 0xff, 0xff, 0xff, 0xff, 0xff,
  3209. 0xff, 0xff, 0xff, 0xff, 0xff,
  3210. 0xff, 0xff, 0xff, 0xff, 0xff,
  3211. 0xff, 0xff, 0xff, 0xff, 0xff,
  3212. 0xff, 0xff, 0xff, 0xff, 0xff,
  3213. 0xff, 0xff, 0xff, 0xff, 0xff,
  3214. 0xff, 0xff),
  3215. raw_pdu(0x17, 0x07, 0x00, 0x00, 0x00,
  3216. 0xff, 0xff, 0xff, 0xff, 0xff,
  3217. 0xff, 0xff, 0xff, 0xff, 0xff,
  3218. 0xff, 0xff, 0xff, 0xff, 0xff,
  3219. 0xff, 0xff, 0xff, 0xff, 0xff,
  3220. 0xff, 0xff, 0xff, 0xff, 0xff,
  3221. 0xff, 0xff, 0xff, 0xff, 0xff,
  3222. 0xff, 0xff, 0xff, 0xff, 0xff,
  3223. 0xff, 0xff, 0xff, 0xff, 0xff,
  3224. 0xff, 0xff, 0xff, 0xff, 0xff,
  3225. 0xff, 0xff, 0xff, 0xff, 0xff,
  3226. 0xff, 0xff, 0xff, 0xff, 0xff,
  3227. 0xff, 0xff, 0xff, 0xff, 0xff,
  3228. 0xff, 0xff, 0xff, 0xff, 0xff,
  3229. 0xff, 0xff, 0xff, 0xff, 0xff,
  3230. 0xff, 0xff, 0xff, 0xff, 0xff,
  3231. 0xff, 0xff, 0xff, 0xff, 0xff,
  3232. 0xff, 0xff, 0xff, 0xff, 0xff,
  3233. 0xff, 0xff, 0xff, 0xff, 0xff,
  3234. 0xff, 0xff, 0xff, 0xff, 0xff,
  3235. 0xff, 0xff, 0xff, 0xff, 0xff,
  3236. 0xff, 0xff, 0xff, 0xff, 0xff,
  3237. 0xff, 0xff, 0xff, 0xff, 0xff,
  3238. 0xff, 0xff, 0xff, 0xff, 0xff,
  3239. 0xff, 0xff, 0xff, 0xff, 0xff,
  3240. 0xff, 0xff, 0xff, 0xff, 0xff,
  3241. 0xff, 0xff, 0xff, 0xff, 0xff,
  3242. 0xff, 0xff, 0xff, 0xff, 0xff,
  3243. 0xff, 0xff, 0xff, 0xff, 0xff,
  3244. 0xff, 0xff, 0xff, 0xff, 0xff,
  3245. 0xff, 0xff, 0xff, 0xff, 0xff,
  3246. 0xff, 0xff, 0xff, 0xff, 0xff,
  3247. 0xff, 0xff, 0xff, 0xff, 0xff,
  3248. 0xff, 0xff, 0xff, 0xff, 0xff,
  3249. 0xff, 0xff, 0xff, 0xff, 0xff,
  3250. 0xff, 0xff, 0xff, 0xff, 0xff,
  3251. 0xff, 0xff, 0xff, 0xff, 0xff,
  3252. 0xff, 0xff, 0xff, 0xff, 0xff,
  3253. 0xff, 0xff, 0xff, 0xff, 0xff,
  3254. 0xff, 0xff, 0xff, 0xff, 0xff,
  3255. 0xff, 0xff, 0xff, 0xff, 0xff,
  3256. 0xff, 0xff, 0xff, 0xff, 0xff,
  3257. 0xff, 0xff, 0xff, 0xff, 0xff,
  3258. 0xff, 0xff, 0xff, 0xff, 0xff,
  3259. 0xff, 0xff, 0xff, 0xff, 0xff,
  3260. 0xff, 0xff, 0xff, 0xff, 0xff,
  3261. 0xff, 0xff, 0xff, 0xff, 0xff,
  3262. 0xff, 0xff, 0xff, 0xff, 0xff,
  3263. 0xff, 0xff, 0xff, 0xff, 0xff,
  3264. 0xff, 0xff, 0xff, 0xff, 0xff,
  3265. 0xff, 0xff, 0xff, 0xff, 0xff,
  3266. 0xff, 0xff, 0xff, 0xff, 0xff,
  3267. 0xff, 0xff, 0xff, 0xff, 0xff,
  3268. 0xff, 0xff, 0xff, 0xff, 0xff,
  3269. 0xff, 0xff, 0xff, 0xff, 0xff,
  3270. 0xff, 0xff, 0xff, 0xff, 0xff,
  3271. 0xff, 0xff, 0xff, 0xff, 0xff,
  3272. 0xff, 0xff, 0xff, 0xff, 0xff,
  3273. 0xff, 0xff, 0xff, 0xff, 0xff,
  3274. 0xff, 0xff, 0xff, 0xff, 0xff,
  3275. 0xff, 0xff, 0xff, 0xff, 0xff,
  3276. 0xff, 0xff, 0xff, 0xff, 0xff,
  3277. 0xff, 0xff, 0xff, 0xff, 0xff,
  3278. 0xff, 0xff, 0xff, 0xff, 0xff,
  3279. 0xff, 0xff, 0xff, 0xff, 0xff,
  3280. 0xff, 0xff, 0xff, 0xff, 0xff,
  3281. 0xff, 0xff, 0xff, 0xff, 0xff,
  3282. 0xff, 0xff, 0xff, 0xff, 0xff,
  3283. 0xff, 0xff, 0xff, 0xff, 0xff,
  3284. 0xff, 0xff, 0xff, 0xff, 0xff,
  3285. 0xff, 0xff, 0xff, 0xff, 0xff,
  3286. 0xff, 0xff, 0xff, 0xff, 0xff,
  3287. 0xff, 0xff, 0xff, 0xff, 0xff,
  3288. 0xff, 0xff, 0xff, 0xff, 0xff,
  3289. 0xff, 0xff, 0xff, 0xff, 0xff,
  3290. 0xff, 0xff, 0xff, 0xff, 0xff,
  3291. 0xff, 0xff, 0xff, 0xff, 0xff,
  3292. 0xff, 0xff, 0xff, 0xff, 0xff,
  3293. 0xff, 0xff, 0xff, 0xff, 0xff,
  3294. 0xff, 0xff, 0xff, 0xff, 0xff,
  3295. 0xff, 0xff, 0xff, 0xff, 0xff,
  3296. 0xff, 0xff, 0xff, 0xff, 0xff,
  3297. 0xff, 0xff, 0xff, 0xff, 0xff,
  3298. 0xff, 0xff, 0xff, 0xff, 0xff,
  3299. 0xff, 0xff, 0xff, 0xff, 0xff,
  3300. 0xff, 0xff, 0xff, 0xff, 0xff,
  3301. 0xff, 0xff, 0xff, 0xff, 0xff,
  3302. 0xff, 0xff, 0xff, 0xff, 0xff,
  3303. 0xff, 0xff, 0xff, 0xff, 0xff,
  3304. 0xff, 0xff, 0xff, 0xff, 0xff,
  3305. 0xff, 0xff, 0xff, 0xff, 0xff,
  3306. 0xff, 0xff, 0xff, 0xff, 0xff,
  3307. 0xff, 0xff, 0xff, 0xff, 0xff,
  3308. 0xff, 0xff, 0xff, 0xff, 0xff,
  3309. 0xff, 0xff, 0xff, 0xff, 0xff,
  3310. 0xff, 0xff, 0xff, 0xff, 0xff,
  3311. 0xff, 0xff, 0xff, 0xff, 0xff,
  3312. 0xff, 0xff, 0xff, 0xff, 0xff,
  3313. 0xff, 0xff, 0xff, 0xff, 0xff,
  3314. 0xff, 0xff, 0xff, 0xff, 0xff,
  3315. 0xff, 0xff, 0xff, 0xff, 0xff,
  3316. 0xff, 0xff, 0xff, 0xff, 0xff,
  3317. 0xff, 0xff),
  3318. raw_pdu(0x16, 0x07, 0x00, 0xfb, 0x01,
  3319. 0xff, 0xff, 0xff, 0xff, 0xff),
  3320. raw_pdu(0x17, 0x07, 0x00, 0xfb, 0x01,
  3321. 0xff, 0xff, 0xff, 0xff, 0xff),
  3322. raw_pdu(0x18, 0x01),
  3323. raw_pdu(0x19));
  3324. define_test_client("/TP/GAW/CL/BI-07-C", test_client, service_db_1,
  3325. &test_long_write_2,
  3326. SERVICE_DATA_1_PDUS,
  3327. raw_pdu(0x16, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3328. raw_pdu(0x01, 0x16, 0x00, 0x00, 0x01),
  3329. raw_pdu(0x18, 0x00),
  3330. raw_pdu(0x19));
  3331. define_test_client("/TP/GAW/CL/BI-08-C", test_client, service_db_1,
  3332. &test_long_write_3,
  3333. SERVICE_DATA_1_PDUS,
  3334. raw_pdu(0x16, 0x03, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3335. raw_pdu(0x01, 0x16, 0x03, 0x00, 0x03),
  3336. raw_pdu(0x18, 0x00),
  3337. raw_pdu(0x19));
  3338. define_test_client("/TP/GAW/CL/BI-11-C", test_client, service_db_1,
  3339. &test_long_write_4,
  3340. SERVICE_DATA_1_PDUS,
  3341. raw_pdu(0x16, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3342. raw_pdu(0x01, 0x16, 0x07, 0x00, 0x08),
  3343. raw_pdu(0x18, 0x00),
  3344. raw_pdu(0x19));
  3345. define_test_client("/TP/GAW/CL/BI-12-C", test_client, service_db_1,
  3346. &test_long_write_5,
  3347. SERVICE_DATA_1_PDUS,
  3348. raw_pdu(0x16, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3349. raw_pdu(0x01, 0x16, 0x07, 0x00, 0x05),
  3350. raw_pdu(0x18, 0x00),
  3351. raw_pdu(0x19));
  3352. define_test_client("/TP/GAW/CL/BI-13-C", test_client, service_db_1,
  3353. &test_long_write_6,
  3354. SERVICE_DATA_1_PDUS,
  3355. raw_pdu(0x16, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3356. raw_pdu(0x01, 0x16, 0x07, 0x00, 0x0c),
  3357. raw_pdu(0x18, 0x00),
  3358. raw_pdu(0x19));
  3359. define_test_server("/TP/GAW/SR/BV-05-C/small", test_server,
  3360. ts_small_db, NULL,
  3361. raw_pdu(0x03, 0x00, 0x02),
  3362. raw_pdu(0x16, 0x03, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
  3363. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  3364. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
  3365. raw_pdu(0x17, 0x03, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
  3366. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  3367. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
  3368. raw_pdu(0x16, 0x03, 0x00, 0x12, 0x00, 0xff),
  3369. raw_pdu(0x17, 0x03, 0x00, 0x12, 0x00, 0xff),
  3370. raw_pdu(0x18, 0x01),
  3371. raw_pdu(0x19));
  3372. define_test_server("/TP/GAW/SR/BV-05-C/large-1", test_server,
  3373. ts_large_db_1, NULL,
  3374. raw_pdu(0x03, 0x00, 0x02),
  3375. raw_pdu(0x16, 0x82, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
  3376. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  3377. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
  3378. raw_pdu(0x17, 0x82, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
  3379. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  3380. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
  3381. raw_pdu(0x16, 0x82, 0x00, 0x12, 0x00, 0xff),
  3382. raw_pdu(0x17, 0x82, 0x00, 0x12, 0x00, 0xff),
  3383. raw_pdu(0x18, 0x01),
  3384. raw_pdu(0x19));
  3385. define_test_server("/TP/GAW/SR/BI-07-C/small", test_server,
  3386. ts_small_db, NULL,
  3387. raw_pdu(0x03, 0x00, 0x02),
  3388. raw_pdu(0x16, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
  3389. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  3390. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
  3391. raw_pdu(0x01, 0x16, 0x00, 0x00, 0x01));
  3392. define_test_server("/TP/GAW/SR/BI-07-C/large-1", test_server,
  3393. ts_large_db_1, NULL,
  3394. raw_pdu(0x03, 0x00, 0x02),
  3395. raw_pdu(0x16, 0x0f, 0xf0, 0x00, 0x00, 0xff, 0xff, 0xff,
  3396. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  3397. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
  3398. raw_pdu(0x01, 0x16, 0x0f, 0xf0, 0x01));
  3399. define_test_server("/TP/GAW/SR/BI-08-C/small", test_server,
  3400. ts_small_db, NULL,
  3401. raw_pdu(0x03, 0x00, 0x02),
  3402. raw_pdu(0x16, 0x05, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
  3403. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  3404. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
  3405. raw_pdu(0x01, 0x16, 0x05, 0x00, 0x03));
  3406. define_test_server("/TP/GAW/SR/BI-08-C/large-1", test_server,
  3407. ts_large_db_1, NULL,
  3408. raw_pdu(0x03, 0x00, 0x02),
  3409. raw_pdu(0x16, 0x73, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
  3410. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  3411. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
  3412. raw_pdu(0x01, 0x16, 0x73, 0x00, 0x03));
  3413. define_test_client("/TP/GAW/CL/BV-06-C", test_client, service_db_1,
  3414. &test_reliable_write_1,
  3415. SERVICE_DATA_1_PDUS,
  3416. raw_pdu(0x16, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3417. raw_pdu(0x17, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3418. raw_pdu(0x18, 0x01),
  3419. raw_pdu(0x19));
  3420. define_test_client("/TP/GAW/CL/BI-14-C", test_client, service_db_1,
  3421. &test_reliable_write_2,
  3422. SERVICE_DATA_1_PDUS,
  3423. raw_pdu(0x16, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3424. raw_pdu(0x01, 0x16, 0x00, 0x00, 0x01),
  3425. raw_pdu(0x18, 0x00),
  3426. raw_pdu(0x19));
  3427. define_test_client("/TP/GAW/CL/BI-15-C", test_client, service_db_1,
  3428. &test_reliable_write_3,
  3429. SERVICE_DATA_1_PDUS,
  3430. raw_pdu(0x16, 0x03, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3431. raw_pdu(0x01, 0x16, 0x03, 0x00, 0x03),
  3432. raw_pdu(0x18, 0x00),
  3433. raw_pdu(0x19));
  3434. define_test_client("/TP/GAW/CL/BI-17-C", test_client, service_db_1,
  3435. &test_reliable_write_4,
  3436. SERVICE_DATA_1_PDUS,
  3437. raw_pdu(0x16, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3438. raw_pdu(0x01, 0x16, 0x07, 0x00, 0x08),
  3439. raw_pdu(0x18, 0x00),
  3440. raw_pdu(0x19));
  3441. define_test_client("/TP/GAW/CL/BI-18-C", test_client, service_db_1,
  3442. &test_reliable_write_5,
  3443. SERVICE_DATA_1_PDUS,
  3444. raw_pdu(0x16, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3445. raw_pdu(0x01, 0x16, 0x07, 0x00, 0x05),
  3446. raw_pdu(0x18, 0x00),
  3447. raw_pdu(0x19));
  3448. define_test_client("/TP/GAW/CL/BI-18-C/auto", test_client, service_db_1,
  3449. &test_reliable_write_1,
  3450. SERVICE_DATA_1_PDUS,
  3451. raw_pdu(0x16, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3452. raw_pdu(0x01, 0x16, 0x07, 0x00, 0x05),
  3453. raw_pdu(0x16, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3454. raw_pdu(0x17, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3455. raw_pdu(0x18, 0x01),
  3456. raw_pdu(0x19));
  3457. define_test_client("/TP/GAW/CL/BI-19-C", test_client, service_db_1,
  3458. &test_reliable_write_6,
  3459. SERVICE_DATA_1_PDUS,
  3460. raw_pdu(0x16, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3461. raw_pdu(0x01, 0x16, 0x07, 0x00, 0x0c),
  3462. raw_pdu(0x18, 0x00),
  3463. raw_pdu(0x19));
  3464. define_test_server("/TP/GAW/SR/BV-06-C/small", test_server,
  3465. ts_small_db, NULL,
  3466. raw_pdu(0x03, 0x00, 0x02),
  3467. raw_pdu(0x16, 0x03, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3468. raw_pdu(0x17, 0x03, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3469. raw_pdu(0x18, 0x01),
  3470. raw_pdu(0x19));
  3471. define_test_server("/TP/GAW/SR/BV-06-C/large-1", test_server,
  3472. ts_large_db_1, NULL,
  3473. raw_pdu(0x03, 0x00, 0x02),
  3474. raw_pdu(0x16, 0x82, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3475. raw_pdu(0x17, 0x82, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3476. raw_pdu(0x18, 0x01),
  3477. raw_pdu(0x19));
  3478. define_test_server("/TP/GAW/SR/BV-10-C/small", test_server,
  3479. ts_small_db, NULL,
  3480. raw_pdu(0x03, 0x00, 0x02),
  3481. raw_pdu(0x16, 0x03, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3482. raw_pdu(0x17, 0x03, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3483. raw_pdu(0x16, 0x15, 0xf0, 0x00, 0x00, 0x01, 0x02, 0x03),
  3484. raw_pdu(0x17, 0x15, 0xf0, 0x00, 0x00, 0x01, 0x02, 0x03),
  3485. raw_pdu(0x16, 0x03, 0x00, 0x03, 0x00, 0x04, 0x05, 0x06),
  3486. raw_pdu(0x17, 0x03, 0x00, 0x03, 0x00, 0x04, 0x05, 0x06),
  3487. raw_pdu(0x16, 0x15, 0xf0, 0x03, 0x00, 0x04, 0x05, 0x06),
  3488. raw_pdu(0x17, 0x15, 0xf0, 0x03, 0x00, 0x04, 0x05, 0x06),
  3489. raw_pdu(0x18, 0x01),
  3490. raw_pdu(0x19));
  3491. define_test_server("/TP/GAW/SR/BV-10-C/large-1", test_server,
  3492. ts_large_db_1, NULL,
  3493. raw_pdu(0x03, 0x00, 0x02),
  3494. raw_pdu(0x16, 0x82, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3495. raw_pdu(0x17, 0x82, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3496. raw_pdu(0x16, 0x72, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3497. raw_pdu(0x17, 0x72, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3498. raw_pdu(0x16, 0x82, 0x00, 0x03, 0x00, 0x04, 0x05, 0x06),
  3499. raw_pdu(0x17, 0x82, 0x00, 0x03, 0x00, 0x04, 0x05, 0x06),
  3500. raw_pdu(0x16, 0x72, 0x00, 0x03, 0x00, 0x04, 0x05, 0x06),
  3501. raw_pdu(0x17, 0x72, 0x00, 0x03, 0x00, 0x04, 0x05, 0x06),
  3502. raw_pdu(0x18, 0x01),
  3503. raw_pdu(0x19));
  3504. define_test_server("/TP/GAW/SR/BI-14-C/small", test_server,
  3505. ts_small_db, NULL,
  3506. raw_pdu(0x03, 0x00, 0x02),
  3507. raw_pdu(0x16, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3508. raw_pdu(0x01, 0x16, 0x00, 0x00, 0x01));
  3509. define_test_server("/TP/GAW/SR/BI-14-C/large-1", test_server,
  3510. ts_large_db_1, NULL,
  3511. raw_pdu(0x03, 0x00, 0x02),
  3512. raw_pdu(0x16, 0x0f, 0xf0, 0x00, 0x00, 0x01, 0x02, 0x03),
  3513. raw_pdu(0x01, 0x16, 0x0f, 0xf0, 0x01));
  3514. define_test_server("/TP/GAW/SR/BI-15-C/small", test_server,
  3515. ts_small_db, NULL,
  3516. raw_pdu(0x03, 0x00, 0x02),
  3517. raw_pdu(0x16, 0x05, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3518. raw_pdu(0x01, 0x16, 0x05, 0x00, 0x03));
  3519. define_test_server("/TP/GAW/SR/BI-15-C/large-1", test_server,
  3520. ts_large_db_1, NULL,
  3521. raw_pdu(0x03, 0x00, 0x02),
  3522. raw_pdu(0x16, 0x73, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3523. raw_pdu(0x01, 0x16, 0x73, 0x00, 0x03));
  3524. define_test_client("/TP/GAW/CL/BV-08-C", test_client, service_db_1,
  3525. &test_write_7,
  3526. SERVICE_DATA_1_PDUS,
  3527. raw_pdu(0x12, 0x08, 0x00, 0x01, 0x02, 0x03),
  3528. raw_pdu(0x13));
  3529. define_test_client("/TP/GAW/CL/BI-20-C", test_client, service_db_1,
  3530. &test_write_8,
  3531. SERVICE_DATA_1_PDUS,
  3532. raw_pdu(0x12, 0x00, 0x00, 0x01, 0x02, 0x03),
  3533. raw_pdu(0x01, 0x12, 0x00, 0x00, 0x01));
  3534. define_test_client("/TP/GAW/CL/BI-21-C", test_client, service_db_1,
  3535. &test_write_9,
  3536. SERVICE_DATA_1_PDUS,
  3537. raw_pdu(0x12, 0x08, 0x00, 0x01, 0x02, 0x03),
  3538. raw_pdu(0x01, 0x12, 0x08, 0x00, 0x03));
  3539. define_test_client("/TP/GAW/CL/BI-22-C", test_client, service_db_1,
  3540. &test_write_10,
  3541. SERVICE_DATA_1_PDUS,
  3542. raw_pdu(0x12, 0x08, 0x00, 0x01, 0x02, 0x03),
  3543. raw_pdu(0x01, 0x12, 0x08, 0x00, 0x08));
  3544. define_test_client("/TP/GAW/CL/BI-23-C", test_client, service_db_1,
  3545. &test_write_11,
  3546. SERVICE_DATA_1_PDUS,
  3547. raw_pdu(0x12, 0x08, 0x00, 0x01, 0x02, 0x03),
  3548. raw_pdu(0x01, 0x12, 0x08, 0x00, 0x05));
  3549. define_test_client("/TP/GAW/CL/BI-23-C/auto", test_client, service_db_1,
  3550. &test_write_7,
  3551. SERVICE_DATA_1_PDUS,
  3552. raw_pdu(0x12, 0x08, 0x00, 0x01, 0x02, 0x03),
  3553. raw_pdu(0x01, 0x12, 0x08, 0x00, 0x05),
  3554. raw_pdu(0x12, 0x08, 0x00, 0x01, 0x02, 0x03),
  3555. raw_pdu(0x13));
  3556. define_test_client("/TP/GAW/CL/BI-24-C", test_client, service_db_1,
  3557. &test_write_12,
  3558. SERVICE_DATA_1_PDUS,
  3559. raw_pdu(0x12, 0x08, 0x00, 0x01, 0x02, 0x03),
  3560. raw_pdu(0x01, 0x12, 0x08, 0x00, 0x0c));
  3561. define_test_server("/TP/GAW/SR/BV-08-C/small", test_server,
  3562. ts_small_db, NULL,
  3563. raw_pdu(0x03, 0x00, 0x02),
  3564. raw_pdu(0x12, 0x04, 0x00, 0x01, 0x02, 0x03),
  3565. raw_pdu(0x13));
  3566. define_test_server("/TP/GAW/SR/BV-08-C/large-1", test_server,
  3567. ts_large_db_1, NULL,
  3568. raw_pdu(0x03, 0x00, 0x02),
  3569. raw_pdu(0x12, 0x83, 0x00, 0x01, 0x02, 0x03),
  3570. raw_pdu(0x13));
  3571. define_test_server("/TP/GAW/SR/BI-20-C/small", test_server,
  3572. ts_small_db, NULL,
  3573. raw_pdu(0x03, 0x00, 0x02),
  3574. raw_pdu(0x12, 0x00, 0x00, 0x01, 0x02, 0x03),
  3575. raw_pdu(0x01, 0x12, 0x00, 0x00, 0x01));
  3576. define_test_server("/TP/GAW/SR/BI-20-C/large-1", test_server,
  3577. ts_large_db_1, NULL,
  3578. raw_pdu(0x03, 0x00, 0x02),
  3579. raw_pdu(0x12, 0x0f, 0xf0, 0x01, 0x02, 0x03),
  3580. raw_pdu(0x01, 0x12, 0x0f, 0xf0, 0x01));
  3581. define_test_server("/TP/GAW/SR/BI-21-C/small", test_server,
  3582. ts_small_db, NULL,
  3583. raw_pdu(0x03, 0x00, 0x02),
  3584. raw_pdu(0x12, 0x13, 0xf0, 0x01, 0x02, 0x03),
  3585. raw_pdu(0x01, 0x12, 0x13, 0xf0, 0x03));
  3586. define_test_server("/TP/GAW/SR/BI-21-C/large-1", test_server,
  3587. ts_large_db_1, NULL,
  3588. raw_pdu(0x03, 0x00, 0x02),
  3589. raw_pdu(0x12, 0x04, 0x00, 0x01, 0x02, 0x03),
  3590. raw_pdu(0x01, 0x12, 0x04, 0x00, 0x03));
  3591. define_test_client("/TP/GAW/CL/BV-09-C", test_client, service_db_1,
  3592. &test_long_write_7,
  3593. SERVICE_DATA_1_PDUS,
  3594. raw_pdu(0x16, 0x08, 0x00, 0x00, 0x00,
  3595. 0xff, 0xff, 0xff, 0xff, 0xff,
  3596. 0xff, 0xff, 0xff, 0xff, 0xff,
  3597. 0xff, 0xff, 0xff, 0xff, 0xff,
  3598. 0xff, 0xff, 0xff, 0xff, 0xff,
  3599. 0xff, 0xff, 0xff, 0xff, 0xff,
  3600. 0xff, 0xff, 0xff, 0xff, 0xff,
  3601. 0xff, 0xff, 0xff, 0xff, 0xff,
  3602. 0xff, 0xff, 0xff, 0xff, 0xff,
  3603. 0xff, 0xff, 0xff, 0xff, 0xff,
  3604. 0xff, 0xff, 0xff, 0xff, 0xff,
  3605. 0xff, 0xff, 0xff, 0xff, 0xff,
  3606. 0xff, 0xff, 0xff, 0xff, 0xff,
  3607. 0xff, 0xff, 0xff, 0xff, 0xff,
  3608. 0xff, 0xff, 0xff, 0xff, 0xff,
  3609. 0xff, 0xff, 0xff, 0xff, 0xff,
  3610. 0xff, 0xff, 0xff, 0xff, 0xff,
  3611. 0xff, 0xff, 0xff, 0xff, 0xff,
  3612. 0xff, 0xff, 0xff, 0xff, 0xff,
  3613. 0xff, 0xff, 0xff, 0xff, 0xff,
  3614. 0xff, 0xff, 0xff, 0xff, 0xff,
  3615. 0xff, 0xff, 0xff, 0xff, 0xff,
  3616. 0xff, 0xff, 0xff, 0xff, 0xff,
  3617. 0xff, 0xff, 0xff, 0xff, 0xff,
  3618. 0xff, 0xff, 0xff, 0xff, 0xff,
  3619. 0xff, 0xff, 0xff, 0xff, 0xff,
  3620. 0xff, 0xff, 0xff, 0xff, 0xff,
  3621. 0xff, 0xff, 0xff, 0xff, 0xff,
  3622. 0xff, 0xff, 0xff, 0xff, 0xff,
  3623. 0xff, 0xff, 0xff, 0xff, 0xff,
  3624. 0xff, 0xff, 0xff, 0xff, 0xff,
  3625. 0xff, 0xff, 0xff, 0xff, 0xff,
  3626. 0xff, 0xff, 0xff, 0xff, 0xff,
  3627. 0xff, 0xff, 0xff, 0xff, 0xff,
  3628. 0xff, 0xff, 0xff, 0xff, 0xff,
  3629. 0xff, 0xff, 0xff, 0xff, 0xff,
  3630. 0xff, 0xff, 0xff, 0xff, 0xff,
  3631. 0xff, 0xff, 0xff, 0xff, 0xff,
  3632. 0xff, 0xff, 0xff, 0xff, 0xff,
  3633. 0xff, 0xff, 0xff, 0xff, 0xff,
  3634. 0xff, 0xff, 0xff, 0xff, 0xff,
  3635. 0xff, 0xff, 0xff, 0xff, 0xff,
  3636. 0xff, 0xff, 0xff, 0xff, 0xff,
  3637. 0xff, 0xff, 0xff, 0xff, 0xff,
  3638. 0xff, 0xff, 0xff, 0xff, 0xff,
  3639. 0xff, 0xff, 0xff, 0xff, 0xff,
  3640. 0xff, 0xff, 0xff, 0xff, 0xff,
  3641. 0xff, 0xff, 0xff, 0xff, 0xff,
  3642. 0xff, 0xff, 0xff, 0xff, 0xff,
  3643. 0xff, 0xff, 0xff, 0xff, 0xff,
  3644. 0xff, 0xff, 0xff, 0xff, 0xff,
  3645. 0xff, 0xff, 0xff, 0xff, 0xff,
  3646. 0xff, 0xff, 0xff, 0xff, 0xff,
  3647. 0xff, 0xff, 0xff, 0xff, 0xff,
  3648. 0xff, 0xff, 0xff, 0xff, 0xff,
  3649. 0xff, 0xff, 0xff, 0xff, 0xff,
  3650. 0xff, 0xff, 0xff, 0xff, 0xff,
  3651. 0xff, 0xff, 0xff, 0xff, 0xff,
  3652. 0xff, 0xff, 0xff, 0xff, 0xff,
  3653. 0xff, 0xff, 0xff, 0xff, 0xff,
  3654. 0xff, 0xff, 0xff, 0xff, 0xff,
  3655. 0xff, 0xff, 0xff, 0xff, 0xff,
  3656. 0xff, 0xff, 0xff, 0xff, 0xff,
  3657. 0xff, 0xff, 0xff, 0xff, 0xff,
  3658. 0xff, 0xff, 0xff, 0xff, 0xff,
  3659. 0xff, 0xff, 0xff, 0xff, 0xff,
  3660. 0xff, 0xff, 0xff, 0xff, 0xff,
  3661. 0xff, 0xff, 0xff, 0xff, 0xff,
  3662. 0xff, 0xff, 0xff, 0xff, 0xff,
  3663. 0xff, 0xff, 0xff, 0xff, 0xff,
  3664. 0xff, 0xff, 0xff, 0xff, 0xff,
  3665. 0xff, 0xff, 0xff, 0xff, 0xff,
  3666. 0xff, 0xff, 0xff, 0xff, 0xff,
  3667. 0xff, 0xff, 0xff, 0xff, 0xff,
  3668. 0xff, 0xff, 0xff, 0xff, 0xff,
  3669. 0xff, 0xff, 0xff, 0xff, 0xff,
  3670. 0xff, 0xff, 0xff, 0xff, 0xff,
  3671. 0xff, 0xff, 0xff, 0xff, 0xff,
  3672. 0xff, 0xff, 0xff, 0xff, 0xff,
  3673. 0xff, 0xff, 0xff, 0xff, 0xff,
  3674. 0xff, 0xff, 0xff, 0xff, 0xff,
  3675. 0xff, 0xff, 0xff, 0xff, 0xff,
  3676. 0xff, 0xff, 0xff, 0xff, 0xff,
  3677. 0xff, 0xff, 0xff, 0xff, 0xff,
  3678. 0xff, 0xff, 0xff, 0xff, 0xff,
  3679. 0xff, 0xff, 0xff, 0xff, 0xff,
  3680. 0xff, 0xff, 0xff, 0xff, 0xff,
  3681. 0xff, 0xff, 0xff, 0xff, 0xff,
  3682. 0xff, 0xff, 0xff, 0xff, 0xff,
  3683. 0xff, 0xff, 0xff, 0xff, 0xff,
  3684. 0xff, 0xff, 0xff, 0xff, 0xff,
  3685. 0xff, 0xff, 0xff, 0xff, 0xff,
  3686. 0xff, 0xff, 0xff, 0xff, 0xff,
  3687. 0xff, 0xff, 0xff, 0xff, 0xff,
  3688. 0xff, 0xff, 0xff, 0xff, 0xff,
  3689. 0xff, 0xff, 0xff, 0xff, 0xff,
  3690. 0xff, 0xff, 0xff, 0xff, 0xff,
  3691. 0xff, 0xff, 0xff, 0xff, 0xff,
  3692. 0xff, 0xff, 0xff, 0xff, 0xff,
  3693. 0xff, 0xff, 0xff, 0xff, 0xff,
  3694. 0xff, 0xff, 0xff, 0xff, 0xff,
  3695. 0xff, 0xff, 0xff, 0xff, 0xff,
  3696. 0xff, 0xff),
  3697. raw_pdu(0x17, 0x08, 0x00, 0x00, 0x00,
  3698. 0xff, 0xff, 0xff, 0xff, 0xff,
  3699. 0xff, 0xff, 0xff, 0xff, 0xff,
  3700. 0xff, 0xff, 0xff, 0xff, 0xff,
  3701. 0xff, 0xff, 0xff, 0xff, 0xff,
  3702. 0xff, 0xff, 0xff, 0xff, 0xff,
  3703. 0xff, 0xff, 0xff, 0xff, 0xff,
  3704. 0xff, 0xff, 0xff, 0xff, 0xff,
  3705. 0xff, 0xff, 0xff, 0xff, 0xff,
  3706. 0xff, 0xff, 0xff, 0xff, 0xff,
  3707. 0xff, 0xff, 0xff, 0xff, 0xff,
  3708. 0xff, 0xff, 0xff, 0xff, 0xff,
  3709. 0xff, 0xff, 0xff, 0xff, 0xff,
  3710. 0xff, 0xff, 0xff, 0xff, 0xff,
  3711. 0xff, 0xff, 0xff, 0xff, 0xff,
  3712. 0xff, 0xff, 0xff, 0xff, 0xff,
  3713. 0xff, 0xff, 0xff, 0xff, 0xff,
  3714. 0xff, 0xff, 0xff, 0xff, 0xff,
  3715. 0xff, 0xff, 0xff, 0xff, 0xff,
  3716. 0xff, 0xff, 0xff, 0xff, 0xff,
  3717. 0xff, 0xff, 0xff, 0xff, 0xff,
  3718. 0xff, 0xff, 0xff, 0xff, 0xff,
  3719. 0xff, 0xff, 0xff, 0xff, 0xff,
  3720. 0xff, 0xff, 0xff, 0xff, 0xff,
  3721. 0xff, 0xff, 0xff, 0xff, 0xff,
  3722. 0xff, 0xff, 0xff, 0xff, 0xff,
  3723. 0xff, 0xff, 0xff, 0xff, 0xff,
  3724. 0xff, 0xff, 0xff, 0xff, 0xff,
  3725. 0xff, 0xff, 0xff, 0xff, 0xff,
  3726. 0xff, 0xff, 0xff, 0xff, 0xff,
  3727. 0xff, 0xff, 0xff, 0xff, 0xff,
  3728. 0xff, 0xff, 0xff, 0xff, 0xff,
  3729. 0xff, 0xff, 0xff, 0xff, 0xff,
  3730. 0xff, 0xff, 0xff, 0xff, 0xff,
  3731. 0xff, 0xff, 0xff, 0xff, 0xff,
  3732. 0xff, 0xff, 0xff, 0xff, 0xff,
  3733. 0xff, 0xff, 0xff, 0xff, 0xff,
  3734. 0xff, 0xff, 0xff, 0xff, 0xff,
  3735. 0xff, 0xff, 0xff, 0xff, 0xff,
  3736. 0xff, 0xff, 0xff, 0xff, 0xff,
  3737. 0xff, 0xff, 0xff, 0xff, 0xff,
  3738. 0xff, 0xff, 0xff, 0xff, 0xff,
  3739. 0xff, 0xff, 0xff, 0xff, 0xff,
  3740. 0xff, 0xff, 0xff, 0xff, 0xff,
  3741. 0xff, 0xff, 0xff, 0xff, 0xff,
  3742. 0xff, 0xff, 0xff, 0xff, 0xff,
  3743. 0xff, 0xff, 0xff, 0xff, 0xff,
  3744. 0xff, 0xff, 0xff, 0xff, 0xff,
  3745. 0xff, 0xff, 0xff, 0xff, 0xff,
  3746. 0xff, 0xff, 0xff, 0xff, 0xff,
  3747. 0xff, 0xff, 0xff, 0xff, 0xff,
  3748. 0xff, 0xff, 0xff, 0xff, 0xff,
  3749. 0xff, 0xff, 0xff, 0xff, 0xff,
  3750. 0xff, 0xff, 0xff, 0xff, 0xff,
  3751. 0xff, 0xff, 0xff, 0xff, 0xff,
  3752. 0xff, 0xff, 0xff, 0xff, 0xff,
  3753. 0xff, 0xff, 0xff, 0xff, 0xff,
  3754. 0xff, 0xff, 0xff, 0xff, 0xff,
  3755. 0xff, 0xff, 0xff, 0xff, 0xff,
  3756. 0xff, 0xff, 0xff, 0xff, 0xff,
  3757. 0xff, 0xff, 0xff, 0xff, 0xff,
  3758. 0xff, 0xff, 0xff, 0xff, 0xff,
  3759. 0xff, 0xff, 0xff, 0xff, 0xff,
  3760. 0xff, 0xff, 0xff, 0xff, 0xff,
  3761. 0xff, 0xff, 0xff, 0xff, 0xff,
  3762. 0xff, 0xff, 0xff, 0xff, 0xff,
  3763. 0xff, 0xff, 0xff, 0xff, 0xff,
  3764. 0xff, 0xff, 0xff, 0xff, 0xff,
  3765. 0xff, 0xff, 0xff, 0xff, 0xff,
  3766. 0xff, 0xff, 0xff, 0xff, 0xff,
  3767. 0xff, 0xff, 0xff, 0xff, 0xff,
  3768. 0xff, 0xff, 0xff, 0xff, 0xff,
  3769. 0xff, 0xff, 0xff, 0xff, 0xff,
  3770. 0xff, 0xff, 0xff, 0xff, 0xff,
  3771. 0xff, 0xff, 0xff, 0xff, 0xff,
  3772. 0xff, 0xff, 0xff, 0xff, 0xff,
  3773. 0xff, 0xff, 0xff, 0xff, 0xff,
  3774. 0xff, 0xff, 0xff, 0xff, 0xff,
  3775. 0xff, 0xff, 0xff, 0xff, 0xff,
  3776. 0xff, 0xff, 0xff, 0xff, 0xff,
  3777. 0xff, 0xff, 0xff, 0xff, 0xff,
  3778. 0xff, 0xff, 0xff, 0xff, 0xff,
  3779. 0xff, 0xff, 0xff, 0xff, 0xff,
  3780. 0xff, 0xff, 0xff, 0xff, 0xff,
  3781. 0xff, 0xff, 0xff, 0xff, 0xff,
  3782. 0xff, 0xff, 0xff, 0xff, 0xff,
  3783. 0xff, 0xff, 0xff, 0xff, 0xff,
  3784. 0xff, 0xff, 0xff, 0xff, 0xff,
  3785. 0xff, 0xff, 0xff, 0xff, 0xff,
  3786. 0xff, 0xff, 0xff, 0xff, 0xff,
  3787. 0xff, 0xff, 0xff, 0xff, 0xff,
  3788. 0xff, 0xff, 0xff, 0xff, 0xff,
  3789. 0xff, 0xff, 0xff, 0xff, 0xff,
  3790. 0xff, 0xff, 0xff, 0xff, 0xff,
  3791. 0xff, 0xff, 0xff, 0xff, 0xff,
  3792. 0xff, 0xff, 0xff, 0xff, 0xff,
  3793. 0xff, 0xff, 0xff, 0xff, 0xff,
  3794. 0xff, 0xff, 0xff, 0xff, 0xff,
  3795. 0xff, 0xff, 0xff, 0xff, 0xff,
  3796. 0xff, 0xff, 0xff, 0xff, 0xff,
  3797. 0xff, 0xff, 0xff, 0xff, 0xff,
  3798. 0xff, 0xff, 0xff, 0xff, 0xff,
  3799. 0xff, 0xff),
  3800. raw_pdu(0x16, 0x08, 0x00, 0xfb, 0x01,
  3801. 0xff, 0xff, 0xff, 0xff, 0xff),
  3802. raw_pdu(0x17, 0x08, 0x00, 0xfb, 0x01,
  3803. 0xff, 0xff, 0xff, 0xff, 0xff),
  3804. raw_pdu(0x18, 0x01),
  3805. raw_pdu(0x19));
  3806. define_test_client("/TP/GAW/CL/BI-25-C", test_client, service_db_1,
  3807. &test_long_write_8,
  3808. SERVICE_DATA_1_PDUS,
  3809. raw_pdu(0x16, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3810. raw_pdu(0x01, 0x16, 0x00, 0x00, 0x01),
  3811. raw_pdu(0x18, 0x00),
  3812. raw_pdu(0x19));
  3813. define_test_client("/TP/GAW/CL/BI-26-C", test_client, service_db_1,
  3814. &test_long_write_9,
  3815. SERVICE_DATA_1_PDUS,
  3816. raw_pdu(0x16, 0x08, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3817. raw_pdu(0x01, 0x16, 0x08, 0x00, 0x03),
  3818. raw_pdu(0x18, 0x00),
  3819. raw_pdu(0x19));
  3820. define_test_client("/TP/GAW/CL/BI-29-C", test_client, service_db_1,
  3821. &test_long_write_10,
  3822. SERVICE_DATA_1_PDUS,
  3823. raw_pdu(0x16, 0x08, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3824. raw_pdu(0x01, 0x16, 0x08, 0x00, 0x08),
  3825. raw_pdu(0x18, 0x00),
  3826. raw_pdu(0x19));
  3827. define_test_client("/TP/GAW/CL/BI-30-C", test_client, service_db_1,
  3828. &test_long_write_11,
  3829. SERVICE_DATA_1_PDUS,
  3830. raw_pdu(0x16, 0x08, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3831. raw_pdu(0x01, 0x16, 0x08, 0x00, 0x05),
  3832. raw_pdu(0x18, 0x00),
  3833. raw_pdu(0x19));
  3834. define_test_client("/TP/GAW/CL/BI-31-C", test_client, service_db_1,
  3835. &test_long_write_12,
  3836. SERVICE_DATA_1_PDUS,
  3837. raw_pdu(0x16, 0x08, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3838. raw_pdu(0x01, 0x16, 0x08, 0x00, 0x0c),
  3839. raw_pdu(0x18, 0x00),
  3840. raw_pdu(0x19));
  3841. define_test_server("/TP/GAW/SR/BV-09-C/small", test_server,
  3842. ts_small_db, NULL,
  3843. raw_pdu(0x03, 0x00, 0x02),
  3844. raw_pdu(0x16, 0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
  3845. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  3846. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
  3847. raw_pdu(0x17, 0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
  3848. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  3849. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
  3850. raw_pdu(0x16, 0x04, 0x00, 0x12, 0x00, 0xff),
  3851. raw_pdu(0x17, 0x04, 0x00, 0x12, 0x00, 0xff),
  3852. raw_pdu(0x18, 0x01),
  3853. raw_pdu(0x19));
  3854. define_test_server("/TP/GAW/SR/BV-09-C/large-1", test_server,
  3855. ts_large_db_1, NULL,
  3856. raw_pdu(0x03, 0x00, 0x02),
  3857. raw_pdu(0x16, 0x83, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
  3858. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  3859. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
  3860. raw_pdu(0x17, 0x83, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
  3861. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  3862. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
  3863. raw_pdu(0x16, 0x83, 0x00, 0x12, 0x00, 0xff),
  3864. raw_pdu(0x17, 0x83, 0x00, 0x12, 0x00, 0xff),
  3865. raw_pdu(0x18, 0x01),
  3866. raw_pdu(0x19));
  3867. define_test_server("/TP/GAW/SR/BI-25-C/small", test_server,
  3868. ts_small_db, NULL,
  3869. raw_pdu(0x03, 0x00, 0x02),
  3870. raw_pdu(0x16, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
  3871. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  3872. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
  3873. raw_pdu(0x01, 0x16, 0x00, 0x00, 0x01));
  3874. define_test_server("/TP/GAW/SR/BI-25-C/large-1", test_server,
  3875. ts_large_db_1, NULL,
  3876. raw_pdu(0x03, 0x00, 0x02),
  3877. raw_pdu(0x16, 0x0f, 0xf0, 0x00, 0x00, 0xff, 0xff, 0xff,
  3878. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  3879. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
  3880. raw_pdu(0x01, 0x16, 0x0f, 0xf0, 0x01));
  3881. define_test_server("/TP/GAW/SR/BI-26-C/small", test_server,
  3882. ts_small_db, NULL,
  3883. raw_pdu(0x03, 0x00, 0x02),
  3884. raw_pdu(0x16, 0x13, 0xf0, 0x00, 0x00, 0xff, 0xff, 0xff,
  3885. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  3886. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
  3887. raw_pdu(0x01, 0x16, 0x13, 0xf0, 0x03));
  3888. define_test_server("/TP/GAW/SR/BI-26-C/large-1", test_server,
  3889. ts_large_db_1, NULL,
  3890. raw_pdu(0x03, 0x00, 0x02),
  3891. raw_pdu(0x16, 0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
  3892. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  3893. 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
  3894. raw_pdu(0x01, 0x16, 0x04, 0x00, 0x03));
  3895. define_test_server("/robustness/no-reliable-characteristic",
  3896. test_server, ts_large_db_1, NULL,
  3897. raw_pdu(0x03, 0x00, 0x02),
  3898. raw_pdu(0x16, 0x82, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3899. raw_pdu(0x17, 0x82, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3900. raw_pdu(0x16, 0x25, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3901. raw_pdu(0x17, 0x25, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03),
  3902. raw_pdu(0x16, 0x82, 0x00, 0x03, 0x00, 0x04, 0x05, 0x06),
  3903. raw_pdu(0x17, 0x82, 0x00, 0x03, 0x00, 0x04, 0x05, 0x06),
  3904. raw_pdu(0x16, 0x25, 0x00, 0x03, 0x00, 0x04, 0x05, 0x06),
  3905. raw_pdu(0x17, 0x25, 0x00, 0x03, 0x00, 0x04, 0x05, 0x06),
  3906. raw_pdu(0x18, 0x01),
  3907. raw_pdu(0x01, 0x18, 0x25, 0x00, 0x06));
  3908. define_test_server("/robustness/unkown-request",
  3909. test_server, service_db_1, NULL,
  3910. raw_pdu(0x03, 0x00, 0x02),
  3911. raw_pdu(0xbf, 0x00),
  3912. raw_pdu(0x01, 0xbf, 0x00, 0x00, 0x06));
  3913. define_test_server("/robustness/unkown-command",
  3914. test_server, service_db_1, NULL,
  3915. raw_pdu(0x03, 0x00, 0x02),
  3916. raw_pdu(0xff, 0x00),
  3917. raw_pdu());
  3918. return tester_run();
  3919. }