blob: 63a2cdbe19da94ac66ad20e8969a666a08f3046a [file] [log] [blame]
The Android Open Source Project5738f832012-12-12 16:00:35 -08001/******************************************************************************
2 *
3 * Copyright (C) 2002-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 *
21 * This file contains interfaces which are internal to AVDTP.
22 *
23 ******************************************************************************/
24#ifndef AVDT_INT_H
25#define AVDT_INT_H
26
Pavlin Radoslavov78bcff72015-12-04 17:36:34 -080027#include "osi/include/alarm.h"
Pavlin Radoslavov1a3844f2015-09-25 11:21:15 -070028#include "osi/include/fixed_queue.h"
Pavlin Radoslavov258c2532015-09-27 20:59:05 -070029#include "bt_common.h"
The Android Open Source Project5738f832012-12-12 16:00:35 -080030#include "avdt_api.h"
31#include "avdtc_api.h"
32#include "avdt_defs.h"
33#include "l2c_api.h"
34#include "btm_api.h"
35
Bryce Lee3d6accf2016-05-10 17:10:09 -070036#ifdef __cplusplus
37extern "C" {
38#endif
39
The Android Open Source Project5738f832012-12-12 16:00:35 -080040#ifndef AVDT_DEBUG
Marie Janssend19e0782016-07-15 12:48:27 -070041#define AVDT_DEBUG false
The Android Open Source Project5738f832012-12-12 16:00:35 -080042#endif
The Android Open Source Project5738f832012-12-12 16:00:35 -080043
44/*****************************************************************************
45** constants
46*****************************************************************************/
47
48/* channel types */
49enum {
50 AVDT_CHAN_SIG, /* signaling channel */
51 AVDT_CHAN_MEDIA, /* media channel */
Marie Janssend19e0782016-07-15 12:48:27 -070052#if (AVDT_REPORTING == TRUE)
The Android Open Source Project5738f832012-12-12 16:00:35 -080053 AVDT_CHAN_REPORT, /* reporting channel */
54#endif
55 AVDT_CHAN_NUM_TYPES
56};
57
58/* protocol service capabilities of this AVDTP implementation */
59/* for now multiplexing will be used only for fragmentation */
Marie Janssend19e0782016-07-15 12:48:27 -070060#if (AVDT_MULTIPLEXING == TRUE && AVDT_REPORTING == TRUE)
The Android Open Source Project5738f832012-12-12 16:00:35 -080061#define AVDT_PSC (AVDT_PSC_TRANS | AVDT_PSC_MUX | AVDT_PSC_REPORT | AVDT_PSC_DELAY_RPT)
62#define AVDT_LEG_PSC (AVDT_PSC_TRANS | AVDT_PSC_MUX | AVDT_PSC_REPORT)
63#else /* AVDT_MULTIPLEXING && AVDT_REPORTING */
64
65#if (AVDT_MULTIPLEXING == TRUE)
66#define AVDT_PSC (AVDT_PSC_TRANS | AVDT_PSC_MUX | AVDT_PSC_DELAY_RPT)
67#define AVDT_LEG_PSC (AVDT_PSC_TRANS | AVDT_PSC_MUX)
68#else /* AVDT_MULTIPLEXING */
69
70#if (AVDT_REPORTING == TRUE)
71#define AVDT_PSC (AVDT_PSC_TRANS | AVDT_PSC_REPORT | AVDT_PSC_DELAY_RPT)
72#define AVDT_LEG_PSC (AVDT_PSC_TRANS | AVDT_PSC_REPORT)
73#else /* AVDT_REPORTING */
74#define AVDT_PSC (AVDT_PSC_TRANS | AVDT_PSC_DELAY_RPT)
75#define AVDT_LEG_PSC (AVDT_PSC_TRANS)
76#endif /* AVDT_REPORTING */
77
78#endif /* AVDT_MULTIPLEXING */
79
80#endif /* AVDT_MULTIPLEXING && AVDT_REPORTING */
81
82/* initiator/acceptor signaling roles */
83#define AVDT_CLOSE_ACP 0
84#define AVDT_CLOSE_INT 1
85#define AVDT_OPEN_ACP 2
86#define AVDT_OPEN_INT 3
87
88/* states for avdt_scb_verify */
89#define AVDT_VERIFY_OPEN 0
90#define AVDT_VERIFY_STREAMING 1
91#define AVDT_VERIFY_SUSPEND 2
92#define AVDT_VERIFY_START 3
93
94/* to distinguish CCB events from SCB events */
95#define AVDT_CCB_MKR 0x80
96
97/* offset where AVDTP signaling message header starts in message */
98#define AVDT_HDR_OFFSET (L2CAP_MIN_OFFSET + AVDT_NUM_SEPS)
99
100/* offset where AVDTP signaling message content starts;
101** use the size of a start header since it's the largest possible
102** layout of signaling message in a buffer is:
103**
104** | BT_HDR | SCB handles | L2CAP + HCI header | AVDTP header | data ... |
105**
106** Note that we "hide" the scb handles at the top of the message buffer.
107*/
108#define AVDT_MSG_OFFSET (L2CAP_MIN_OFFSET + AVDT_NUM_SEPS + AVDT_LEN_TYPE_START)
109
Pavlin Radoslavov78bcff72015-12-04 17:36:34 -0800110/* scb transport channel connect timeout value (in milliseconds) */
111#define AVDT_SCB_TC_CONN_TIMEOUT_MS (10 * 1000)
The Android Open Source Project5738f832012-12-12 16:00:35 -0800112
Pavlin Radoslavov78bcff72015-12-04 17:36:34 -0800113/* scb transport channel disconnect timeout value (in milliseconds) */
114#define AVDT_SCB_TC_DISC_TIMEOUT_MS (10 * 1000)
The Android Open Source Project5738f832012-12-12 16:00:35 -0800115
116/* maximum number of command retransmissions */
117#ifndef AVDT_RET_MAX
118#define AVDT_RET_MAX 1
119#endif
120
121
122/* ccb state machine states */
123enum {
124 AVDT_CCB_IDLE_ST,
125 AVDT_CCB_OPENING_ST,
126 AVDT_CCB_OPEN_ST,
127 AVDT_CCB_CLOSING_ST
128};
129
130/* state machine action enumeration list */
131enum {
132 AVDT_CCB_CHAN_OPEN,
133 AVDT_CCB_CHAN_CLOSE,
134 AVDT_CCB_CHK_CLOSE,
135 AVDT_CCB_HDL_DISCOVER_CMD,
136 AVDT_CCB_HDL_DISCOVER_RSP,
137 AVDT_CCB_HDL_GETCAP_CMD,
138 AVDT_CCB_HDL_GETCAP_RSP,
139 AVDT_CCB_HDL_START_CMD,
140 AVDT_CCB_HDL_START_RSP,
141 AVDT_CCB_HDL_SUSPEND_CMD,
142 AVDT_CCB_HDL_SUSPEND_RSP,
143 AVDT_CCB_SND_DISCOVER_CMD,
144 AVDT_CCB_SND_DISCOVER_RSP,
145 AVDT_CCB_SND_GETCAP_CMD,
146 AVDT_CCB_SND_GETCAP_RSP,
147 AVDT_CCB_SND_START_CMD,
148 AVDT_CCB_SND_START_RSP,
149 AVDT_CCB_SND_SUSPEND_CMD,
150 AVDT_CCB_SND_SUSPEND_RSP,
151 AVDT_CCB_CLEAR_CMDS,
152 AVDT_CCB_CMD_FAIL,
153 AVDT_CCB_FREE_CMD,
154 AVDT_CCB_CONG_STATE,
155 AVDT_CCB_RET_CMD,
156 AVDT_CCB_SND_CMD,
157 AVDT_CCB_SND_MSG,
158 AVDT_CCB_SET_RECONN,
159 AVDT_CCB_CLR_RECONN,
160 AVDT_CCB_CHK_RECONN,
161 AVDT_CCB_CHK_TIMER,
162 AVDT_CCB_SET_CONN,
163 AVDT_CCB_SET_DISCONN,
164 AVDT_CCB_DO_DISCONN,
165 AVDT_CCB_LL_CLOSED,
166 AVDT_CCB_LL_OPENED,
167 AVDT_CCB_DEALLOC,
168 AVDT_CCB_NUM_ACTIONS
169};
170
171#define AVDT_CCB_IGNORE AVDT_CCB_NUM_ACTIONS
172
173/* ccb state machine events */
174enum {
175 AVDT_CCB_API_DISCOVER_REQ_EVT,
176 AVDT_CCB_API_GETCAP_REQ_EVT,
177 AVDT_CCB_API_START_REQ_EVT,
178 AVDT_CCB_API_SUSPEND_REQ_EVT,
179 AVDT_CCB_API_DISCOVER_RSP_EVT,
180 AVDT_CCB_API_GETCAP_RSP_EVT,
181 AVDT_CCB_API_START_RSP_EVT,
182 AVDT_CCB_API_SUSPEND_RSP_EVT,
183 AVDT_CCB_API_CONNECT_REQ_EVT,
184 AVDT_CCB_API_DISCONNECT_REQ_EVT,
185 AVDT_CCB_MSG_DISCOVER_CMD_EVT,
186 AVDT_CCB_MSG_GETCAP_CMD_EVT,
187 AVDT_CCB_MSG_START_CMD_EVT,
188 AVDT_CCB_MSG_SUSPEND_CMD_EVT,
189 AVDT_CCB_MSG_DISCOVER_RSP_EVT,
190 AVDT_CCB_MSG_GETCAP_RSP_EVT,
191 AVDT_CCB_MSG_START_RSP_EVT,
192 AVDT_CCB_MSG_SUSPEND_RSP_EVT,
193 AVDT_CCB_RCVRSP_EVT,
194 AVDT_CCB_SENDMSG_EVT,
195 AVDT_CCB_RET_TOUT_EVT,
196 AVDT_CCB_RSP_TOUT_EVT,
197 AVDT_CCB_IDLE_TOUT_EVT,
198 AVDT_CCB_UL_OPEN_EVT,
199 AVDT_CCB_UL_CLOSE_EVT,
200 AVDT_CCB_LL_OPEN_EVT,
201 AVDT_CCB_LL_CLOSE_EVT,
202 AVDT_CCB_LL_CONG_EVT
203};
204
205
206/* scb state machine states; these state values are private to this module so
207** the scb state cannot be read or set by actions functions
208*/
209enum {
210 AVDT_SCB_IDLE_ST,
211 AVDT_SCB_CONF_ST,
212 AVDT_SCB_OPENING_ST,
213 AVDT_SCB_OPEN_ST,
214 AVDT_SCB_STREAM_ST,
215 AVDT_SCB_CLOSING_ST
216};
217
218/* state machine action enumeration list */
219enum {
220 AVDT_SCB_HDL_ABORT_CMD,
221 AVDT_SCB_HDL_ABORT_RSP,
222 AVDT_SCB_HDL_CLOSE_CMD,
223 AVDT_SCB_HDL_CLOSE_RSP,
224 AVDT_SCB_HDL_GETCONFIG_CMD,
225 AVDT_SCB_HDL_GETCONFIG_RSP,
226 AVDT_SCB_HDL_OPEN_CMD,
227 AVDT_SCB_HDL_OPEN_REJ,
228 AVDT_SCB_HDL_OPEN_RSP,
229 AVDT_SCB_HDL_PKT,
230 AVDT_SCB_DROP_PKT,
231 AVDT_SCB_HDL_RECONFIG_CMD,
232 AVDT_SCB_HDL_RECONFIG_RSP,
233 AVDT_SCB_HDL_SECURITY_CMD,
234 AVDT_SCB_HDL_SECURITY_RSP,
235 AVDT_SCB_HDL_SETCONFIG_CMD,
236 AVDT_SCB_HDL_SETCONFIG_REJ,
237 AVDT_SCB_HDL_SETCONFIG_RSP,
238 AVDT_SCB_HDL_START_CMD,
239 AVDT_SCB_HDL_START_RSP,
240 AVDT_SCB_HDL_SUSPEND_CMD,
241 AVDT_SCB_HDL_SUSPEND_RSP,
242 AVDT_SCB_HDL_TC_CLOSE,
Marie Janssend19e0782016-07-15 12:48:27 -0700243#if (AVDT_REPORTING == TRUE)
The Android Open Source Project5738f832012-12-12 16:00:35 -0800244 AVDT_SCB_HDL_TC_CLOSE_STO,
245#endif
246 AVDT_SCB_HDL_TC_OPEN,
Marie Janssend19e0782016-07-15 12:48:27 -0700247#if (AVDT_REPORTING == TRUE)
The Android Open Source Project5738f832012-12-12 16:00:35 -0800248 AVDT_SCB_HDL_TC_OPEN_STO,
249#endif
250 AVDT_SCB_SND_DELAY_RPT_REQ,
251 AVDT_SCB_HDL_DELAY_RPT_CMD,
252 AVDT_SCB_HDL_DELAY_RPT_RSP,
253 AVDT_SCB_HDL_WRITE_REQ,
254 AVDT_SCB_SND_ABORT_REQ,
255 AVDT_SCB_SND_ABORT_RSP,
256 AVDT_SCB_SND_CLOSE_REQ,
257 AVDT_SCB_SND_STREAM_CLOSE,
258 AVDT_SCB_SND_CLOSE_RSP,
259 AVDT_SCB_SND_GETCONFIG_REQ,
260 AVDT_SCB_SND_GETCONFIG_RSP,
261 AVDT_SCB_SND_OPEN_REQ,
262 AVDT_SCB_SND_OPEN_RSP,
263 AVDT_SCB_SND_RECONFIG_REQ,
264 AVDT_SCB_SND_RECONFIG_RSP,
265 AVDT_SCB_SND_SECURITY_REQ,
266 AVDT_SCB_SND_SECURITY_RSP,
267 AVDT_SCB_SND_SETCONFIG_REQ,
268 AVDT_SCB_SND_SETCONFIG_REJ,
269 AVDT_SCB_SND_SETCONFIG_RSP,
270 AVDT_SCB_SND_TC_CLOSE,
271 AVDT_SCB_CB_ERR,
272 AVDT_SCB_CONG_STATE,
273 AVDT_SCB_REJ_STATE,
274 AVDT_SCB_REJ_IN_USE,
275 AVDT_SCB_REJ_NOT_IN_USE,
276 AVDT_SCB_SET_REMOVE,
277 AVDT_SCB_FREE_PKT,
278 AVDT_SCB_CLR_PKT,
279 AVDT_SCB_CHK_SND_PKT,
280 AVDT_SCB_TC_TIMER,
281 AVDT_SCB_CLR_VARS,
282 AVDT_SCB_DEALLOC,
283 AVDT_SCB_NUM_ACTIONS
284};
285
286#define AVDT_SCB_IGNORE AVDT_SCB_NUM_ACTIONS
287
288/* scb state machine events */
289enum {
290 AVDT_SCB_API_REMOVE_EVT,
291 AVDT_SCB_API_WRITE_REQ_EVT,
292 AVDT_SCB_API_GETCONFIG_REQ_EVT,
293 AVDT_SCB_API_DELAY_RPT_REQ_EVT,
294 AVDT_SCB_API_SETCONFIG_REQ_EVT,
295 AVDT_SCB_API_OPEN_REQ_EVT,
296 AVDT_SCB_API_CLOSE_REQ_EVT,
297 AVDT_SCB_API_RECONFIG_REQ_EVT,
298 AVDT_SCB_API_SECURITY_REQ_EVT,
299 AVDT_SCB_API_ABORT_REQ_EVT,
300 AVDT_SCB_API_GETCONFIG_RSP_EVT,
301 AVDT_SCB_API_SETCONFIG_RSP_EVT,
302 AVDT_SCB_API_SETCONFIG_REJ_EVT,
303 AVDT_SCB_API_OPEN_RSP_EVT,
304 AVDT_SCB_API_CLOSE_RSP_EVT,
305 AVDT_SCB_API_RECONFIG_RSP_EVT,
306 AVDT_SCB_API_SECURITY_RSP_EVT,
307 AVDT_SCB_API_ABORT_RSP_EVT,
308 AVDT_SCB_MSG_SETCONFIG_CMD_EVT,
309 AVDT_SCB_MSG_GETCONFIG_CMD_EVT,
310 AVDT_SCB_MSG_OPEN_CMD_EVT,
311 AVDT_SCB_MSG_START_CMD_EVT,
312 AVDT_SCB_MSG_SUSPEND_CMD_EVT,
313 AVDT_SCB_MSG_CLOSE_CMD_EVT,
314 AVDT_SCB_MSG_ABORT_CMD_EVT,
315 AVDT_SCB_MSG_RECONFIG_CMD_EVT,
316 AVDT_SCB_MSG_SECURITY_CMD_EVT,
317 AVDT_SCB_MSG_DELAY_RPT_CMD_EVT,
318 AVDT_SCB_MSG_DELAY_RPT_RSP_EVT,
319 AVDT_SCB_MSG_SETCONFIG_RSP_EVT,
320 AVDT_SCB_MSG_GETCONFIG_RSP_EVT,
321 AVDT_SCB_MSG_OPEN_RSP_EVT,
322 AVDT_SCB_MSG_START_RSP_EVT,
323 AVDT_SCB_MSG_SUSPEND_RSP_EVT,
324 AVDT_SCB_MSG_CLOSE_RSP_EVT,
325 AVDT_SCB_MSG_ABORT_RSP_EVT,
326 AVDT_SCB_MSG_RECONFIG_RSP_EVT,
327 AVDT_SCB_MSG_SECURITY_RSP_EVT,
328 AVDT_SCB_MSG_SETCONFIG_REJ_EVT,
329 AVDT_SCB_MSG_OPEN_REJ_EVT,
330 AVDT_SCB_MSG_START_REJ_EVT,
331 AVDT_SCB_MSG_SUSPEND_REJ_EVT,
332 AVDT_SCB_TC_TOUT_EVT,
333 AVDT_SCB_TC_OPEN_EVT,
334 AVDT_SCB_TC_CLOSE_EVT,
335 AVDT_SCB_TC_CONG_EVT,
336 AVDT_SCB_TC_DATA_EVT,
337 AVDT_SCB_CC_CLOSE_EVT
338};
339
340/* adaption layer number of stream routing table entries */
Marie Janssend19e0782016-07-15 12:48:27 -0700341#if (AVDT_REPORTING == TRUE)
The Android Open Source Project5738f832012-12-12 16:00:35 -0800342/* 2 channels(1 media, 1 report) for each SEP and one for signalling */
343#define AVDT_NUM_RT_TBL ((AVDT_NUM_SEPS<<1) + 1)
344#else
345#define AVDT_NUM_RT_TBL (AVDT_NUM_SEPS + 1)
346#endif
347
348/* adaption layer number of transport channel table entries - moved to target.h
349#define AVDT_NUM_TC_TBL (AVDT_NUM_SEPS + AVDT_NUM_LINKS) */
350
351/* "states" used in transport channel table */
352#define AVDT_AD_ST_UNUSED 0 /* Unused - unallocated */
353#define AVDT_AD_ST_IDLE 1 /* No connection */
354#define AVDT_AD_ST_ACP 2 /* Waiting to accept a connection */
355#define AVDT_AD_ST_INT 3 /* Initiating a connection */
356#define AVDT_AD_ST_CONN 4 /* Waiting for connection confirm */
357#define AVDT_AD_ST_CFG 5 /* Waiting for configuration complete */
358#define AVDT_AD_ST_OPEN 6 /* Channel opened */
359#define AVDT_AD_ST_SEC_INT 7 /* Security process as INT */
360#define AVDT_AD_ST_SEC_ACP 8 /* Security process as ACP */
361
362/* Configuration flags. tAVDT_TC_TBL.cfg_flags */
363#define AVDT_L2C_CFG_IND_DONE (1<<0)
364#define AVDT_L2C_CFG_CFM_DONE (1<<1)
365#define AVDT_L2C_CFG_CONN_INT (1<<2)
366#define AVDT_L2C_CFG_CONN_ACP (1<<3)
367
368
369/* result code for avdt_ad_write_req() (L2CA_DataWrite()) */
370#define AVDT_AD_FAILED L2CAP_DW_FAILED /* FALSE */
371#define AVDT_AD_SUCCESS L2CAP_DW_SUCCESS /* TRUE */
372#define AVDT_AD_CONGESTED L2CAP_DW_CONGESTED /* 2 */
373
374/*****************************************************************************
375** data types
376*****************************************************************************/
377
378/* msg union of all message parameter types */
379typedef union {
380 tAVDT_EVT_HDR hdr;
381 tAVDT_EVT_HDR single;
382 tAVDT_SETCONFIG config_cmd;
383 tAVDT_CONFIG reconfig_cmd;
384 tAVDT_MULTI multi;
385 tAVDT_SECURITY security_cmd;
386 tAVDT_DISCOVER discover_rsp;
387 tAVDT_CONFIG svccap;
388 tAVDT_SECURITY security_rsp;
389 tAVDT_DELAY_RPT delay_rpt_cmd;
390} tAVDT_MSG;
391
392/* data type for AVDT_CCB_API_DISCOVER_REQ_EVT */
393typedef struct {
394 tAVDT_CTRL_CBACK *p_cback;
395 tAVDT_SEP_INFO *p_sep_info;
Marie Janssend19e0782016-07-15 12:48:27 -0700396 uint8_t num_seps;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800397} tAVDT_CCB_API_DISCOVER;
398
399/* data type for AVDT_CCB_API_GETCAP_REQ_EVT */
400typedef struct {
401 tAVDT_EVT_HDR single;
402 tAVDT_CTRL_CBACK *p_cback;
403 tAVDT_CFG *p_cfg;
404} tAVDT_CCB_API_GETCAP;
405
406/* data type for AVDT_CCB_API_CONNECT_REQ_EVT */
407typedef struct {
408 tAVDT_CTRL_CBACK *p_cback;
Marie Janssend19e0782016-07-15 12:48:27 -0700409 uint8_t sec_mask;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800410} tAVDT_CCB_API_CONNECT;
411
412/* data type for AVDT_CCB_API_DISCONNECT_REQ_EVT */
413typedef struct {
414 tAVDT_CTRL_CBACK *p_cback;
415} tAVDT_CCB_API_DISCONNECT;
416
417/* union associated with ccb state machine events */
418typedef union {
419 tAVDT_CCB_API_DISCOVER discover;
420 tAVDT_CCB_API_GETCAP getcap;
421 tAVDT_CCB_API_CONNECT connect;
422 tAVDT_CCB_API_DISCONNECT disconnect;
423 tAVDT_MSG msg;
Marie Janssend19e0782016-07-15 12:48:27 -0700424 bool llcong;
425 uint8_t err_code;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800426} tAVDT_CCB_EVT;
427
428/* channel control block type */
429typedef struct {
430 BD_ADDR peer_addr; /* BD address of peer */
Pavlin Radoslavov78bcff72015-12-04 17:36:34 -0800431 /*
432 * NOTE: idle_ccb_timer, ret_ccb_timer and rsp_ccb_timer are mutually
433 * exclusive - no more than one timer should be running at the same time.
434 */
435 alarm_t *idle_ccb_timer; /* Idle CCB timer entry */
436 alarm_t *ret_ccb_timer; /* Ret CCB timer entry */
437 alarm_t *rsp_ccb_timer; /* Rsp CCB timer entry */
Pavlin Radoslavov1a3844f2015-09-25 11:21:15 -0700438 fixed_queue_t *cmd_q; /* Queue for outgoing command messages */
439 fixed_queue_t *rsp_q; /* Queue for outgoing response and reject messages */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800440 tAVDT_CTRL_CBACK *proc_cback; /* Procedure callback function */
441 tAVDT_CTRL_CBACK *p_conn_cback; /* Connection/disconnection callback function */
442 void *p_proc_data; /* Pointer to data storage for procedure */
443 BT_HDR *p_curr_cmd; /* Current command being sent awaiting response */
444 BT_HDR *p_curr_msg; /* Current message being sent */
445 BT_HDR *p_rx_msg; /* Current message being received */
Marie Janssend19e0782016-07-15 12:48:27 -0700446 bool allocated; /* Whether ccb is allocated */
447 uint8_t state; /* The CCB state machine state */
448 bool ll_opened; /* true if LL is opened */
449 bool proc_busy; /* true when a discover or get capabilities procedure in progress */
450 uint8_t proc_param; /* Procedure parameter; either SEID for get capabilities or number of SEPS for discover */
451 bool cong; /* Whether signaling channel is congested */
452 uint8_t label; /* Message header "label" (sequence number) */
453 bool reconn; /* If true, reinitiate connection after transitioning from CLOSING to IDLE state */
454 uint8_t ret_count; /* Command retransmission count */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800455} tAVDT_CCB;
456
457/* type for action functions */
458typedef void (*tAVDT_CCB_ACTION)(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
459
460/* type for AVDT_SCB_API_WRITE_REQ_EVT */
461typedef struct {
462 BT_HDR *p_buf;
Marie Janssend19e0782016-07-15 12:48:27 -0700463 uint32_t time_stamp;
464#if (AVDT_MULTIPLEXING == TRUE)
465 uint8_t *p_data;
466 uint32_t data_len;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800467#endif
Marie Janssend19e0782016-07-15 12:48:27 -0700468 uint8_t m_pt;
Ganesh Ganapathi Battaead3cde2013-02-05 15:22:31 -0800469 tAVDT_DATA_OPT_MASK opt;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800470} tAVDT_SCB_APIWRITE;
471
472/* type for AVDT_SCB_TC_CLOSE_EVT */
473typedef struct {
Marie Janssend19e0782016-07-15 12:48:27 -0700474 uint8_t old_tc_state; /* channel state before closed */
475 uint8_t tcid; /* TCID */
476 uint8_t type; /* channel type */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800477} tAVDT_SCB_TC_CLOSE;
478
479/* type for scb event data */
480typedef union {
481 tAVDT_MSG msg;
482 tAVDT_SCB_APIWRITE apiwrite;
483 tAVDT_DELAY_RPT apidelay;
484 tAVDT_OPEN open;
485 tAVDT_SCB_TC_CLOSE close;
Marie Janssend19e0782016-07-15 12:48:27 -0700486 bool llcong;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800487 BT_HDR *p_pkt;
488} tAVDT_SCB_EVT;
489
490/* stream control block type */
491typedef struct {
492 tAVDT_CS cs; /* stream creation struct */
493 tAVDT_CFG curr_cfg; /* current configuration */
494 tAVDT_CFG req_cfg; /* requested configuration */
Pavlin Radoslavov78bcff72015-12-04 17:36:34 -0800495 alarm_t *transport_channel_timer; /* transport channel connect timer */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800496 BT_HDR *p_pkt; /* packet waiting to be sent */
497 tAVDT_CCB *p_ccb; /* ccb associated with this scb */
Marie Janssend19e0782016-07-15 12:48:27 -0700498 uint16_t media_seq; /* media packet sequence number */
499 bool allocated; /* whether scb is allocated or unused */
500 bool in_use; /* whether stream being used by peer */
501 uint8_t role; /* initiator/acceptor role in current procedure */
502 bool remove; /* whether CB is marked for removal */
503 uint8_t state; /* state machine state */
504 uint8_t peer_seid; /* SEID of peer stream */
505 uint8_t curr_evt; /* current event; set only by state machine */
506 bool cong; /* Whether media transport channel is congested */
507 uint8_t close_code; /* Error code received in close response */
508#if (AVDT_MULTIPLEXING == TRUE)
Pavlin Radoslavov1a3844f2015-09-25 11:21:15 -0700509 fixed_queue_t *frag_q; /* Queue for outgoing media fragments */
Marie Janssend19e0782016-07-15 12:48:27 -0700510 uint32_t frag_off; /* length of already received media fragments */
511 uint32_t frag_org_len; /* original length before fragmentation of receiving media packet */
512 uint8_t *p_next_frag; /* next fragment to send */
513 uint8_t *p_media_buf; /* buffer for media packet assigned by AVDT_SetMediaBuf */
514 uint32_t media_buf_len; /* length of buffer for media packet assigned by AVDT_SetMediaBuf */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800515#endif
516} tAVDT_SCB;
517
518/* type for action functions */
519typedef void (*tAVDT_SCB_ACTION)(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
520
521/* adaption layer type for transport channel table */
522typedef struct {
Marie Janssend19e0782016-07-15 12:48:27 -0700523 uint16_t peer_mtu; /* L2CAP mtu of the peer device */
524 uint16_t my_mtu; /* Our MTU for this channel */
525 uint16_t my_flush_to; /* Our flush timeout for this channel */
526 uint16_t lcid;
527 uint8_t tcid; /* transport channel id */
528 uint8_t ccb_idx; /* channel control block associated with this tc */
529 uint8_t state; /* transport channel state */
530 uint8_t cfg_flags; /* L2CAP configuration flags */
531 uint8_t id;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800532} tAVDT_TC_TBL;
533
534/* adaption layer type for stream routing table */
535typedef struct {
Marie Janssend19e0782016-07-15 12:48:27 -0700536 uint16_t lcid; /* L2CAP LCID of the associated transport channel */
537 uint8_t scb_hdl; /* stream control block associated with this tc */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800538} tAVDT_RT_TBL;
539
540
541/* adaption layer control block */
542typedef struct {
543 tAVDT_RT_TBL rt_tbl[AVDT_NUM_LINKS][AVDT_NUM_RT_TBL];
544 tAVDT_TC_TBL tc_tbl[AVDT_NUM_TC_TBL];
Marie Janssend19e0782016-07-15 12:48:27 -0700545 uint8_t lcid_tbl[MAX_L2CAP_CHANNELS]; /* map LCID to tc_tbl index */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800546} tAVDT_AD;
547
548/* Control block for AVDT */
549typedef struct {
550 tAVDT_REG rcb; /* registration control block */
551 tAVDT_CCB ccb[AVDT_NUM_LINKS]; /* channel control blocks */
552 tAVDT_SCB scb[AVDT_NUM_SEPS]; /* stream control blocks */
553 tAVDT_AD ad; /* adaption layer control block */
554 tAVDTC_CTRL_CBACK *p_conf_cback; /* conformance callback function */
555 tAVDT_CCB_ACTION *p_ccb_act; /* pointer to CCB action functions */
556 tAVDT_SCB_ACTION *p_scb_act; /* pointer to SCB action functions */
557 tAVDT_CTRL_CBACK *p_conn_cback; /* connection callback function */
Marie Janssend19e0782016-07-15 12:48:27 -0700558 uint8_t trace_level; /* trace level */
The Android Open Source Project5738f832012-12-12 16:00:35 -0800559} tAVDT_CB;
560
561
562/*****************************************************************************
563** function declarations
564*****************************************************************************/
565
566/* CCB function declarations */
567extern void avdt_ccb_init(void);
Marie Janssend19e0782016-07-15 12:48:27 -0700568extern void avdt_ccb_event(tAVDT_CCB *p_ccb, uint8_t event, tAVDT_CCB_EVT *p_data);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800569extern tAVDT_CCB *avdt_ccb_by_bd(BD_ADDR bd_addr);
570extern tAVDT_CCB *avdt_ccb_alloc(BD_ADDR bd_addr);
571extern void avdt_ccb_dealloc(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
Marie Janssend19e0782016-07-15 12:48:27 -0700572extern uint8_t avdt_ccb_to_idx(tAVDT_CCB *p_ccb);
573extern tAVDT_CCB *avdt_ccb_by_idx(uint8_t idx);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800574
575/* CCB action functions */
576extern void avdt_ccb_chan_open(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
577extern void avdt_ccb_chan_close(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
578extern void avdt_ccb_chk_close(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
579extern void avdt_ccb_hdl_discover_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
580extern void avdt_ccb_hdl_discover_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
581extern void avdt_ccb_hdl_getcap_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
582extern void avdt_ccb_hdl_getcap_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
583extern void avdt_ccb_hdl_start_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
584extern void avdt_ccb_hdl_start_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
585extern void avdt_ccb_hdl_suspend_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
586extern void avdt_ccb_hdl_suspend_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
587extern void avdt_ccb_snd_discover_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
588extern void avdt_ccb_snd_discover_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
589extern void avdt_ccb_snd_getcap_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
590extern void avdt_ccb_snd_getcap_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
591extern void avdt_ccb_snd_start_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
592extern void avdt_ccb_snd_start_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
593extern void avdt_ccb_snd_suspend_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
594extern void avdt_ccb_snd_suspend_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
595extern void avdt_ccb_clear_cmds(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
596extern void avdt_ccb_cmd_fail(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
597extern void avdt_ccb_free_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
598extern void avdt_ccb_cong_state(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
599extern void avdt_ccb_ret_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
600extern void avdt_ccb_snd_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
601extern void avdt_ccb_snd_msg(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
602extern void avdt_ccb_set_reconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
603extern void avdt_ccb_clr_reconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
604extern void avdt_ccb_chk_reconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
605extern void avdt_ccb_chk_timer(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
606extern void avdt_ccb_set_conn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
607extern void avdt_ccb_set_disconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
608extern void avdt_ccb_do_disconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
609extern void avdt_ccb_ll_closed(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
610extern void avdt_ccb_ll_opened(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data);
611
612/* SCB function prototypes */
Marie Janssend19e0782016-07-15 12:48:27 -0700613extern void avdt_scb_event(tAVDT_SCB *p_scb, uint8_t event, tAVDT_SCB_EVT *p_data);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800614extern void avdt_scb_init(void);
615extern tAVDT_SCB *avdt_scb_alloc(tAVDT_CS *p_cs);
616extern void avdt_scb_dealloc(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
Marie Janssend19e0782016-07-15 12:48:27 -0700617extern uint8_t avdt_scb_to_hdl(tAVDT_SCB *p_scb);
618extern tAVDT_SCB *avdt_scb_by_hdl(uint8_t hdl);
619extern uint8_t avdt_scb_verify(tAVDT_CCB *p_ccb, uint8_t state, uint8_t *p_seid, uint16_t num_seid, uint8_t *p_err_code);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800620extern void avdt_scb_peer_seid_list(tAVDT_MULTI *p_multi);
Marie Janssend19e0782016-07-15 12:48:27 -0700621extern uint32_t avdt_scb_gen_ssrc(tAVDT_SCB *p_scb);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800622
623/* SCB action functions */
624extern void avdt_scb_hdl_abort_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
625extern void avdt_scb_hdl_abort_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
626extern void avdt_scb_hdl_close_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
627extern void avdt_scb_hdl_close_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
628extern void avdt_scb_hdl_getconfig_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
629extern void avdt_scb_hdl_getconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
630extern void avdt_scb_hdl_open_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
631extern void avdt_scb_hdl_open_rej(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
632extern void avdt_scb_hdl_open_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
633extern void avdt_scb_hdl_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
634extern void avdt_scb_drop_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
635extern void avdt_scb_hdl_reconfig_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
636extern void avdt_scb_hdl_reconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
637extern void avdt_scb_hdl_security_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
638extern void avdt_scb_hdl_security_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
639extern void avdt_scb_hdl_setconfig_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
640extern void avdt_scb_hdl_setconfig_rej(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
641extern void avdt_scb_hdl_setconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
642extern void avdt_scb_hdl_start_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
643extern void avdt_scb_hdl_start_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
644extern void avdt_scb_hdl_suspend_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
645extern void avdt_scb_hdl_suspend_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
646extern void avdt_scb_snd_delay_rpt_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
647extern void avdt_scb_hdl_delay_rpt_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
648extern void avdt_scb_hdl_delay_rpt_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
649extern void avdt_scb_hdl_tc_close(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
650extern void avdt_scb_hdl_tc_open(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
651extern void avdt_scb_hdl_tc_close_sto(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
652extern void avdt_scb_hdl_tc_open_sto(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
653extern void avdt_scb_hdl_write_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
654extern void avdt_scb_snd_abort_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
655extern void avdt_scb_snd_abort_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
656extern void avdt_scb_snd_close_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
657extern void avdt_scb_snd_stream_close(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
658extern void avdt_scb_snd_close_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
659extern void avdt_scb_snd_getconfig_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
660extern void avdt_scb_snd_getconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
661extern void avdt_scb_snd_open_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
662extern void avdt_scb_snd_open_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
663extern void avdt_scb_snd_reconfig_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
664extern void avdt_scb_snd_reconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
665extern void avdt_scb_snd_security_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
666extern void avdt_scb_snd_security_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
667extern void avdt_scb_snd_setconfig_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
668extern void avdt_scb_snd_setconfig_rej(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
669extern void avdt_scb_snd_setconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
670extern void avdt_scb_snd_tc_close(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
671extern void avdt_scb_cb_err(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
672extern void avdt_scb_cong_state(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
673extern void avdt_scb_rej_state(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
674extern void avdt_scb_rej_in_use(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
675extern void avdt_scb_rej_not_in_use(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
676extern void avdt_scb_set_remove(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
677extern void avdt_scb_free_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
678extern void avdt_scb_chk_snd_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
679extern void avdt_scb_clr_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
Pavlin Radoslavov78bcff72015-12-04 17:36:34 -0800680extern void avdt_scb_transport_channel_timer(tAVDT_SCB *p_scb,
681 tAVDT_SCB_EVT *p_data);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800682extern void avdt_scb_clr_vars(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
Marie Janssend19e0782016-07-15 12:48:27 -0700683extern void avdt_scb_queue_frags(tAVDT_SCB *p_scb, uint8_t **pp_data, uint32_t *p_data_len);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800684
685/* msg function declarations */
Marie Janssend19e0782016-07-15 12:48:27 -0700686extern bool avdt_msg_send(tAVDT_CCB *p_ccb, BT_HDR *p_msg);
687extern void avdt_msg_send_cmd(tAVDT_CCB *p_ccb, void *p_scb, uint8_t sig_id, tAVDT_MSG *p_params);
688extern void avdt_msg_send_rsp(tAVDT_CCB *p_ccb, uint8_t sig_id, tAVDT_MSG *p_params);
689extern void avdt_msg_send_rej(tAVDT_CCB *p_ccb, uint8_t sig_id, tAVDT_MSG *p_params);
690extern void avdt_msg_send_grej(tAVDT_CCB *p_ccb, uint8_t sig_id, tAVDT_MSG *p_params);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800691extern void avdt_msg_ind(tAVDT_CCB *p_ccb, BT_HDR *p_buf);
692
693/* adaption layer function declarations */
694extern void avdt_ad_init(void);
Marie Janssend19e0782016-07-15 12:48:27 -0700695extern uint8_t avdt_ad_type_to_tcid(uint8_t type, tAVDT_SCB *p_scb);
696extern tAVDT_TC_TBL *avdt_ad_tc_tbl_by_st(uint8_t type, tAVDT_CCB *p_ccb, uint8_t state);
697extern tAVDT_TC_TBL *avdt_ad_tc_tbl_by_lcid(uint16_t lcid);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800698extern tAVDT_TC_TBL *avdt_ad_tc_tbl_alloc(tAVDT_CCB *p_ccb);
Marie Janssend19e0782016-07-15 12:48:27 -0700699extern uint8_t avdt_ad_tc_tbl_to_idx(tAVDT_TC_TBL *p_tbl);
700extern void avdt_ad_tc_close_ind(tAVDT_TC_TBL *p_tbl, uint16_t reason);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800701extern void avdt_ad_tc_open_ind(tAVDT_TC_TBL *p_tbl);
Marie Janssend19e0782016-07-15 12:48:27 -0700702extern void avdt_ad_tc_cong_ind(tAVDT_TC_TBL *p_tbl, bool is_congested);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800703extern void avdt_ad_tc_data_ind(tAVDT_TC_TBL *p_tbl, BT_HDR *p_buf);
Marie Janssend19e0782016-07-15 12:48:27 -0700704extern tAVDT_TC_TBL *avdt_ad_tc_tbl_by_type(uint8_t type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb);
705extern uint8_t avdt_ad_write_req(uint8_t type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb, BT_HDR *p_buf);
706extern void avdt_ad_open_req(uint8_t type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb, uint8_t role);
707extern void avdt_ad_close_req(uint8_t type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800708
Pavlin Radoslavov78bcff72015-12-04 17:36:34 -0800709extern void avdt_ccb_idle_ccb_timer_timeout(void *data);
710extern void avdt_ccb_ret_ccb_timer_timeout(void *data);
711extern void avdt_ccb_rsp_ccb_timer_timeout(void *data);
712extern void avdt_scb_transport_channel_timer_timeout(void *data);
The Android Open Source Project5738f832012-12-12 16:00:35 -0800713
714/*****************************************************************************
715** macros
716*****************************************************************************/
717
718/* we store the scb and the label in the layer_specific field of the
719** current cmd
720*/
721#define AVDT_BLD_LAYERSPEC(ls, msg, label) \
722 ls = (((label) << 4) | (msg))
723
Marie Janssend19e0782016-07-15 12:48:27 -0700724#define AVDT_LAYERSPEC_LABEL(ls) ((uint8_t)((ls) >> 4))
The Android Open Source Project5738f832012-12-12 16:00:35 -0800725
Marie Janssend19e0782016-07-15 12:48:27 -0700726#define AVDT_LAYERSPEC_MSG(ls) ((uint8_t)((ls) & 0x000F))
The Android Open Source Project5738f832012-12-12 16:00:35 -0800727
728/*****************************************************************************
729** global data
730*****************************************************************************/
The Android Open Source Project5738f832012-12-12 16:00:35 -0800731
732/******************************************************************************
733** Main Control Block
734*******************************************************************************/
Pavlin Radoslavov37c1b5f2016-10-14 15:47:27 -0700735extern tAVDT_CB avdt_cb;
The Android Open Source Project5738f832012-12-12 16:00:35 -0800736
737/* L2CAP callback registration structure */
738extern const tL2CAP_APPL_INFO avdt_l2c_appl;
739
740/* reject message event lookup table */
Marie Janssend19e0782016-07-15 12:48:27 -0700741extern const uint8_t avdt_msg_rej_2_evt[];
The Android Open Source Project5738f832012-12-12 16:00:35 -0800742#ifdef __cplusplus
743}
744#endif
745
746#endif /* AVDT_INT_H */