Home | History | Annotate | Download | only in l2cap
      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  *
     21  *  This file contains L2CAP internal definitions
     22  *
     23  ******************************************************************************/
     24 #ifndef L2C_INT_H
     25 #define L2C_INT_H
     26 
     27 #include "l2c_api.h"
     28 #include "l2cdefs.h"
     29 #include "gki.h"
     30 #include "btm_api.h"
     31 
     32 #define L2CAP_MIN_MTU   48      /* Minimum acceptable MTU is 48 bytes */
     33 
     34 /* Timeouts. Since L2CAP works off a 1-second list, all are in seconds.
     35 */
     36 #define L2CAP_LINK_ROLE_SWITCH_TOUT  10           /* 10 seconds */
     37 #define L2CAP_LINK_CONNECT_TOUT      60           /* 30 seconds */
     38 #define L2CAP_LINK_CONNECT_TOUT_EXT  120          /* 120 seconds */
     39 #define L2CAP_ECHO_RSP_TOUT          30           /* 30 seconds */
     40 #define L2CAP_LINK_FLOW_CONTROL_TOUT 2            /* 2  seconds */
     41 #define L2CAP_LINK_DISCONNECT_TOUT   30           /* 30 seconds */
     42 
     43 #ifndef L2CAP_CHNL_CONNECT_TOUT      /* BTIF needs to override for internal project needs */
     44 #define L2CAP_CHNL_CONNECT_TOUT      60           /* 60 seconds */
     45 #endif
     46 
     47 #define L2CAP_CHNL_CONNECT_TOUT_EXT  120          /* 120 seconds */
     48 #define L2CAP_CHNL_CFG_TIMEOUT       30           /* 30 seconds */
     49 #define L2CAP_CHNL_DISCONNECT_TOUT   10           /* 10 seconds */
     50 #define L2CAP_DELAY_CHECK_SM4        2            /* 2 seconds */
     51 #define L2CAP_WAIT_INFO_RSP_TOUT     3            /* 3 seconds */
     52 #define L2CAP_WAIT_UNPARK_TOUT       2            /* 2 seconds */
     53 #define L2CAP_LINK_INFO_RESP_TOUT    2            /* 2  seconds */
     54 #define L2CAP_BLE_LINK_CONNECT_TOUT  30           /* 30 seconds */
     55 #define L2CAP_BLE_CONN_PARAM_UPD_TOUT   30           /* 30 seconds */
     56 
     57 /* quick timer uses millisecond unit */
     58 #define L2CAP_DEFAULT_RETRANS_TOUT   2000         /* 2000 milliseconds */
     59 #define L2CAP_DEFAULT_MONITOR_TOUT   12000        /* 12000 milliseconds */
     60 #define L2CAP_FCR_ACK_TOUT           200          /* 200 milliseconds */
     61 
     62 /* Define the possible L2CAP channel states. The names of
     63 ** the states may seem a bit strange, but they are taken from
     64 ** the Bluetooth specification.
     65 */
     66 typedef enum
     67 {
     68     CST_CLOSED,                           /* Channel is in clodes state           */
     69     CST_ORIG_W4_SEC_COMP,                 /* Originator waits security clearence  */
     70     CST_TERM_W4_SEC_COMP,                 /* Acceptor waits security clearence    */
     71     CST_W4_L2CAP_CONNECT_RSP,             /* Waiting for peer conenct response    */
     72     CST_W4_L2CA_CONNECT_RSP,              /* Waiting for upper layer connect rsp  */
     73     CST_CONFIG,                           /* Negotiating configuration            */
     74     CST_OPEN,                             /* Data transfer state                  */
     75     CST_W4_L2CAP_DISCONNECT_RSP,          /* Waiting for peer disconnect rsp      */
     76     CST_W4_L2CA_DISCONNECT_RSP            /* Waiting for upper layer disc rsp     */
     77 } tL2C_CHNL_STATE;
     78 
     79 /* Define the possible L2CAP link states
     80 */
     81 typedef enum
     82 {
     83     LST_DISCONNECTED,
     84     LST_CONNECT_HOLDING,
     85     LST_CONNECTING_WAIT_SWITCH,
     86     LST_CONNECTING,
     87     LST_CONNECTED,
     88     LST_DISCONNECTING
     89 } tL2C_LINK_STATE;
     90 
     91 
     92 
     93 /* Define input events to the L2CAP link and channel state machines. The names
     94 ** of the events may seem a bit strange, but they are taken from
     95 ** the Bluetooth specification.
     96 */
     97 #define L2CEVT_LP_CONNECT_CFM          0          /* Lower layer connect confirm          */
     98 #define L2CEVT_LP_CONNECT_CFM_NEG      1          /* Lower layer connect confirm (failed) */
     99 #define L2CEVT_LP_CONNECT_IND          2          /* Lower layer connect indication       */
    100 #define L2CEVT_LP_DISCONNECT_IND       3          /* Lower layer disconnect indication    */
    101 #define L2CEVT_LP_QOS_CFM              4          /* Lower layer QOS confirmation         */
    102 #define L2CEVT_LP_QOS_CFM_NEG          5          /* Lower layer QOS confirmation (failed)*/
    103 #define L2CEVT_LP_QOS_VIOLATION_IND    6          /* Lower layer QOS violation indication */
    104 
    105 #define L2CEVT_SEC_COMP                7          /* Security cleared successfully        */
    106 #define L2CEVT_SEC_COMP_NEG            8          /* Security procedure failed            */
    107 
    108 #define L2CEVT_L2CAP_CONNECT_REQ      10          /* Peer connection request              */
    109 #define L2CEVT_L2CAP_CONNECT_RSP      11          /* Peer connection response             */
    110 #define L2CEVT_L2CAP_CONNECT_RSP_PND  12          /* Peer connection response pending     */
    111 #define L2CEVT_L2CAP_CONNECT_RSP_NEG  13          /* Peer connection response (failed)    */
    112 #define L2CEVT_L2CAP_CONFIG_REQ       14          /* Peer configuration request           */
    113 #define L2CEVT_L2CAP_CONFIG_RSP       15          /* Peer configuration response          */
    114 #define L2CEVT_L2CAP_CONFIG_RSP_NEG   16          /* Peer configuration response (failed) */
    115 #define L2CEVT_L2CAP_DISCONNECT_REQ   17          /* Peer disconnect request              */
    116 #define L2CEVT_L2CAP_DISCONNECT_RSP   18          /* Peer disconnect response             */
    117 #define L2CEVT_L2CAP_INFO_RSP         19          /* Peer information response            */
    118 #define L2CEVT_L2CAP_DATA             20          /* Peer data                            */
    119 
    120 #define L2CEVT_L2CA_CONNECT_REQ       21          /* Upper layer connect request          */
    121 #define L2CEVT_L2CA_CONNECT_RSP       22          /* Upper layer connect response         */
    122 #define L2CEVT_L2CA_CONNECT_RSP_NEG   23          /* Upper layer connect response (failed)*/
    123 #define L2CEVT_L2CA_CONFIG_REQ        24          /* Upper layer config request           */
    124 #define L2CEVT_L2CA_CONFIG_RSP        25          /* Upper layer config response          */
    125 #define L2CEVT_L2CA_CONFIG_RSP_NEG    26          /* Upper layer config response (failed) */
    126 #define L2CEVT_L2CA_DISCONNECT_REQ    27          /* Upper layer disconnect request       */
    127 #define L2CEVT_L2CA_DISCONNECT_RSP    28          /* Upper layer disconnect response      */
    128 #define L2CEVT_L2CA_DATA_READ         29          /* Upper layer data read                */
    129 #define L2CEVT_L2CA_DATA_WRITE        30          /* Upper layer data write               */
    130 #define L2CEVT_L2CA_FLUSH_REQ         31          /* Upper layer flush                    */
    131 
    132 #define L2CEVT_TIMEOUT                32          /* Timeout                              */
    133 #define L2CEVT_SEC_RE_SEND_CMD        33          /* btm_sec has enough info to proceed   */
    134 
    135 #define L2CEVT_ACK_TIMEOUT            34          /* RR delay timeout                     */
    136 
    137 
    138 /* Bitmask to skip over Broadcom feature reserved (ID) to avoid sending two
    139    successive ID values, '0' id only or both */
    140 #define L2CAP_ADJ_BRCM_ID           0x1
    141 #define L2CAP_ADJ_ZERO_ID           0x2
    142 #define L2CAP_ADJ_ID                0x3
    143 
    144 /* Return values for l2cu_process_peer_cfg_req() */
    145 #define L2CAP_PEER_CFG_UNACCEPTABLE     0
    146 #define L2CAP_PEER_CFG_OK               1
    147 #define L2CAP_PEER_CFG_DISCONNECT       2
    148 
    149 /* eL2CAP option constants */
    150 #define L2CAP_MIN_RETRANS_TOUT          2000    /* Min retransmission timeout if no flush timeout or PBF */
    151 #define L2CAP_MIN_MONITOR_TOUT          12000   /* Min monitor timeout if no flush timeout or PBF */
    152 
    153 #define L2CAP_MAX_FCR_CFG_TRIES         2       /* Config attempts before disconnecting */
    154 
    155 /* Only compiled in when in test mode. Production devices must not include
    156 */
    157 #if L2CAP_CORRUPT_ERTM_PKTS == TRUE
    158 
    159 /* These are used for conformance and corruption testing only */
    160 typedef struct
    161 {
    162     BOOLEAN in_use;                 /* TRUE if test in progress */
    163     UINT8   type;                   /* Type of test to run or turns off random test */
    164     UINT8   freq;                   /* One-shot or random */
    165     BOOLEAN is_rx;                  /* TRUE if incoming packets */
    166     UINT16  count;                  /* How many I-frames to drop in a row; used only with one-shot tests */
    167 } tL2C_FCR_TEST_CFG;
    168 
    169 typedef struct
    170 {
    171     BOOLEAN in_use;                 /* TRUE if test in progress */
    172     UINT8   skip_sframe_count;      /* Number of S-Frames to skip sending */
    173 } tL2C_FCR_CFM_TEST_CB;
    174 
    175 typedef struct
    176 {
    177     tL2C_FCR_TEST_CFG       cfg;    /* Current corruption test configuration */
    178     tL2C_FCR_CFM_TEST_CB    cfm;    /* Conformance test structure */
    179 } tL2C_FCR_TEST_CB;
    180 
    181 #endif /* L2CAP_CORRUPT_ERTM_PKTS == TRUE */
    182 
    183 typedef struct
    184 {
    185     UINT8       next_tx_seq;                /* Next sequence number to be Tx'ed         */
    186     UINT8       last_rx_ack;                /* Last sequence number ack'ed by the peer  */
    187     UINT8       next_seq_expected;          /* Next peer sequence number expected       */
    188     UINT8       last_ack_sent;              /* Last peer sequence number ack'ed         */
    189     UINT8       num_tries;                  /* Number of retries to send a packet       */
    190     UINT8       max_held_acks;              /* Max acks we can hold before sending      */
    191 
    192     BOOLEAN     remote_busy;                /* TRUE if peer has flowed us off           */
    193     BOOLEAN     local_busy;                 /* TRUE if we have flowed off the peer      */
    194 
    195     BOOLEAN     rej_sent;                   /* Reject was sent                          */
    196     BOOLEAN     srej_sent;                  /* Selective Reject was sent                */
    197     BOOLEAN     wait_ack;                   /* Transmitter is waiting ack (poll sent)   */
    198     BOOLEAN     rej_after_srej;             /* Send a REJ when SREJ clears              */
    199 
    200     BOOLEAN     send_f_rsp;                 /* We need to send an F-bit response        */
    201 
    202     UINT16      rx_sdu_len;                 /* Length of the SDU being received         */
    203     BT_HDR      *p_rx_sdu;                  /* Buffer holding the SDU being received    */
    204     BUFFER_Q    waiting_for_ack_q;          /* Buffers sent and waiting for peer to ack */
    205     BUFFER_Q    srej_rcv_hold_q;            /* Buffers rcvd but held pending SREJ rsp   */
    206     BUFFER_Q    retrans_q;                  /* Buffers being retransmitted              */
    207 
    208     TIMER_LIST_ENT ack_timer;               /* Timer delaying RR                        */
    209     TIMER_LIST_ENT mon_retrans_timer;       /* Timer Monitor or Retransmission          */
    210 
    211 #if (L2CAP_ERTM_STATS == TRUE)
    212     UINT32      connect_tick_count;         /* Time channel was established             */
    213     UINT32      ertm_pkt_counts[2];         /* Packets sent and received                */
    214     UINT32      ertm_byte_counts[2];        /* Bytes   sent and received                */
    215     UINT32      s_frames_sent[4];           /* S-frames sent (RR, REJ, RNR, SREJ)       */
    216     UINT32      s_frames_rcvd[4];           /* S-frames rcvd (RR, REJ, RNR, SREJ)       */
    217     UINT32      xmit_window_closed;         /* # of times the xmit window was closed    */
    218     UINT32      controller_idle;            /* # of times less than 2 packets in controller */
    219                                             /* when the xmit window was closed          */
    220     UINT32      pkts_retransmitted;         /* # of packets that were retransmitted     */
    221     UINT32      retrans_touts;              /* # of retransmission timouts              */
    222     UINT32      xmit_ack_touts;             /* # of xmit ack timouts                    */
    223 
    224 #define L2CAP_ERTM_STATS_NUM_AVG 10
    225 #define L2CAP_ERTM_STATS_AVG_NUM_SAMPLES 100
    226     UINT32      ack_delay_avg_count;
    227     UINT32      ack_delay_avg_index;
    228     UINT32      throughput_start;
    229     UINT32      throughput[L2CAP_ERTM_STATS_NUM_AVG];
    230     UINT32      ack_delay_avg[L2CAP_ERTM_STATS_NUM_AVG];
    231     UINT32      ack_delay_min[L2CAP_ERTM_STATS_NUM_AVG];
    232     UINT32      ack_delay_max[L2CAP_ERTM_STATS_NUM_AVG];
    233     UINT32      ack_q_count_avg[L2CAP_ERTM_STATS_NUM_AVG];
    234     UINT32      ack_q_count_min[L2CAP_ERTM_STATS_NUM_AVG];
    235     UINT32      ack_q_count_max[L2CAP_ERTM_STATS_NUM_AVG];
    236 #endif
    237 
    238 #if L2CAP_CORRUPT_ERTM_PKTS == TRUE
    239     tL2C_FCR_TEST_CB test_cb;               /* Used for SVT and UPF testing */
    240 #endif
    241 
    242 } tL2C_FCRB;
    243 
    244 
    245 /* Define a registration control block. Every application (e.g. RFCOMM, SDP,
    246 ** TCS etc) that registers with L2CAP is assigned one of these.
    247 */
    248 #if (L2CAP_UCD_INCLUDED == TRUE)
    249 #define L2C_UCD_RCB_ID              0x00
    250 #define L2C_UCD_STATE_UNUSED        0x00
    251 #define L2C_UCD_STATE_W4_DATA       0x01
    252 #define L2C_UCD_STATE_W4_RECEPTION  0x02
    253 #define L2C_UCD_STATE_W4_MTU        0x04
    254 
    255 typedef struct
    256 {
    257     UINT8               state;
    258     tL2CAP_UCD_CB_INFO  cb_info;
    259 } tL2C_UCD_REG;
    260 #endif
    261 
    262 typedef struct
    263 {
    264     BOOLEAN                 in_use;
    265     UINT16                  psm;
    266     UINT16                  real_psm;               /* This may be a dummy RCB for an o/b connection but */
    267                                                     /* this is the real PSM that we need to connect to   */
    268 #if (L2CAP_UCD_INCLUDED == TRUE)
    269     tL2C_UCD_REG            ucd;
    270 #endif
    271 
    272     tL2CAP_APPL_INFO        api;
    273 } tL2C_RCB;
    274 
    275 
    276 /* Define a channel control block (CCB). There may be many channel control blocks
    277 ** between the same two Bluetooth devices (i.e. on the same link).
    278 ** Each CCB has unique local and remote CIDs. All channel control blocks on
    279 ** the same physical link and are chained together.
    280 */
    281 typedef struct t_l2c_ccb
    282 {
    283     BOOLEAN             in_use;                 /* TRUE when in use, FALSE when not */
    284     tL2C_CHNL_STATE     chnl_state;             /* Channel state                    */
    285 
    286     struct t_l2c_ccb    *p_next_ccb;            /* Next CCB in the chain            */
    287     struct t_l2c_ccb    *p_prev_ccb;            /* Previous CCB in the chain        */
    288     struct t_l2c_linkcb *p_lcb;                 /* Link this CCB is assigned to     */
    289 
    290     UINT16              local_cid;              /* Local CID                        */
    291     UINT16              remote_cid;             /* Remote CID                       */
    292 
    293     TIMER_LIST_ENT      timer_entry;            /* CCB Timer List Entry             */
    294 
    295     tL2C_RCB            *p_rcb;                 /* Registration CB for this Channel */
    296 
    297 #define IB_CFG_DONE     0x01
    298 #define OB_CFG_DONE     0x02
    299 #define RECONFIG_FLAG   0x04                    /* True after initial configuration */
    300 #define CFG_DONE_MASK   (IB_CFG_DONE | OB_CFG_DONE)
    301 
    302     UINT8               config_done;            /* Configuration flag word         */
    303     UINT8               local_id;               /* Transaction ID for local trans  */
    304     UINT8               remote_id;              /* Transaction ID for local  */
    305 
    306 #define CCB_FLAG_NO_RETRY       0x01            /* no more retry */
    307 #define CCB_FLAG_SENT_PENDING   0x02            /* already sent pending response */
    308     UINT8               flags;
    309 
    310     tL2CAP_CFG_INFO     our_cfg;                /* Our saved configuration options    */
    311     tL2CAP_CH_CFG_BITS  peer_cfg_bits;          /* Store what peer wants to configure */
    312     tL2CAP_CFG_INFO     peer_cfg;               /* Peer's saved configuration options */
    313 
    314     BUFFER_Q            xmit_hold_q;            /* Transmit data hold queue         */
    315 
    316     BOOLEAN             cong_sent;              /* Set when congested status sent   */
    317     UINT16              buff_quota;             /* Buffer quota before sending congestion   */
    318 
    319     tL2CAP_CHNL_PRIORITY ccb_priority;          /* Channel priority                 */
    320     tL2CAP_CHNL_DATA_RATE tx_data_rate;         /* Channel Tx data rate             */
    321     tL2CAP_CHNL_DATA_RATE rx_data_rate;         /* Channel Rx data rate             */
    322 
    323     /* Fields used for eL2CAP */
    324     tL2CAP_ERTM_INFO    ertm_info;
    325     tL2C_FCRB           fcrb;
    326     UINT16              tx_mps;                 /* TX MPS adjusted based on current controller */
    327     UINT16              max_rx_mtu;
    328     UINT8               fcr_cfg_tries;          /* Max number of negotiation attempts */
    329     BOOLEAN             peer_cfg_already_rejected; /* If mode rejected once, set to TRUE */
    330     BOOLEAN             out_cfg_fcr_present;    /* TRUE if cfg response shoulkd include fcr options */
    331 
    332 #define L2CAP_CFG_FCS_OUR   0x01                /* Our desired config FCS option */
    333 #define L2CAP_CFG_FCS_PEER  0x02                /* Peer's desired config FCS option */
    334 #define L2CAP_BYPASS_FCS    (L2CAP_CFG_FCS_OUR | L2CAP_CFG_FCS_PEER)
    335     UINT8               bypass_fcs;
    336 
    337 #if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE)
    338     BOOLEAN             is_flushable;                   /* TRUE if channel is flushable     */
    339 #endif
    340 
    341 #if (L2CAP_NUM_FIXED_CHNLS > 0) || (L2CAP_UCD_INCLUDED == TRUE)
    342     UINT16              fixed_chnl_idle_tout;   /* Idle timeout to use for the fixed channel       */
    343 #endif
    344 
    345 } tL2C_CCB;
    346 
    347 /***********************************************************************
    348 ** Define a queue of linked CCBs.
    349 */
    350 typedef struct
    351 {
    352     tL2C_CCB        *p_first_ccb;               /* The first channel in this queue */
    353     tL2C_CCB        *p_last_ccb;                /* The last  channel in this queue */
    354 } tL2C_CCB_Q;
    355 
    356 #if (L2CAP_ROUND_ROBIN_CHANNEL_SERVICE == TRUE)
    357 
    358 /* Round-Robin service for the same priority channels */
    359 #define L2CAP_NUM_CHNL_PRIORITY     3           /* Total number of priority group (high, medium, low)*/
    360 #define L2CAP_CHNL_PRIORITY_WEIGHT  5           /* weight per priority for burst transmission quota */
    361 #define L2CAP_GET_PRIORITY_QUOTA(pri) ((L2CAP_NUM_CHNL_PRIORITY - (pri)) * L2CAP_CHNL_PRIORITY_WEIGHT)
    362 
    363 /* CCBs within the same LCB are served in round robin with priority                       */
    364 /* It will make sure that low priority channel (for example, HF signaling on RFCOMM)      */
    365 /* can be sent to headset even if higher priority channel (for example, AV media channel) */
    366 /* is congested.                                                                          */
    367 
    368 typedef struct
    369 {
    370     tL2C_CCB        *p_serve_ccb;               /* current serving ccb within priority group */
    371     tL2C_CCB        *p_first_ccb;               /* first ccb of priority group */
    372     UINT8           num_ccb;                    /* number of channels in priority group */
    373     UINT8           quota;                      /* burst transmission quota */
    374 } tL2C_RR_SERV;
    375 
    376 #endif /* (L2CAP_ROUND_ROBIN_CHANNEL_SERVICE == TRUE) */
    377 
    378 /* Define a link control block. There is one link control block between
    379 ** this device and any other device (i.e. BD ADDR).
    380 */
    381 typedef struct t_l2c_linkcb
    382 {
    383     BOOLEAN             in_use;                     /* TRUE when in use, FALSE when not */
    384     tL2C_LINK_STATE     link_state;
    385 
    386     TIMER_LIST_ENT      timer_entry;                /* Timer list entry for timeout evt */
    387     UINT16              handle;                     /* The handle used with LM          */
    388 
    389     tL2C_CCB_Q          ccb_queue;                  /* Queue of CCBs on this LCB        */
    390 
    391     tL2C_CCB            *p_pending_ccb;             /* ccb of waiting channel during link disconnect */
    392     TIMER_LIST_ENT      info_timer_entry;           /* Timer entry for info resp timeout evt */
    393     BD_ADDR             remote_bd_addr;             /* The BD address of the remote     */
    394 
    395     UINT8               link_role;                  /* Master or slave                  */
    396     UINT8               id;
    397     UINT8               cur_echo_id;                /* Current id value for echo request */
    398     tL2CA_ECHO_RSP_CB   *p_echo_rsp_cb;             /* Echo response callback           */
    399     UINT16              idle_timeout;               /* Idle timeout                     */
    400     BOOLEAN             is_bonding;                 /* True - link active only for bonding */
    401 
    402     UINT16              link_flush_tout;            /* Flush timeout used               */
    403 
    404     UINT16              link_xmit_quota;            /* Num outstanding pkts allowed     */
    405     UINT16              sent_not_acked;             /* Num packets sent but not acked   */
    406 
    407     BOOLEAN             partial_segment_being_sent; /* Set TRUE when a partial segment  */
    408                                                     /* is being sent.                   */
    409     BOOLEAN             w4_info_rsp;                /* TRUE when info request is active */
    410     UINT8               info_rx_bits;               /* set 1 if received info type */
    411     UINT32              peer_ext_fea;               /* Peer's extended features mask    */
    412     BUFFER_Q            link_xmit_data_q;           /* Transmit data buffer queue       */
    413 
    414     UINT8               peer_chnl_mask[L2CAP_FIXED_CHNL_ARRAY_SIZE];
    415 #if (L2CAP_UCD_INCLUDED == TRUE)
    416     UINT16              ucd_mtu;                    /* peer MTU on UCD */
    417     BUFFER_Q            ucd_out_sec_pending_q;      /* Security pending outgoing UCD packet  */
    418     BUFFER_Q            ucd_in_sec_pending_q;       /* Security pending incoming UCD packet  */
    419 #endif
    420 
    421 #if (L2CAP_HOST_FLOW_CTRL == TRUE)
    422     UINT16              link_pkts_unacked;          /* Packets received but not acked   */
    423     UINT16              link_ack_thresh;            /* Threshold at which to ack pkts   */
    424 #endif
    425 
    426     BT_HDR              *p_hcit_rcv_acl;            /* Current HCIT ACL buf being rcvd  */
    427     UINT16              idle_timeout_sv;            /* Save current Idle timeout        */
    428     UINT8               acl_priority;               /* L2C_PRIORITY_NORMAL or L2C_PRIORITY_HIGH */
    429     tL2CA_NOCP_CB       *p_nocp_cb;                 /* Num Cmpl pkts callback           */
    430 
    431 #if (L2CAP_NUM_FIXED_CHNLS > 0)
    432     tL2C_CCB            *p_fixed_ccbs[L2CAP_NUM_FIXED_CHNLS];
    433     UINT16              disc_reason;
    434 #endif
    435 
    436     tBT_TRANSPORT       transport;
    437 #if (BLE_INCLUDED == TRUE)
    438     tBLE_ADDR_TYPE      ble_addr_type;
    439 
    440 #define L2C_BLE_CONN_UPDATE_DISABLE 0x1  /* disable update connection parameters */
    441 #define L2C_BLE_NEW_CONN_PARAM      0x2  /* new connection parameter to be set */
    442 #define L2C_BLE_UPDATE_PENDING      0x4  /* waiting for connection update finished */
    443 #define L2C_BLE_NOT_DEFAULT_PARAM   0x8  /* not using default connection parameters */
    444     UINT8               conn_update_mask;
    445 
    446     UINT16              min_interval; /* parameters as requested by peripheral */
    447     UINT16              max_interval;
    448     UINT16              latency;
    449     UINT16              timeout;
    450 
    451 #endif
    452 
    453 #if (L2CAP_ROUND_ROBIN_CHANNEL_SERVICE == TRUE)
    454     /* each priority group is limited burst transmission  */
    455     /* round robin service for the same priority channels */
    456     tL2C_RR_SERV        rr_serv[L2CAP_NUM_CHNL_PRIORITY];
    457     UINT8               rr_pri;                             /* current serving priority group */
    458 #endif
    459 
    460 } tL2C_LCB;
    461 
    462 /* Define the L2CAP control structure
    463 */
    464 typedef struct
    465 {
    466     UINT8           l2cap_trace_level;
    467     UINT16          controller_xmit_window;         /* Total ACL window for all links   */
    468 
    469     UINT16          round_robin_quota;              /* Round-robin link quota           */
    470     UINT16          round_robin_unacked;            /* Round-robin unacked              */
    471     BOOLEAN         check_round_robin;              /* Do a round robin check           */
    472 
    473     BOOLEAN         is_cong_cback_context;
    474 
    475     tL2C_LCB        lcb_pool[MAX_L2CAP_LINKS];      /* Link Control Block pool          */
    476     tL2C_CCB        ccb_pool[MAX_L2CAP_CHANNELS];   /* Channel Control Block pool       */
    477     tL2C_RCB        rcb_pool[MAX_L2CAP_CLIENTS];    /* Registration info pool           */
    478 
    479     tL2C_CCB        *p_free_ccb_first;              /* Pointer to first free CCB        */
    480     tL2C_CCB        *p_free_ccb_last;               /* Pointer to last  free CCB        */
    481 
    482     UINT8           desire_role;                    /* desire to be master/slave when accepting a connection */
    483     BOOLEAN         disallow_switch;                /* FALSE, to allow switch at create conn */
    484     UINT16          num_lm_acl_bufs;                /* # of ACL buffers on controller   */
    485     UINT16          idle_timeout;                   /* Idle timeout                     */
    486 
    487     BUFFER_Q        rcv_hold_q;                     /* Recv pending queue               */
    488     TIMER_LIST_ENT  rcv_hold_tle;                   /* Timer list entry for rcv hold    */
    489 
    490     tL2C_LCB        *p_cur_hcit_lcb;                /* Current HCI Transport buffer     */
    491     UINT16          num_links_active;               /* Number of links active           */
    492 
    493 #if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE)
    494     UINT16          non_flushable_pbf;              /* L2CAP_PKT_START_NON_FLUSHABLE if controller supports */
    495                                                     /* Otherwise, L2CAP_PKT_START */
    496     BOOLEAN         is_flush_active;                /* TRUE if an HCI_Enhanced_Flush has been sent */
    497 #endif
    498 
    499 #if L2CAP_CONFORMANCE_TESTING == TRUE
    500     UINT32          test_info_resp;                 /* Conformance testing needs a dynamic response */
    501 #endif
    502 
    503 #if (L2CAP_NUM_FIXED_CHNLS > 0)
    504     tL2CAP_FIXED_CHNL_REG   fixed_reg[L2CAP_NUM_FIXED_CHNLS];   /* Reg info for fixed channels */
    505 #endif
    506 
    507 #if (BLE_INCLUDED == TRUE)
    508     UINT16                   num_ble_links_active;               /* Number of LE links active           */
    509     BOOLEAN                  is_ble_connecting;
    510     BD_ADDR                  ble_connecting_bda;
    511     UINT16                   controller_le_xmit_window;         /* Total ACL window for all links   */
    512     UINT16                   num_lm_ble_bufs;                   /* # of ACL buffers on controller   */
    513     UINT16                   ble_round_robin_quota;              /* Round-robin link quota           */
    514     UINT16                   ble_round_robin_unacked;            /* Round-robin unacked              */
    515     BOOLEAN                  ble_check_round_robin;              /* Do a round robin check           */
    516 #endif
    517 
    518     tL2CA_ECHO_DATA_CB      *p_echo_data_cb;                /* Echo data callback */
    519 
    520 #if (defined(L2CAP_HIGH_PRI_CHAN_QUOTA_IS_CONFIGURABLE) && (L2CAP_HIGH_PRI_CHAN_QUOTA_IS_CONFIGURABLE == TRUE))
    521     UINT16              high_pri_min_xmit_quota;    /* Minimum number of ACL credit for high priority link */
    522 #endif /* (L2CAP_HIGH_PRI_CHAN_QUOTA_IS_CONFIGURABLE == TRUE) */
    523 
    524     UINT16          dyn_psm;
    525 } tL2C_CB;
    526 
    527 
    528 
    529 /* Define a structure that contains the information about a connection.
    530 ** This structure is used to pass between functions, and not all the
    531 ** fields will always be filled in.
    532 */
    533 typedef struct
    534 {
    535     BD_ADDR         bd_addr;                        /* Remote BD address        */
    536     UINT8           status;                         /* Connection status        */
    537     UINT16          psm;                            /* PSM of the connection    */
    538     UINT16          l2cap_result;                   /* L2CAP result             */
    539     UINT16          l2cap_status;                   /* L2CAP status             */
    540     UINT16          remote_cid;                     /* Remote CID               */
    541 } tL2C_CONN_INFO;
    542 
    543 
    544 typedef void (tL2C_FCR_MGMT_EVT_HDLR) (UINT8, tL2C_CCB *);
    545 
    546 /* The offset in a buffer that L2CAP will use when building commands.
    547 */
    548 #define L2CAP_SEND_CMD_OFFSET       0
    549 
    550 
    551 /* Number of ACL buffers to use for high priority channel
    552 */
    553 #if (!defined(L2CAP_HIGH_PRI_CHAN_QUOTA_IS_CONFIGURABLE) || (L2CAP_HIGH_PRI_CHAN_QUOTA_IS_CONFIGURABLE == FALSE))
    554 #define L2CAP_HIGH_PRI_MIN_XMIT_QUOTA_A     (L2CAP_HIGH_PRI_MIN_XMIT_QUOTA)
    555 #else
    556 #define L2CAP_HIGH_PRI_MIN_XMIT_QUOTA_A     (l2cb.high_pri_min_xmit_quota)
    557 #endif
    558 
    559 #ifdef __cplusplus
    560 extern "C" {
    561 #endif
    562 
    563 
    564 /* L2CAP global data
    565 ************************************
    566 */
    567 #if (!defined L2C_DYNAMIC_MEMORY) || (L2C_DYNAMIC_MEMORY == FALSE)
    568 L2C_API extern tL2C_CB  l2cb;
    569 #else
    570 L2C_API extern tL2C_CB *l2c_cb_ptr;
    571 #define l2cb (*l2c_cb_ptr)
    572 #endif
    573 
    574 
    575 /* Functions provided by l2c_main.c
    576 ************************************
    577 */
    578 extern void     l2c_init (void);
    579 extern void     l2c_process_timeout (TIMER_LIST_ENT *p_tle);
    580 extern UINT8    l2c_data_write (UINT16 cid, BT_HDR *p_data, UINT16 flag);
    581 extern void     l2c_rcv_acl_data (BT_HDR *p_msg);
    582 extern void     l2c_process_held_packets (BOOLEAN timed_out);
    583 
    584 /* Functions provided by l2c_utils.c
    585 ************************************
    586 */
    587 extern tL2C_LCB *l2cu_allocate_lcb (BD_ADDR p_bd_addr, BOOLEAN is_bonding, tBT_TRANSPORT transport);
    588 extern BOOLEAN  l2cu_start_post_bond_timer (UINT16 handle);
    589 extern void     l2cu_release_lcb (tL2C_LCB *p_lcb);
    590 extern tL2C_LCB *l2cu_find_lcb_by_bd_addr (BD_ADDR p_bd_addr, tBT_TRANSPORT transport);
    591 extern tL2C_LCB *l2cu_find_lcb_by_handle (UINT16 handle);
    592 extern void     l2cu_update_lcb_4_bonding (BD_ADDR p_bd_addr, BOOLEAN is_bonding);
    593 
    594 extern UINT8    l2cu_get_conn_role (tL2C_LCB *p_this_lcb);
    595 extern BOOLEAN  l2cu_set_acl_priority (BD_ADDR bd_addr, UINT8 priority, BOOLEAN reset_after_rs);
    596 
    597 extern void     l2cu_enqueue_ccb (tL2C_CCB *p_ccb);
    598 extern void     l2cu_dequeue_ccb (tL2C_CCB *p_ccb);
    599 extern void     l2cu_change_pri_ccb (tL2C_CCB *p_ccb, tL2CAP_CHNL_PRIORITY priority);
    600 
    601 extern tL2C_CCB *l2cu_allocate_ccb (tL2C_LCB *p_lcb, UINT16 cid);
    602 extern void     l2cu_release_ccb (tL2C_CCB *p_ccb);
    603 extern tL2C_CCB *l2cu_find_ccb_by_cid (tL2C_LCB *p_lcb, UINT16 local_cid);
    604 extern tL2C_CCB *l2cu_find_ccb_by_remote_cid (tL2C_LCB *p_lcb, UINT16 remote_cid);
    605 extern void     l2cu_adj_id (tL2C_LCB *p_lcb, UINT8 adj_mask);
    606 extern BOOLEAN  l2c_is_cmd_rejected (UINT8 cmd_code, UINT8 id, tL2C_LCB *p_lcb);
    607 
    608 extern void     l2cu_send_peer_cmd_reject (tL2C_LCB *p_lcb, UINT16 reason,
    609                                            UINT8 rem_id,UINT16 p1, UINT16 p2);
    610 extern void     l2cu_send_peer_connect_req (tL2C_CCB *p_ccb);
    611 extern void     l2cu_send_peer_connect_rsp (tL2C_CCB *p_ccb, UINT16 result, UINT16 status);
    612 extern void     l2cu_send_peer_config_req (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
    613 extern void     l2cu_send_peer_config_rsp (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
    614 extern void     l2cu_send_peer_config_rej (tL2C_CCB *p_ccb, UINT8 *p_data, UINT16 data_len, UINT16 rej_len);
    615 extern void     l2cu_send_peer_disc_req (tL2C_CCB *p_ccb);
    616 extern void     l2cu_send_peer_disc_rsp (tL2C_LCB *p_lcb, UINT8 remote_id, UINT16 local_cid, UINT16 remote_cid);
    617 extern void     l2cu_send_peer_echo_req (tL2C_LCB *p_lcb, UINT8 *p_data, UINT16 data_len);
    618 extern void     l2cu_send_peer_echo_rsp (tL2C_LCB *p_lcb, UINT8 id, UINT8 *p_data, UINT16 data_len);
    619 extern void     l2cu_send_peer_info_rsp (tL2C_LCB *p_lcb, UINT8 id, UINT16 info_type);
    620 extern void     l2cu_reject_connection (tL2C_LCB *p_lcb, UINT16 remote_cid, UINT8 rem_id, UINT16 result);
    621 extern void     l2cu_send_peer_info_req (tL2C_LCB *p_lcb, UINT16 info_type);
    622 extern void     l2cu_set_acl_hci_header (BT_HDR *p_buf, tL2C_CCB *p_ccb);
    623 extern void     l2cu_check_channel_congestion (tL2C_CCB *p_ccb);
    624 extern void     l2cu_disconnect_chnl (tL2C_CCB *p_ccb);
    625 
    626 #if (L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE)
    627 extern void     l2cu_set_non_flushable_pbf(BOOLEAN);
    628 #endif
    629 
    630 #if (BLE_INCLUDED == TRUE)
    631 extern void l2cu_send_peer_ble_par_req (tL2C_LCB *p_lcb, UINT16 min_int, UINT16 max_int, UINT16 latency, UINT16 timeout);
    632 extern void l2cu_send_peer_ble_par_rsp (tL2C_LCB *p_lcb, UINT16 reason, UINT8 rem_id);
    633 #endif
    634 
    635 extern BOOLEAN l2cu_initialize_fixed_ccb (tL2C_LCB *p_lcb, UINT16 fixed_cid, tL2CAP_FCR_OPTS *p_fcr);
    636 extern void    l2cu_no_dynamic_ccbs (tL2C_LCB *p_lcb);
    637 extern void    l2cu_process_fixed_chnl_resp (tL2C_LCB *p_lcb);
    638 
    639 /* Functions provided by l2c_ucd.c
    640 ************************************
    641 */
    642 #if (L2CAP_UCD_INCLUDED == TRUE)
    643 void l2c_ucd_delete_sec_pending_q(tL2C_LCB  *p_lcb);
    644 void l2c_ucd_enqueue_pending_out_sec_q(tL2C_CCB  *p_ccb, void *p_data);
    645 BOOLEAN l2c_ucd_check_pending_info_req(tL2C_CCB  *p_ccb);
    646 BOOLEAN l2c_ucd_check_pending_out_sec_q(tL2C_CCB  *p_ccb);
    647 void l2c_ucd_send_pending_out_sec_q(tL2C_CCB  *p_ccb);
    648 void l2c_ucd_discard_pending_out_sec_q(tL2C_CCB  *p_ccb);
    649 BOOLEAN l2c_ucd_check_pending_in_sec_q(tL2C_CCB  *p_ccb);
    650 void l2c_ucd_send_pending_in_sec_q(tL2C_CCB  *p_ccb);
    651 void l2c_ucd_discard_pending_in_sec_q(tL2C_CCB  *p_ccb);
    652 BOOLEAN l2c_ucd_check_rx_pkts(tL2C_LCB  *p_lcb, BT_HDR *p_msg);
    653 BOOLEAN l2c_ucd_process_event(tL2C_CCB *p_ccb, UINT16 event, void *p_data);
    654 #endif
    655 
    656 #if (BLE_INCLUDED == TRUE)
    657 extern void l2cu_send_peer_ble_par_req (tL2C_LCB *p_lcb, UINT16 min_int, UINT16 max_int, UINT16 latency, UINT16 timeout);
    658 extern void l2cu_send_peer_ble_par_rsp (tL2C_LCB *p_lcb, UINT16 reason, UINT8 rem_id);
    659 #endif
    660 
    661 extern BOOLEAN l2cu_initialize_fixed_ccb (tL2C_LCB *p_lcb, UINT16 fixed_cid, tL2CAP_FCR_OPTS *p_fcr);
    662 extern void    l2cu_no_dynamic_ccbs (tL2C_LCB *p_lcb);
    663 extern void    l2cu_process_fixed_chnl_resp (tL2C_LCB *p_lcb);
    664 
    665 
    666 /* Functions provided for Broadcom Aware
    667 ****************************************
    668 */
    669 extern BOOLEAN  l2cu_check_feature_req (tL2C_LCB *p_lcb, UINT8 id, UINT8 *p_data, UINT16 data_len);
    670 extern void     l2cu_check_feature_rsp (tL2C_LCB *p_lcb, UINT8 id, UINT8 *p_data, UINT16 data_len);
    671 extern void     l2cu_send_feature_req (tL2C_CCB *p_ccb);
    672 
    673 extern tL2C_RCB *l2cu_allocate_rcb (UINT16 psm);
    674 extern tL2C_RCB *l2cu_find_rcb_by_psm (UINT16 psm);
    675 extern void     l2cu_release_rcb (tL2C_RCB *p_rcb);
    676 
    677 extern UINT8    l2cu_process_peer_cfg_req (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
    678 extern void     l2cu_process_peer_cfg_rsp (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
    679 extern void     l2cu_process_our_cfg_req (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
    680 extern void     l2cu_process_our_cfg_rsp (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
    681 
    682 extern void     l2cu_device_reset (void);
    683 extern tL2C_LCB *l2cu_find_lcb_by_state (tL2C_LINK_STATE state);
    684 extern BOOLEAN  l2cu_lcb_disconnecting (void);
    685 
    686 extern BOOLEAN l2cu_create_conn (tL2C_LCB *p_lcb, tBT_TRANSPORT transport);
    687 extern BOOLEAN l2cu_create_conn_after_switch (tL2C_LCB *p_lcb);
    688 extern BT_HDR *l2cu_get_next_buffer_to_send (tL2C_LCB *p_lcb);
    689 extern void    l2cu_resubmit_pending_sec_req (BD_ADDR p_bda);
    690 extern void    l2cu_initialize_amp_ccb (tL2C_LCB *p_lcb);
    691 extern void    l2cu_adjust_out_mps (tL2C_CCB *p_ccb);
    692 
    693 /* Functions provided by l2c_link.c
    694 ************************************
    695 */
    696 extern BOOLEAN  l2c_link_hci_conn_req (BD_ADDR bd_addr);
    697 extern BOOLEAN  l2c_link_hci_conn_comp (UINT8 status, UINT16 handle, BD_ADDR p_bda);
    698 extern BOOLEAN  l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason);
    699 extern BOOLEAN  l2c_link_hci_qos_violation (UINT16 handle);
    700 extern void     l2c_link_timeout (tL2C_LCB *p_lcb);
    701 extern void     l2c_info_timeout (tL2C_LCB *p_lcb);
    702 extern void     l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf);
    703 extern void     l2c_link_adjust_allocation (void);
    704 extern void     l2c_link_process_num_completed_pkts (UINT8 *p);
    705 extern void     l2c_link_process_num_completed_blocks (UINT8 controller_id, UINT8 *p, UINT16 evt_len);
    706 extern void     l2c_link_processs_num_bufs (UINT16 num_lm_acl_bufs);
    707 extern UINT8    l2c_link_pkts_rcvd (UINT16 *num_pkts, UINT16 *handles);
    708 extern void     l2c_link_role_changed (BD_ADDR bd_addr, UINT8 new_role, UINT8 hci_status);
    709 extern void     l2c_link_sec_comp (BD_ADDR p_bda, tBT_TRANSPORT trasnport, void *p_ref_data, UINT8 status);
    710 extern void     l2c_link_segments_xmitted (BT_HDR *p_msg);
    711 extern void     l2c_pin_code_request (BD_ADDR bd_addr);
    712 extern void     l2c_link_adjust_chnl_allocation (void);
    713 
    714 #if (BLE_INCLUDED == TRUE)
    715 extern void     l2c_link_processs_ble_num_bufs (UINT16 num_lm_acl_bufs);
    716 #endif
    717 
    718 #if ((BTM_PWR_MGR_INCLUDED == TRUE) && L2CAP_WAKE_PARKED_LINK == TRUE)
    719 extern BOOLEAN  l2c_link_check_power_mode ( tL2C_LCB *p_lcb );
    720 #define L2C_LINK_CHECK_POWER_MODE(x) l2c_link_check_power_mode ((x))
    721 #else
    722 #define L2C_LINK_CHECK_POWER_MODE(x) (FALSE)
    723 #endif
    724 
    725 #if L2CAP_CONFORMANCE_TESTING == TRUE
    726 /* Used only for conformance testing */
    727 L2C_API extern void l2cu_set_info_rsp_mask (UINT32 mask);
    728 #endif
    729 
    730 /* Functions provided by l2c_csm.c
    731 ************************************
    732 */
    733 extern void l2c_csm_execute (tL2C_CCB *p_ccb, UINT16 event, void *p_data);
    734 
    735 L2C_API extern BT_HDR   *l2cap_link_chk_pkt_start(BT_HDR *);    /* Called at start of rcv to check L2CAP segmentation */
    736 L2C_API extern BOOLEAN   l2cap_link_chk_pkt_end (void);         /* Called at end   of rcv to check L2CAP segmentation */
    737 
    738 L2C_API extern void     l2c_enqueue_peer_data (tL2C_CCB *p_ccb, BT_HDR *p_buf);
    739 
    740 
    741 /* Functions provided by l2c_fcr.c
    742 ************************************
    743 */
    744 extern void     l2c_fcr_cleanup (tL2C_CCB *p_ccb);
    745 extern void     l2c_fcr_proc_pdu (tL2C_CCB *p_ccb, BT_HDR *p_buf);
    746 extern void     l2c_fcr_proc_tout (tL2C_CCB *p_ccb);
    747 extern void     l2c_fcr_proc_ack_tout (tL2C_CCB *p_ccb);
    748 extern void     l2c_fcr_send_S_frame (tL2C_CCB *p_ccb, UINT16 function_code, UINT16 pf_bit);
    749 extern BT_HDR   *l2c_fcr_clone_buf (BT_HDR *p_buf, UINT16 new_offset, UINT16 no_of_bytes, UINT8 pool);
    750 extern BOOLEAN  l2c_fcr_is_flow_controlled (tL2C_CCB *p_ccb);
    751 extern BT_HDR   *l2c_fcr_get_next_xmit_sdu_seg (tL2C_CCB *p_ccb, UINT16 max_packet_length);
    752 extern void     l2c_fcr_start_timer (tL2C_CCB *p_ccb);
    753 
    754 /* Configuration negotiation */
    755 extern UINT8    l2c_fcr_chk_chan_modes (tL2C_CCB *p_ccb);
    756 extern BOOLEAN  l2c_fcr_adj_our_req_options (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
    757 extern void     l2c_fcr_adj_our_rsp_options (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_peer_cfg);
    758 extern BOOLEAN  l2c_fcr_renegotiate_chan(tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
    759 extern UINT8    l2c_fcr_process_peer_cfg_req(tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg);
    760 extern void     l2c_fcr_adj_monitor_retran_timeout (tL2C_CCB *p_ccb);
    761 extern void     l2c_fcr_stop_timer (tL2C_CCB *p_ccb);
    762 
    763 /* Functions provided by l2c_ble.c
    764 ************************************
    765 */
    766 #if (BLE_INCLUDED == TRUE)
    767 extern BOOLEAN l2cble_create_conn (tL2C_LCB *p_lcb);
    768 extern void l2cble_process_sig_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len);
    769 extern void l2cble_conn_comp (UINT16 handle, UINT8 role, BD_ADDR bda, tBLE_ADDR_TYPE type,
    770                               UINT16 conn_interval, UINT16 conn_latency, UINT16 conn_timeout);
    771 extern BOOLEAN l2cble_init_direct_conn (tL2C_LCB *p_lcb);
    772 extern void l2cble_notify_le_connection (BD_ADDR bda);
    773 extern void l2c_ble_link_adjust_allocation (void);
    774 extern void l2cble_process_conn_update_evt (UINT16 handle, UINT8 status);
    775 
    776 #if (defined BLE_LLT_INCLUDED) && (BLE_LLT_INCLUDED == TRUE)
    777 extern void l2cble_process_rc_param_request_evt(UINT16 handle, UINT16 int_min, UINT16 int_max,
    778                                                         UINT16 latency, UINT16 timeout);
    779 #endif
    780 #endif
    781 extern void l2cu_process_fixed_disc_cback (tL2C_LCB *p_lcb);
    782 
    783 #ifdef __cplusplus
    784 }
    785 #endif
    786 
    787 #endif
    788