l2c_ucd.c 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083
  1. /******************************************************************************
  2. *
  3. * Copyright (C) 1999-2012 Broadcom Corporation
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at:
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. ******************************************************************************/
  18. /******************************************************************************
  19. *
  20. * This file contains the L2CAP UCD code
  21. *
  22. ******************************************************************************/
  23. #include <stdlib.h>
  24. #include <string.h>
  25. //#include <stdio.h>
  26. #include "gki.h"
  27. #include "bt_types.h"
  28. #include "hcidefs.h"
  29. #include "hcimsgs.h"
  30. #include "l2cdefs.h"
  31. #include "l2c_int.h"
  32. #include "btu.h"
  33. #include "btm_api.h"
  34. #include "btm_int.h"
  35. #if (L2CAP_UCD_INCLUDED == TRUE)
  36. static BOOLEAN l2c_ucd_connect ( BD_ADDR rem_bda );
  37. /*******************************************************************************
  38. **
  39. ** Function l2c_ucd_discover_cback
  40. **
  41. ** Description UCD Discover callback
  42. **
  43. ** Returns void
  44. **
  45. *******************************************************************************/
  46. static void l2c_ucd_discover_cback (BD_ADDR rem_bda, UINT8 info_type, UINT32 data)
  47. {
  48. tL2C_RCB *p_rcb = &l2cb.rcb_pool[0];
  49. UINT16 xx;
  50. L2CAP_TRACE_DEBUG ("L2CAP - l2c_ucd_discover_cback");
  51. for (xx = 0; xx < MAX_L2CAP_CLIENTS; xx++, p_rcb++) {
  52. if (p_rcb->in_use) {
  53. /* if this application is waiting UCD reception info */
  54. if (( info_type == L2CAP_UCD_INFO_TYPE_RECEPTION )
  55. && ( p_rcb->ucd.state & L2C_UCD_STATE_W4_RECEPTION )) {
  56. p_rcb->ucd.cb_info.pL2CA_UCD_Discover_Cb (rem_bda, info_type, data);
  57. p_rcb->ucd.state &= ~(L2C_UCD_STATE_W4_RECEPTION);
  58. }
  59. /* if this application is waiting UCD MTU info */
  60. if (( info_type == L2CAP_UCD_INFO_TYPE_MTU )
  61. && ( p_rcb->ucd.state & L2C_UCD_STATE_W4_MTU )) {
  62. p_rcb->ucd.cb_info.pL2CA_UCD_Discover_Cb (rem_bda, info_type, data);
  63. p_rcb->ucd.state &= ~(L2C_UCD_STATE_W4_MTU);
  64. }
  65. }
  66. }
  67. }
  68. /*******************************************************************************
  69. **
  70. ** Function l2c_ucd_data_ind_cback
  71. **
  72. ** Description UCD Data callback
  73. **
  74. ** Returns void
  75. **
  76. *******************************************************************************/
  77. static void l2c_ucd_data_ind_cback (BD_ADDR rem_bda, BT_HDR *p_buf)
  78. {
  79. UINT8 *p;
  80. UINT16 psm;
  81. tL2C_RCB *p_rcb;
  82. L2CAP_TRACE_DEBUG ("L2CAP - l2c_ucd_data_ind_cback");
  83. p = (UINT8 *)(p_buf + 1) + p_buf->offset;
  84. STREAM_TO_UINT16(psm, p)
  85. p_buf->offset += L2CAP_UCD_OVERHEAD;
  86. p_buf->len -= L2CAP_UCD_OVERHEAD;
  87. if ((p_rcb = l2cu_find_rcb_by_psm (psm)) == NULL) {
  88. L2CAP_TRACE_ERROR ("L2CAP - no RCB for l2c_ucd_data_ind_cback, PSM: 0x%04x", psm);
  89. GKI_freebuf (p_buf);
  90. } else {
  91. p_rcb->ucd.cb_info.pL2CA_UCD_Data_Cb(rem_bda, p_buf);
  92. }
  93. }
  94. /*******************************************************************************
  95. **
  96. ** Function l2c_ucd_congestion_status_cback
  97. **
  98. ** Description UCD Congestion Status callback
  99. **
  100. ** Returns void
  101. **
  102. *******************************************************************************/
  103. static void l2c_ucd_congestion_status_cback (BD_ADDR rem_bda, BOOLEAN is_congested)
  104. {
  105. tL2C_RCB *p_rcb = &l2cb.rcb_pool[0];
  106. UINT16 xx;
  107. L2CAP_TRACE_DEBUG ("L2CAP - l2c_ucd_congestion_status_cback");
  108. for (xx = 0; xx < MAX_L2CAP_CLIENTS; xx++, p_rcb++) {
  109. if (( p_rcb->in_use )
  110. && ( p_rcb->ucd.state != L2C_UCD_STATE_UNUSED )) {
  111. if ( p_rcb->ucd.cb_info.pL2CA_UCD_Congestion_Status_Cb ) {
  112. L2CAP_TRACE_DEBUG ("L2CAP - Calling UCDCongestionStatus_Cb (%d), PSM=0x%04x, BDA: %08x%04x,",
  113. is_congested, p_rcb->psm,
  114. (rem_bda[0] << 24) + (rem_bda[1] << 16) + (rem_bda[2] << 8) + rem_bda[3],
  115. (rem_bda[4] << 8) + rem_bda[5]);
  116. p_rcb->ucd.cb_info.pL2CA_UCD_Congestion_Status_Cb ( rem_bda, is_congested );
  117. }
  118. }
  119. }
  120. }
  121. /*******************************************************************************
  122. **
  123. ** Function l2c_ucd_disconnect_ind_cback
  124. **
  125. ** Description UCD disconnect callback (This prevent to access null pointer)
  126. **
  127. ** Returns void
  128. **
  129. *******************************************************************************/
  130. static void l2c_ucd_disconnect_ind_cback (UINT16 cid, BOOLEAN result)
  131. {
  132. /* do nothing */
  133. }
  134. /*******************************************************************************
  135. **
  136. ** Function l2c_ucd_config_ind_cback
  137. **
  138. ** Description UCD config callback (This prevent to access null pointer)
  139. **
  140. ** Returns void
  141. **
  142. *******************************************************************************/
  143. static void l2c_ucd_config_ind_cback (UINT16 cid, tL2CAP_CFG_INFO *p_cfg)
  144. {
  145. /* do nothing */
  146. }
  147. /*******************************************************************************
  148. **
  149. ** Function l2c_ucd_config_cfm_cback
  150. **
  151. ** Description UCD config callback (This prevent to access null pointer)
  152. **
  153. ** Returns void
  154. **
  155. *******************************************************************************/
  156. static void l2c_ucd_config_cfm_cback (UINT16 cid, tL2CAP_CFG_INFO *p_cfg)
  157. {
  158. /* do nothing */
  159. }
  160. /*******************************************************************************
  161. **
  162. ** Function L2CA_UcdRegister
  163. **
  164. ** Description Register PSM on UCD.
  165. **
  166. ** Parameters: tL2CAP_UCD_CB_INFO
  167. **
  168. ** Return value: TRUE if successs
  169. **
  170. *******************************************************************************/
  171. BOOLEAN L2CA_UcdRegister ( UINT16 psm, tL2CAP_UCD_CB_INFO *p_cb_info )
  172. {
  173. tL2C_RCB *p_rcb;
  174. L2CAP_TRACE_API ("L2CA_UcdRegister() PSM: 0x%04x", psm);
  175. if ((!p_cb_info->pL2CA_UCD_Discover_Cb)
  176. || (!p_cb_info->pL2CA_UCD_Data_Cb)) {
  177. L2CAP_TRACE_ERROR ("L2CAP - no callback registering PSM(0x%04x) on UCD", psm);
  178. return (FALSE);
  179. }
  180. if ((p_rcb = l2cu_find_rcb_by_psm (psm)) == NULL) {
  181. L2CAP_TRACE_ERROR ("L2CAP - no RCB for L2CA_UcdRegister, PSM: 0x%04x", psm);
  182. return (FALSE);
  183. }
  184. p_rcb->ucd.state = L2C_UCD_STATE_W4_DATA;
  185. p_rcb->ucd.cb_info = *p_cb_info;
  186. /* check if master rcb is created for UCD */
  187. if ((p_rcb = l2cu_find_rcb_by_psm (L2C_UCD_RCB_ID)) == NULL) {
  188. if ((p_rcb = l2cu_allocate_rcb (L2C_UCD_RCB_ID)) == NULL) {
  189. L2CAP_TRACE_ERROR ("L2CAP - no RCB available for L2CA_UcdRegister");
  190. return (FALSE);
  191. } else {
  192. /* these callback functions will forward data to each UCD application */
  193. p_rcb->ucd.cb_info.pL2CA_UCD_Discover_Cb = l2c_ucd_discover_cback;
  194. p_rcb->ucd.cb_info.pL2CA_UCD_Data_Cb = l2c_ucd_data_ind_cback;
  195. p_rcb->ucd.cb_info.pL2CA_UCD_Congestion_Status_Cb = l2c_ucd_congestion_status_cback;
  196. memset (&p_rcb->api, 0, sizeof(tL2CAP_APPL_INFO));
  197. p_rcb->api.pL2CA_DisconnectInd_Cb = l2c_ucd_disconnect_ind_cback;
  198. /* This will make L2CAP check UCD congestion callback */
  199. p_rcb->api.pL2CA_CongestionStatus_Cb = NULL;
  200. /* do nothing but prevent crash */
  201. p_rcb->api.pL2CA_ConfigInd_Cb = l2c_ucd_config_ind_cback;
  202. p_rcb->api.pL2CA_ConfigCfm_Cb = l2c_ucd_config_cfm_cback;
  203. }
  204. }
  205. return (TRUE);
  206. }
  207. /*******************************************************************************
  208. **
  209. ** Function L2CA_UcdDeregister
  210. **
  211. ** Description Deregister PSM on UCD.
  212. **
  213. ** Parameters: PSM
  214. **
  215. ** Return value: TRUE if successs
  216. **
  217. *******************************************************************************/
  218. BOOLEAN L2CA_UcdDeregister ( UINT16 psm )
  219. {
  220. tL2C_CCB *p_ccb;
  221. tL2C_RCB *p_rcb;
  222. UINT16 xx;
  223. L2CAP_TRACE_API ("L2CA_UcdDeregister() PSM: 0x%04x", psm);
  224. if ((p_rcb = l2cu_find_rcb_by_psm (psm)) == NULL) {
  225. L2CAP_TRACE_ERROR ("L2CAP - no RCB for L2CA_UcdDeregister, PSM: 0x%04x", psm);
  226. return (FALSE);
  227. }
  228. p_rcb->ucd.state = L2C_UCD_STATE_UNUSED;
  229. /* check this was the last UCD registration */
  230. p_rcb = &l2cb.rcb_pool[0];
  231. for (xx = 0; xx < MAX_L2CAP_CLIENTS; xx++, p_rcb++) {
  232. if ((p_rcb->in_use) && (p_rcb->ucd.state != L2C_UCD_STATE_UNUSED)) {
  233. return (TRUE);
  234. }
  235. }
  236. /* delete master rcb for UCD */
  237. if ((p_rcb = l2cu_find_rcb_by_psm (L2C_UCD_RCB_ID)) != NULL) {
  238. l2cu_release_rcb (p_rcb);
  239. }
  240. /* delete CCB for UCD */
  241. p_ccb = l2cb.ccb_pool;
  242. for ( xx = 0; xx < MAX_L2CAP_CHANNELS; xx++ ) {
  243. if (( p_ccb->in_use )
  244. && ( p_ccb->local_cid == L2CAP_CONNECTIONLESS_CID )) {
  245. l2cu_release_ccb (p_ccb);
  246. }
  247. p_ccb++;
  248. }
  249. return (TRUE);
  250. }
  251. /*******************************************************************************
  252. **
  253. ** Function L2CA_UcdDiscover
  254. **
  255. ** Description Discover UCD of remote device.
  256. **
  257. ** Parameters: PSM
  258. ** BD_ADDR of remote device
  259. ** info_type : L2CAP_UCD_INFO_TYPE_RECEPTION
  260. ** L2CAP_UCD_INFO_TYPE_MTU
  261. **
  262. **
  263. ** Return value: TRUE if successs
  264. **
  265. *******************************************************************************/
  266. BOOLEAN L2CA_UcdDiscover ( UINT16 psm, BD_ADDR rem_bda, UINT8 info_type )
  267. {
  268. tL2C_LCB *p_lcb;
  269. tL2C_CCB *p_ccb;
  270. tL2C_RCB *p_rcb;
  271. L2CAP_TRACE_API ("L2CA_UcdDiscover() PSM: 0x%04x BDA: %08x%04x, InfoType=0x%02x", psm,
  272. (rem_bda[0] << 24) + (rem_bda[1] << 16) + (rem_bda[2] << 8) + rem_bda[3],
  273. (rem_bda[4] << 8) + rem_bda[5], info_type);
  274. /* Fail if the PSM is not registered */
  275. if (((p_rcb = l2cu_find_rcb_by_psm (psm)) == NULL)
  276. || ( p_rcb->ucd.state == L2C_UCD_STATE_UNUSED )) {
  277. L2CAP_TRACE_WARNING ("L2CAP - no RCB for L2CA_UcdDiscover, PSM: 0x%04x", psm);
  278. return (FALSE);
  279. }
  280. /* First, see if we already have a link to the remote */
  281. /* then find the channel control block for UCD. */
  282. if (((p_lcb = l2cu_find_lcb_by_bd_addr (rem_bda, BT_TRANSPORT_BR_EDR)) == NULL)
  283. || ((p_ccb = l2cu_find_ccb_by_cid (p_lcb, L2CAP_CONNECTIONLESS_CID)) == NULL)) {
  284. if ( l2c_ucd_connect (rem_bda) == FALSE ) {
  285. return (FALSE);
  286. }
  287. }
  288. /* set waiting flags in rcb */
  289. if ( info_type & L2CAP_UCD_INFO_TYPE_RECEPTION ) {
  290. p_rcb->ucd.state |= L2C_UCD_STATE_W4_RECEPTION;
  291. }
  292. if ( info_type & L2CAP_UCD_INFO_TYPE_MTU ) {
  293. p_rcb->ucd.state |= L2C_UCD_STATE_W4_MTU;
  294. }
  295. /* if link is already established */
  296. if ((p_lcb) && (p_lcb->link_state == LST_CONNECTED)) {
  297. if (!p_ccb) {
  298. p_ccb = l2cu_find_ccb_by_cid (p_lcb, L2CAP_CONNECTIONLESS_CID);
  299. }
  300. l2c_ucd_check_pending_info_req(p_ccb);
  301. }
  302. return (TRUE);
  303. }
  304. /*******************************************************************************
  305. **
  306. ** Function L2CA_UcdDataWrite
  307. **
  308. ** Description Send UCD to remote device
  309. **
  310. ** Parameters: PSM
  311. ** BD Address of remote
  312. ** Pointer to buffer of type BT_HDR
  313. ** flags : L2CAP_FLUSHABLE_CH_BASED
  314. ** L2CAP_FLUSHABLE_PKT
  315. ** L2CAP_NON_FLUSHABLE_PKT
  316. **
  317. ** Return value L2CAP_DW_SUCCESS, if data accepted
  318. ** L2CAP_DW_FAILED, if error
  319. **
  320. *******************************************************************************/
  321. UINT16 L2CA_UcdDataWrite (UINT16 psm, BD_ADDR rem_bda, BT_HDR *p_buf, UINT16 flags)
  322. {
  323. tL2C_LCB *p_lcb;
  324. tL2C_CCB *p_ccb;
  325. tL2C_RCB *p_rcb;
  326. UINT8 *p;
  327. L2CAP_TRACE_API ("L2CA_UcdDataWrite() PSM: 0x%04x BDA: %08x%04x", psm,
  328. (rem_bda[0] << 24) + (rem_bda[1] << 16) + (rem_bda[2] << 8) + rem_bda[3],
  329. (rem_bda[4] << 8) + rem_bda[5]);
  330. /* Fail if the PSM is not registered */
  331. if (((p_rcb = l2cu_find_rcb_by_psm (psm)) == NULL)
  332. || ( p_rcb->ucd.state == L2C_UCD_STATE_UNUSED )) {
  333. L2CAP_TRACE_WARNING ("L2CAP - no RCB for L2CA_UcdDataWrite, PSM: 0x%04x", psm);
  334. GKI_freebuf (p_buf);
  335. return (L2CAP_DW_FAILED);
  336. }
  337. /* First, see if we already have a link to the remote */
  338. /* then find the channel control block for UCD */
  339. if (((p_lcb = l2cu_find_lcb_by_bd_addr (rem_bda, BT_TRANSPORT_BR_EDR)) == NULL)
  340. || ((p_ccb = l2cu_find_ccb_by_cid (p_lcb, L2CAP_CONNECTIONLESS_CID)) == NULL)) {
  341. if ( l2c_ucd_connect (rem_bda) == FALSE ) {
  342. GKI_freebuf (p_buf);
  343. return (L2CAP_DW_FAILED);
  344. }
  345. /* If we still don't have lcb and ccb after connect attempt, then can't proceed */
  346. if (((p_lcb = l2cu_find_lcb_by_bd_addr (rem_bda, BT_TRANSPORT_BR_EDR)) == NULL)
  347. || ((p_ccb = l2cu_find_ccb_by_cid (p_lcb, L2CAP_CONNECTIONLESS_CID)) == NULL)) {
  348. GKI_freebuf (p_buf);
  349. return (L2CAP_DW_FAILED);
  350. }
  351. }
  352. /* write PSM */
  353. p_buf->offset -= L2CAP_UCD_OVERHEAD;
  354. p_buf->len += L2CAP_UCD_OVERHEAD;
  355. p = (UINT8 *)(p_buf + 1) + p_buf->offset;
  356. UINT16_TO_STREAM (p, psm);
  357. /* UCD MTU check */
  358. if ((p_lcb->ucd_mtu) && (p_buf->len > p_lcb->ucd_mtu)) {
  359. L2CAP_TRACE_WARNING ("L2CAP - Handle: 0x%04x UCD bigger than peer's UCD mtu size cannot be sent", p_lcb->handle);
  360. GKI_freebuf (p_buf);
  361. return (L2CAP_DW_FAILED);
  362. }
  363. /* If already congested, do not accept any more packets */
  364. if (p_ccb->cong_sent) {
  365. L2CAP_TRACE_ERROR ("L2CAP - Handle: 0x%04x UCD cannot be sent, already congested count: %u buff_quota: %u",
  366. p_lcb->handle,
  367. (p_ccb->xmit_hold_q.count + p_lcb->ucd_out_sec_pending_q.count),
  368. p_ccb->buff_quota);
  369. GKI_freebuf (p_buf);
  370. return (L2CAP_DW_FAILED);
  371. }
  372. /* channel based, packet based flushable or non-flushable */
  373. p_buf->layer_specific = flags;
  374. l2c_csm_execute (p_ccb, L2CEVT_L2CA_DATA_WRITE, p_buf);
  375. if (p_ccb->cong_sent) {
  376. return (L2CAP_DW_CONGESTED);
  377. } else {
  378. return (L2CAP_DW_SUCCESS);
  379. }
  380. }
  381. /*******************************************************************************
  382. **
  383. ** Function L2CA_UcdSetIdleTimeout
  384. **
  385. ** Description Set UCD Idle timeout.
  386. **
  387. ** Parameters: BD Addr
  388. ** Timeout in second
  389. **
  390. ** Return value: TRUE if successs
  391. **
  392. *******************************************************************************/
  393. BOOLEAN L2CA_UcdSetIdleTimeout ( BD_ADDR rem_bda, UINT16 timeout )
  394. {
  395. tL2C_LCB *p_lcb;
  396. tL2C_CCB *p_ccb;
  397. L2CAP_TRACE_API ("L2CA_UcdSetIdleTimeout() Timeout: 0x%04x BDA: %08x%04x", timeout,
  398. (rem_bda[0] << 24) + (rem_bda[1] << 16) + (rem_bda[2] << 8) + rem_bda[3],
  399. (rem_bda[4] << 8) + rem_bda[5]);
  400. /* First, see if we already have a link to the remote */
  401. /* then find the channel control block. */
  402. if (((p_lcb = l2cu_find_lcb_by_bd_addr (rem_bda, BT_TRANSPORT_BR_EDR)) == NULL)
  403. || ((p_ccb = l2cu_find_ccb_by_cid (p_lcb, L2CAP_CONNECTIONLESS_CID)) == NULL)) {
  404. L2CAP_TRACE_WARNING ("L2CAP - no UCD channel");
  405. return (FALSE);
  406. } else {
  407. p_ccb->fixed_chnl_idle_tout = timeout;
  408. return (TRUE);
  409. }
  410. }
  411. /*******************************************************************************
  412. **
  413. ** Function L2CA_UCDSetTxPriority
  414. **
  415. ** Description Sets the transmission priority for a connectionless channel.
  416. **
  417. ** Returns TRUE if a valid channel, else FALSE
  418. **
  419. *******************************************************************************/
  420. BOOLEAN L2CA_UCDSetTxPriority ( BD_ADDR rem_bda, tL2CAP_CHNL_PRIORITY priority )
  421. {
  422. tL2C_LCB *p_lcb;
  423. tL2C_CCB *p_ccb;
  424. L2CAP_TRACE_API ("L2CA_UCDSetTxPriority() priority: 0x%02x BDA: %08x%04x", priority,
  425. (rem_bda[0] << 24) + (rem_bda[1] << 16) + (rem_bda[2] << 8) + rem_bda[3],
  426. (rem_bda[4] << 8) + rem_bda[5]);
  427. if ((p_lcb = l2cu_find_lcb_by_bd_addr (rem_bda, BT_TRANSPORT_BR_EDR)) == NULL) {
  428. L2CAP_TRACE_WARNING ("L2CAP - no LCB for L2CA_UCDSetTxPriority");
  429. return (FALSE);
  430. }
  431. /* Find the channel control block */
  432. if ((p_ccb = l2cu_find_ccb_by_cid (p_lcb, L2CAP_CONNECTIONLESS_CID)) == NULL) {
  433. L2CAP_TRACE_WARNING ("L2CAP - no CCB for L2CA_UCDSetTxPriority");
  434. return (FALSE);
  435. }
  436. /* it will update the order of CCB in LCB by priority and update round robin service variables */
  437. l2cu_change_pri_ccb (p_ccb, priority);
  438. return (TRUE);
  439. }
  440. /*******************************************************************************
  441. **
  442. ** Function l2c_ucd_connect
  443. **
  444. ** Description Connect UCD to remote device.
  445. **
  446. ** Parameters: BD_ADDR of remote device
  447. **
  448. ** Return value: TRUE if successs
  449. **
  450. *******************************************************************************/
  451. static BOOLEAN l2c_ucd_connect ( BD_ADDR rem_bda )
  452. {
  453. tL2C_LCB *p_lcb;
  454. tL2C_CCB *p_ccb;
  455. tL2C_RCB *p_rcb;
  456. L2CAP_TRACE_DEBUG ("l2c_ucd_connect() BDA: %08x%04x",
  457. (rem_bda[0] << 24) + (rem_bda[1] << 16) + (rem_bda[2] << 8) + rem_bda[3],
  458. (rem_bda[4] << 8) + rem_bda[5]);
  459. /* Fail if we have not established communications with the controller */
  460. if (!BTM_IsDeviceUp()) {
  461. L2CAP_TRACE_WARNING ("l2c_ucd_connect - BTU not ready");
  462. return (FALSE);
  463. }
  464. /* First, see if we already have a link to the remote */
  465. if ((p_lcb = l2cu_find_lcb_by_bd_addr (rem_bda, BT_TRANSPORT_BR_EDR)) == NULL) {
  466. /* No link. Get an LCB and start link establishment */
  467. if ( ((p_lcb = l2cu_allocate_lcb (rem_bda, FALSE, BT_TRANSPORT_BR_EDR)) == NULL)
  468. || (l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR) == FALSE) ) {
  469. L2CAP_TRACE_WARNING ("L2CAP - conn not started l2c_ucd_connect");
  470. return (FALSE);
  471. }
  472. } else if ( p_lcb->info_rx_bits & (1 << L2CAP_EXTENDED_FEATURES_INFO_TYPE) ) {
  473. if (!(p_lcb->peer_ext_fea & L2CAP_EXTFEA_UCD_RECEPTION)) {
  474. L2CAP_TRACE_WARNING ("L2CAP - UCD is not supported by peer, l2c_ucd_connect");
  475. return (FALSE);
  476. }
  477. }
  478. /* Find the channel control block. */
  479. if ((p_ccb = l2cu_find_ccb_by_cid (p_lcb, L2CAP_CONNECTIONLESS_CID)) == NULL) {
  480. /* Allocate a channel control block */
  481. if ((p_ccb = l2cu_allocate_ccb (p_lcb, 0)) == NULL) {
  482. L2CAP_TRACE_WARNING ("L2CAP - no CCB for l2c_ucd_connect");
  483. return (FALSE);
  484. } else {
  485. /* Set CID for the connection */
  486. p_ccb->local_cid = L2CAP_CONNECTIONLESS_CID;
  487. p_ccb->remote_cid = L2CAP_CONNECTIONLESS_CID;
  488. /* Set the default idle timeout value to use */
  489. p_ccb->fixed_chnl_idle_tout = L2CAP_UCD_IDLE_TIMEOUT;
  490. /* Set the default channel priority value to use */
  491. l2cu_change_pri_ccb (p_ccb, L2CAP_UCD_CH_PRIORITY);
  492. if ((p_rcb = l2cu_find_rcb_by_psm (L2C_UCD_RCB_ID)) == NULL) {
  493. L2CAP_TRACE_WARNING ("L2CAP - no UCD registered, l2c_ucd_connect");
  494. return (FALSE);
  495. }
  496. /* Save UCD registration info */
  497. p_ccb->p_rcb = p_rcb;
  498. /* There is no configuration, so if the link is up, the channel is up */
  499. if (p_lcb->link_state == LST_CONNECTED) {
  500. p_ccb->chnl_state = CST_OPEN;
  501. }
  502. }
  503. }
  504. return (TRUE);
  505. }
  506. /*******************************************************************************
  507. **
  508. ** Function l2c_ucd_delete_sec_pending_q
  509. **
  510. ** Description discard all of UCD packets in security pending queue
  511. **
  512. ** Returns None
  513. **
  514. *******************************************************************************/
  515. void l2c_ucd_delete_sec_pending_q(tL2C_LCB *p_lcb)
  516. {
  517. /* clean up any security pending UCD */
  518. while (p_lcb->ucd_out_sec_pending_q.p_first) {
  519. GKI_freebuf (GKI_dequeue (&p_lcb->ucd_out_sec_pending_q));
  520. }
  521. while (p_lcb->ucd_in_sec_pending_q.p_first) {
  522. GKI_freebuf (GKI_dequeue (&p_lcb->ucd_in_sec_pending_q));
  523. }
  524. }
  525. /*******************************************************************************
  526. **
  527. ** Function l2c_ucd_check_pending_info_req
  528. **
  529. ** Description check if any application is waiting for UCD information
  530. **
  531. ** Return TRUE if any pending UCD info request
  532. **
  533. *******************************************************************************/
  534. BOOLEAN l2c_ucd_check_pending_info_req(tL2C_CCB *p_ccb)
  535. {
  536. tL2C_RCB *p_rcb = &l2cb.rcb_pool[0];
  537. UINT16 xx;
  538. BOOLEAN pending = FALSE;
  539. if (p_ccb == NULL) {
  540. L2CAP_TRACE_ERROR ("L2CAP - NULL p_ccb in l2c_ucd_check_pending_info_req");
  541. return (FALSE);
  542. }
  543. for (xx = 0; xx < MAX_L2CAP_CLIENTS; xx++, p_rcb++) {
  544. if (p_rcb->in_use) {
  545. /* if application is waiting UCD reception info */
  546. if (p_rcb->ucd.state & L2C_UCD_STATE_W4_RECEPTION) {
  547. /* if this information is available */
  548. if ( p_ccb->p_lcb->info_rx_bits & (1 << L2CAP_EXTENDED_FEATURES_INFO_TYPE) ) {
  549. if (!(p_ccb->p_lcb->peer_ext_fea & L2CAP_EXTFEA_UCD_RECEPTION)) {
  550. L2CAP_TRACE_WARNING ("L2CAP - UCD is not supported by peer, l2c_ucd_check_pending_info_req");
  551. l2c_ucd_delete_sec_pending_q(p_ccb->p_lcb);
  552. l2cu_release_ccb (p_ccb);
  553. }
  554. p_ccb->p_rcb->ucd.cb_info.pL2CA_UCD_Discover_Cb (p_ccb->p_lcb->remote_bd_addr,
  555. L2CAP_UCD_INFO_TYPE_RECEPTION,
  556. p_ccb->p_lcb->peer_ext_fea & L2CAP_EXTFEA_UCD_RECEPTION);
  557. } else {
  558. pending = TRUE;
  559. if (p_ccb->p_lcb->w4_info_rsp == FALSE) {
  560. l2cu_send_peer_info_req (p_ccb->p_lcb, L2CAP_EXTENDED_FEATURES_INFO_TYPE);
  561. }
  562. }
  563. }
  564. /* if application is waiting for UCD MTU */
  565. if (p_rcb->ucd.state & L2C_UCD_STATE_W4_MTU) {
  566. /* if this information is available */
  567. if ( p_ccb->p_lcb->info_rx_bits & (1 << L2CAP_CONNLESS_MTU_INFO_TYPE)) {
  568. p_ccb->p_rcb->ucd.cb_info.pL2CA_UCD_Discover_Cb (p_ccb->p_lcb->remote_bd_addr,
  569. L2CAP_UCD_INFO_TYPE_MTU,
  570. p_ccb->p_lcb->ucd_mtu);
  571. } else {
  572. pending = TRUE;
  573. if (p_ccb->p_lcb->w4_info_rsp == FALSE) {
  574. l2cu_send_peer_info_req (p_ccb->p_lcb, L2CAP_CONNLESS_MTU_INFO_TYPE);
  575. }
  576. }
  577. }
  578. }
  579. }
  580. return (pending);
  581. }
  582. /*******************************************************************************
  583. **
  584. ** Function l2c_ucd_enqueue_pending_out_sec_q
  585. **
  586. ** Description enqueue outgoing UCD packet into security pending queue
  587. ** and check congestion
  588. **
  589. ** Return None
  590. **
  591. *******************************************************************************/
  592. void l2c_ucd_enqueue_pending_out_sec_q(tL2C_CCB *p_ccb, void *p_data)
  593. {
  594. GKI_enqueue (&p_ccb->p_lcb->ucd_out_sec_pending_q, p_data);
  595. l2cu_check_channel_congestion (p_ccb);
  596. }
  597. /*******************************************************************************
  598. **
  599. ** Function l2c_ucd_check_pending_out_sec_q
  600. **
  601. ** Description check outgoing security
  602. **
  603. ** Return TRUE if any UCD packet for security
  604. **
  605. *******************************************************************************/
  606. BOOLEAN l2c_ucd_check_pending_out_sec_q(tL2C_CCB *p_ccb)
  607. {
  608. UINT8 *p;
  609. UINT16 psm;
  610. BT_HDR *p_buf;
  611. if ( p_ccb->p_lcb->ucd_out_sec_pending_q.count ) {
  612. p_buf = (BT_HDR *)(p_ccb->p_lcb->ucd_out_sec_pending_q.p_first);
  613. p = (UINT8 *)(p_buf + 1) + p_buf->offset;
  614. STREAM_TO_UINT16(psm, p)
  615. p_ccb->chnl_state = CST_ORIG_W4_SEC_COMP;
  616. btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, psm,
  617. p_ccb->p_lcb->handle, CONNLESS_ORIG, &l2c_link_sec_comp, p_ccb);
  618. return (TRUE);
  619. }
  620. return (FALSE);
  621. }
  622. /*******************************************************************************
  623. **
  624. ** Function l2c_ucd_send_pending_out_sec_q
  625. **
  626. ** Description dequeue UCD packet from security pending queue and
  627. ** enqueue it into CCB
  628. **
  629. ** Return None
  630. **
  631. *******************************************************************************/
  632. void l2c_ucd_send_pending_out_sec_q(tL2C_CCB *p_ccb)
  633. {
  634. BT_HDR *p_buf;
  635. if ( p_ccb->p_lcb->ucd_out_sec_pending_q.count ) {
  636. p_buf = (BT_HDR *)GKI_dequeue (&p_ccb->p_lcb->ucd_out_sec_pending_q);
  637. l2c_enqueue_peer_data (p_ccb, (BT_HDR *)p_buf);
  638. l2c_link_check_send_pkts (p_ccb->p_lcb, NULL, NULL);
  639. }
  640. }
  641. /*******************************************************************************
  642. **
  643. ** Function l2c_ucd_discard_pending_out_sec_q
  644. **
  645. ** Description dequeue UCD packet from security pending queue and
  646. ** discard it.
  647. **
  648. ** Return None
  649. **
  650. *******************************************************************************/
  651. void l2c_ucd_discard_pending_out_sec_q(tL2C_CCB *p_ccb)
  652. {
  653. BT_HDR *p_buf;
  654. p_buf = (BT_HDR *)GKI_dequeue (&p_ccb->p_lcb->ucd_out_sec_pending_q);
  655. /* we may need to report to application */
  656. if (p_buf) {
  657. GKI_freebuf (p_buf);
  658. }
  659. }
  660. /*******************************************************************************
  661. **
  662. ** Function l2c_ucd_check_pending_in_sec_q
  663. **
  664. ** Description check incoming security
  665. **
  666. ** Return TRUE if any UCD packet for security
  667. **
  668. *******************************************************************************/
  669. BOOLEAN l2c_ucd_check_pending_in_sec_q(tL2C_CCB *p_ccb)
  670. {
  671. UINT8 *p;
  672. UINT16 psm;
  673. BT_HDR *p_buf;
  674. if ( p_ccb->p_lcb->ucd_in_sec_pending_q.count ) {
  675. p_buf = (BT_HDR *)(p_ccb->p_lcb->ucd_in_sec_pending_q.p_first);
  676. p = (UINT8 *)(p_buf + 1) + p_buf->offset;
  677. STREAM_TO_UINT16(psm, p)
  678. p_ccb->chnl_state = CST_TERM_W4_SEC_COMP;
  679. btm_sec_l2cap_access_req (p_ccb->p_lcb->remote_bd_addr, psm,
  680. p_ccb->p_lcb->handle, CONNLESS_TERM, &l2c_link_sec_comp, p_ccb);
  681. return (TRUE);
  682. }
  683. return (FALSE);
  684. }
  685. /*******************************************************************************
  686. **
  687. ** Function l2c_ucd_send_pending_in_sec_q
  688. **
  689. ** Description dequeue UCD packet from security pending queue and
  690. ** send it to application
  691. **
  692. ** Return None
  693. **
  694. *******************************************************************************/
  695. void l2c_ucd_send_pending_in_sec_q(tL2C_CCB *p_ccb)
  696. {
  697. BT_HDR *p_buf;
  698. if ( p_ccb->p_lcb->ucd_in_sec_pending_q.count ) {
  699. p_buf = (BT_HDR *)GKI_dequeue (&p_ccb->p_lcb->ucd_in_sec_pending_q);
  700. p_ccb->p_rcb->ucd.cb_info.pL2CA_UCD_Data_Cb(p_ccb->p_lcb->remote_bd_addr, (BT_HDR *)p_buf);
  701. }
  702. }
  703. /*******************************************************************************
  704. **
  705. ** Function l2c_ucd_discard_pending_in_sec_q
  706. **
  707. ** Description dequeue UCD packet from security pending queue and
  708. ** discard it.
  709. **
  710. ** Return None
  711. **
  712. *******************************************************************************/
  713. void l2c_ucd_discard_pending_in_sec_q(tL2C_CCB *p_ccb)
  714. {
  715. BT_HDR *p_buf;
  716. p_buf = (BT_HDR *)GKI_dequeue (&p_ccb->p_lcb->ucd_in_sec_pending_q);
  717. if (p_buf) {
  718. GKI_freebuf (p_buf);
  719. }
  720. }
  721. /*******************************************************************************
  722. **
  723. ** Function l2c_ucd_check_rx_pkts
  724. **
  725. ** Description Check if UCD reception is registered.
  726. ** Process received UCD packet if application is expecting.
  727. **
  728. ** Return TRUE if UCD reception is registered
  729. **
  730. *******************************************************************************/
  731. BOOLEAN l2c_ucd_check_rx_pkts(tL2C_LCB *p_lcb, BT_HDR *p_msg)
  732. {
  733. tL2C_CCB *p_ccb;
  734. tL2C_RCB *p_rcb;
  735. if (((p_ccb = l2cu_find_ccb_by_cid (p_lcb, L2CAP_CONNECTIONLESS_CID)) != NULL)
  736. || ((p_rcb = l2cu_find_rcb_by_psm (L2C_UCD_RCB_ID)) != NULL)) {
  737. if (p_ccb == NULL) {
  738. /* Allocate a channel control block */
  739. if ((p_ccb = l2cu_allocate_ccb (p_lcb, 0)) == NULL) {
  740. L2CAP_TRACE_WARNING ("L2CAP - no CCB for UCD reception");
  741. GKI_freebuf (p_msg);
  742. return TRUE;
  743. } else {
  744. /* Set CID for the connection */
  745. p_ccb->local_cid = L2CAP_CONNECTIONLESS_CID;
  746. p_ccb->remote_cid = L2CAP_CONNECTIONLESS_CID;
  747. /* Set the default idle timeout value to use */
  748. p_ccb->fixed_chnl_idle_tout = L2CAP_UCD_IDLE_TIMEOUT;
  749. /* Set the default channel priority value to use */
  750. l2cu_change_pri_ccb (p_ccb, L2CAP_UCD_CH_PRIORITY);
  751. /* Save registration info */
  752. p_ccb->p_rcb = p_rcb;
  753. p_ccb->chnl_state = CST_OPEN;
  754. }
  755. }
  756. l2c_csm_execute(p_ccb, L2CEVT_L2CAP_DATA, p_msg);
  757. return TRUE;
  758. } else {
  759. return FALSE;
  760. }
  761. }
  762. /*******************************************************************************
  763. **
  764. ** Function l2c_ucd_process_event
  765. **
  766. ** Description This is called from main state machine when LCID is connectionless
  767. ** Process the event if it is for UCD.
  768. **
  769. ** Return TRUE if the event is consumed by UCD
  770. ** FALSE if the event needs to be processed by main state machine
  771. **
  772. *******************************************************************************/
  773. BOOLEAN l2c_ucd_process_event(tL2C_CCB *p_ccb, UINT16 event, void *p_data)
  774. {
  775. /* if the event is not processed by this function, this variable will be set to FALSE */
  776. BOOLEAN done = TRUE;
  777. switch (p_ccb->chnl_state) {
  778. case CST_CLOSED:
  779. switch (event) {
  780. case L2CEVT_LP_CONNECT_CFM: /* Link came up */
  781. /* check if waiting for UCD info */
  782. if (!l2c_ucd_check_pending_info_req (p_ccb)) {
  783. /* check if any outgoing UCD packet is waiting security check */
  784. if (!l2c_ucd_check_pending_out_sec_q(p_ccb)) {
  785. p_ccb->chnl_state = CST_OPEN;
  786. }
  787. }
  788. break;
  789. case L2CEVT_L2CAP_DATA: /* Peer data packet rcvd */
  790. GKI_enqueue (&p_ccb->p_lcb->ucd_in_sec_pending_q, p_data);
  791. break;
  792. case L2CEVT_L2CA_DATA_WRITE: /* Upper layer data to send */
  793. l2c_ucd_enqueue_pending_out_sec_q(p_ccb, p_data);
  794. break;
  795. case L2CEVT_L2CAP_INFO_RSP:
  796. /* check if waiting for UCD info */
  797. if (!l2c_ucd_check_pending_info_req (p_ccb)) {
  798. /* check if any outgoing UCD packet is waiting security check */
  799. if (!l2c_ucd_check_pending_out_sec_q(p_ccb)) {
  800. p_ccb->chnl_state = CST_OPEN;
  801. }
  802. }
  803. break;
  804. default:
  805. done = FALSE; /* main state machine continues to process event */
  806. break;
  807. }
  808. break;
  809. case CST_ORIG_W4_SEC_COMP:
  810. switch (event) {
  811. case L2CEVT_SEC_RE_SEND_CMD: /* BTM has enough info to proceed */
  812. /* check if any outgoing UCD packet is waiting security check */
  813. if (!l2c_ucd_check_pending_out_sec_q(p_ccb)) {
  814. p_ccb->chnl_state = CST_OPEN;
  815. }
  816. break;
  817. case L2CEVT_SEC_COMP: /* Security completed success */
  818. p_ccb->chnl_state = CST_OPEN;
  819. l2c_ucd_send_pending_out_sec_q(p_ccb);
  820. if ( p_ccb->p_lcb->ucd_out_sec_pending_q.count ) {
  821. /* start a timer to send next UCD packet in OPEN state */
  822. /* it will prevent stack overflow */
  823. btu_start_timer (&p_ccb->timer_entry, BTU_TTYPE_L2CAP_CHNL, 0);
  824. } else {
  825. /* start a timer for idle timeout of UCD */
  826. btu_start_timer (&p_ccb->timer_entry, BTU_TTYPE_L2CAP_CHNL, p_ccb->fixed_chnl_idle_tout);
  827. }
  828. break;
  829. case L2CEVT_SEC_COMP_NEG:
  830. p_ccb->chnl_state = CST_OPEN;
  831. l2c_ucd_discard_pending_out_sec_q(p_ccb);
  832. /* start a timer for idle timeout of UCD */
  833. btu_start_timer (&p_ccb->timer_entry, BTU_TTYPE_L2CAP_CHNL, p_ccb->fixed_chnl_idle_tout);
  834. break;
  835. case L2CEVT_L2CA_DATA_WRITE: /* Upper layer data to send */
  836. l2c_ucd_enqueue_pending_out_sec_q(p_ccb, p_data);
  837. break;
  838. case L2CEVT_L2CAP_DATA: /* Peer data packet rcvd */
  839. GKI_enqueue (&p_ccb->p_lcb->ucd_in_sec_pending_q, p_data);
  840. break;
  841. case L2CEVT_L2CAP_INFO_RSP:
  842. /* check if waiting for UCD info */
  843. l2c_ucd_check_pending_info_req (p_ccb);
  844. break;
  845. default:
  846. done = FALSE; /* main state machine continues to process event */
  847. break;
  848. }
  849. break;
  850. case CST_TERM_W4_SEC_COMP:
  851. switch (event) {
  852. case L2CEVT_SEC_COMP:
  853. p_ccb->chnl_state = CST_OPEN;
  854. l2c_ucd_send_pending_in_sec_q (p_ccb);
  855. if ( p_ccb->p_lcb->ucd_in_sec_pending_q.count ) {
  856. /* start a timer to check next UCD packet in OPEN state */
  857. /* it will prevent stack overflow */
  858. btu_start_timer (&p_ccb->timer_entry, BTU_TTYPE_L2CAP_CHNL, 0);
  859. } else {
  860. /* start a timer for idle timeout of UCD */
  861. btu_start_timer (&p_ccb->timer_entry, BTU_TTYPE_L2CAP_CHNL, p_ccb->fixed_chnl_idle_tout);
  862. }
  863. break;
  864. case L2CEVT_SEC_COMP_NEG:
  865. if (((tL2C_CONN_INFO *)p_data)->status == BTM_DELAY_CHECK) {
  866. done = FALSE;
  867. break;
  868. }
  869. p_ccb->chnl_state = CST_OPEN;
  870. l2c_ucd_discard_pending_in_sec_q (p_ccb);
  871. /* start a timer for idle timeout of UCD */
  872. btu_start_timer (&p_ccb->timer_entry, BTU_TTYPE_L2CAP_CHNL, p_ccb->fixed_chnl_idle_tout);
  873. break;
  874. case L2CEVT_L2CA_DATA_WRITE: /* Upper layer data to send */
  875. l2c_ucd_enqueue_pending_out_sec_q(p_ccb, p_data);
  876. break;
  877. case L2CEVT_L2CAP_DATA: /* Peer data packet rcvd */
  878. GKI_enqueue (&p_ccb->p_lcb->ucd_in_sec_pending_q, p_data);
  879. break;
  880. case L2CEVT_SEC_RE_SEND_CMD: /* BTM has enough info to proceed */
  881. /* check if any incoming UCD packet is waiting security check */
  882. if (!l2c_ucd_check_pending_in_sec_q(p_ccb)) {
  883. p_ccb->chnl_state = CST_OPEN;
  884. }
  885. break;
  886. case L2CEVT_L2CAP_INFO_RSP:
  887. /* check if waiting for UCD info */
  888. l2c_ucd_check_pending_info_req (p_ccb);
  889. break;
  890. default:
  891. done = FALSE; /* main state machine continues to process event */
  892. break;
  893. }
  894. break;
  895. case CST_OPEN:
  896. switch (event) {
  897. case L2CEVT_L2CAP_DATA: /* Peer data packet rcvd */
  898. /* stop idle timer of UCD */
  899. btu_stop_timer (&p_ccb->timer_entry);
  900. GKI_enqueue (&p_ccb->p_lcb->ucd_in_sec_pending_q, p_data);
  901. l2c_ucd_check_pending_in_sec_q (p_ccb);
  902. break;
  903. case L2CEVT_L2CA_DATA_WRITE: /* Upper layer data to send */
  904. /* stop idle timer of UCD */
  905. btu_stop_timer (&p_ccb->timer_entry);
  906. l2c_ucd_enqueue_pending_out_sec_q(p_ccb, p_data);
  907. /* coverity[check_return] */ /* coverity[unchecked_value] */
  908. /* success changes state, failure stays in current state */
  909. l2c_ucd_check_pending_out_sec_q (p_ccb);
  910. break;
  911. case L2CEVT_TIMEOUT:
  912. /* check if any UCD packet is waiting security check */
  913. if ((!l2c_ucd_check_pending_in_sec_q(p_ccb))
  914. && (!l2c_ucd_check_pending_out_sec_q(p_ccb))) {
  915. l2cu_release_ccb (p_ccb);
  916. }
  917. break;
  918. case L2CEVT_L2CAP_INFO_RSP:
  919. /* check if waiting for UCD info */
  920. l2c_ucd_check_pending_info_req (p_ccb);
  921. break;
  922. default:
  923. done = FALSE; /* main state machine continues to process event */
  924. break;
  925. }
  926. break;
  927. default:
  928. done = FALSE; /* main state machine continues to process event */
  929. break;
  930. }
  931. return done;
  932. }
  933. #endif /* (L2CAP_UCD_INCLUDED == TRUE) */