15738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/******************************************************************************
25738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *
35738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  Copyright (C) 2001-2012 Broadcom Corporation
45738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *
55738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  Licensed under the Apache License, Version 2.0 (the "License");
65738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  you may not use this file except in compliance with the License.
75738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  You may obtain a copy of the License at:
85738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *
95738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  http://www.apache.org/licenses/LICENSE-2.0
105738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *
115738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  Unless required by applicable law or agreed to in writing, software
125738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  distributed under the License is distributed on an "AS IS" BASIS,
135738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
145738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  See the License for the specific language governing permissions and
155738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  limitations under the License.
165738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *
175738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project ******************************************************************************/
185738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
195738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/******************************************************************************
205738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *
215738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  This interface file contains the interface to the Bluetooth Network
225738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *  Encapsilation Protocol (BNEP).
235738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *
245738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project ******************************************************************************/
255738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#ifndef BNEP_API_H
265738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define BNEP_API_H
275738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
285738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#include "l2c_api.h"
295738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
305738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*****************************************************************************
31ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *  Constants
32ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ****************************************************************************/
335738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
345738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* Define the minimum offset needed in a GKI buffer for
35ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * sending BNEP packets. Note, we are currently not sending
36ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * extension headers, but may in the future, so allow
37ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * space for them
385738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
39911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson#define BNEP_MINIMUM_OFFSET (15 + L2CAP_MIN_OFFSET)
40911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson#define BNEP_INVALID_HANDLE 0xFFFF
415738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
425738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*****************************************************************************
43ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *  Type Definitions
44ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ****************************************************************************/
455738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
465738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* Define the result codes from BNEP
475738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
48911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonenum {
49911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  BNEP_SUCCESS,               /* Success                           */
50911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  BNEP_CONN_DISCONNECTED,     /* Connection terminated   */
51911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  BNEP_NO_RESOURCES,          /* No resources                      */
52911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  BNEP_MTU_EXCEDED,           /* Attempt to write long data        */
53911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  BNEP_INVALID_OFFSET,        /* Insufficient offset in GKI buffer */
54911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  BNEP_CONN_FAILED,           /* Connection failed                 */
55911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  BNEP_CONN_FAILED_CFG,       /* Connection failed cos of config   */
56911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  BNEP_CONN_FAILED_SRC_UUID,  /* Connection failed wrong source UUID   */
57911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  BNEP_CONN_FAILED_DST_UUID,  /* Connection failed wrong destination UUID   */
58911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  BNEP_CONN_FAILED_UUID_SIZE, /* Connection failed wrong size UUID   */
59911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  BNEP_Q_SIZE_EXCEEDED,       /* Too many buffers to dest          */
60911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  BNEP_TOO_MANY_FILTERS,      /* Too many local filters specified  */
61911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  BNEP_SET_FILTER_FAIL,       /* Set Filter failed  */
62911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  BNEP_WRONG_HANDLE,          /* Wrong handle for the connection  */
63911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  BNEP_WRONG_STATE,           /* Connection is in wrong state */
64911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  BNEP_SECURITY_FAIL,         /* Failed because of security */
65911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  BNEP_IGNORE_CMD,            /* To ignore the rcvd command */
66911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  BNEP_TX_FLOW_ON,            /* tx data flow enabled */
67911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  BNEP_TX_FLOW_OFF            /* tx data flow disabled */
68911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson
69911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson};
70911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsontypedef uint8_t tBNEP_RESULT;
715738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
725738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/***************************
73ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *  Callback Functions
74ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ***************************/
755738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
765738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* Connection state change callback prototype. Parameters are
77ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Connection handle
78ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              BD Address of remote
79ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Connection state change result
80ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  BNEP_SUCCESS indicates connection is success
81ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  All values are used to indicate the reason for failure
82ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Flag to indicate if it is just a role change
835738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
84911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsontypedef void(tBNEP_CONN_STATE_CB)(uint16_t handle, BD_ADDR rem_bda,
85911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                  tBNEP_RESULT result, bool is_role_change);
865738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
875738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* Connection indication callback prototype. Parameters are
88ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              BD Address of remote, remote UUID and local UUID
89ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              and flag to indicate role change and handle to the connection
90ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              When BNEP calls this function profile should
91ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              use BNEP_ConnectResp call to accept or reject the request
925738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
93911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsontypedef void(tBNEP_CONNECT_IND_CB)(uint16_t handle, BD_ADDR bd_addr,
94911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                   tBT_UUID* remote_uuid, tBT_UUID* local_uuid,
95911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                   bool is_role_change);
965738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
975738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* Data buffer received indication callback prototype. Parameters are
98ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Handle to the connection
99ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Source BD/Ethernet Address
100ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Dest BD/Ethernet address
101ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Protocol
102ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Pointer to the buffer
1039ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *              Flag to indicate whether extension headers to be forwarded are
1049ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                present
1059ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson */
106911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsontypedef void(tBNEP_DATA_BUF_CB)(uint16_t handle, uint8_t* src, uint8_t* dst,
107911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                uint16_t protocol, BT_HDR* p_buf,
108911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                bool fw_ext_present);
1095738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1105738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* Data received indication callback prototype. Parameters are
111ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Handle to the connection
112ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Source BD/Ethernet Address
113ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Dest BD/Ethernet address
114ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Protocol
115ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Pointer to the beginning of the data
116ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Length of data
1179ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *              Flag to indicate whether extension headers to be forwarded are
1189ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                present
1199ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson */
120911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsontypedef void(tBNEP_DATA_IND_CB)(uint16_t handle, uint8_t* src, uint8_t* dst,
121911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                uint16_t protocol, uint8_t* p_data,
122911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                uint16_t len, bool fw_ext_present);
1235738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1245738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* Flow control callback for TX data. Parameters are
125ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Handle to the connection
126ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Event  flow status
1275738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
128911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsontypedef void(tBNEP_TX_DATA_FLOW_CB)(uint16_t handle, tBNEP_RESULT event);
1295738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1305738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* Filters received indication callback prototype. Parameters are
131ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Handle to the connection
132ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              true if the cb is called for indication
133ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Ignore this if it is indication, otherwise it is the result
134ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      for the filter set operation performed by the local
135ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      device
136ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Number of protocol filters present
137ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Pointer to the filters start. Filters are present in pairs
138ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      of start of the range and end of the range.
139ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      They will be present in big endian order. First
140ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      two bytes will be starting of the first range and
141ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      next two bytes will be ending of the range.
1425738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
143911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsontypedef void(tBNEP_FILTER_IND_CB)(uint16_t handle, bool indication,
144911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                  tBNEP_RESULT result, uint16_t num_filters,
145911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                  uint8_t* p_filters);
1465738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1475738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* Multicast Filters received indication callback prototype. Parameters are
148ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Handle to the connection
149ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              true if the cb is called for indication
150ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Ignore this if it is indication, otherwise it is the result
151ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      for the filter set operation performed by the local
152ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      device
153ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Number of multicast filters present
154ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Pointer to the filters start. Filters are present in pairs
155ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      of start of the range and end of the range.
156ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      First six bytes will be starting of the first range and
157ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      next six bytes will be ending of the range.
1585738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
159911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsontypedef void(tBNEP_MFILTER_IND_CB)(uint16_t handle, bool indication,
160911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                   tBNEP_RESULT result, uint16_t num_mfilters,
161911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                   uint8_t* p_mfilters);
1625738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1635738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* This is the structure used by profile to register with BNEP */
164911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsontypedef struct {
165911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  tBNEP_CONNECT_IND_CB* p_conn_ind_cb;  /* To indicate the conn request */
166911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  tBNEP_CONN_STATE_CB* p_conn_state_cb; /* To indicate conn state change */
167911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  tBNEP_DATA_IND_CB* p_data_ind_cb;     /* To pass the data received */
168911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  tBNEP_DATA_BUF_CB* p_data_buf_cb;     /* To pass the data buffer received */
169911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  tBNEP_TX_DATA_FLOW_CB* p_tx_data_flow_cb; /* data flow callback */
170911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  tBNEP_FILTER_IND_CB*
171911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson      p_filter_ind_cb; /* To indicate that peer set protocol filters */
172911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  tBNEP_MFILTER_IND_CB*
173911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson      p_mfilter_ind_cb; /* To indicate that peer set mcast filters */
1745738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1755738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project} tBNEP_REGISTER;
1765738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1775738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* This is the structure used by profile to get the status of BNEP */
178911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsontypedef struct {
179911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson#define BNEP_STATUS_FAILE 0
180911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson#define BNEP_STATUS_CONNECTED 1
181911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  uint8_t con_status;
182911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson
183911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  uint16_t l2cap_cid;
184911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  BD_ADDR rem_bda;
185911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  uint16_t rem_mtu_size;
186911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  uint16_t xmit_q_depth;
187911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson
188911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  uint16_t sent_num_filters;
189911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  uint16_t sent_mcast_filters;
190911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  uint16_t rcvd_num_filters;
191911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  uint16_t rcvd_mcast_filters;
192911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  tBT_UUID src_uuid;
193911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  tBT_UUID dst_uuid;
1945738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1955738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project} tBNEP_STATUS;
1965738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1975738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*****************************************************************************
198ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *  External Function Declarations
199ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ****************************************************************************/
2005738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
201ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
202ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         BNEP_Register
203ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
204ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function is called by the upper layer to register
205ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  its callbacks with BNEP
206ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
207ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Parameters:      p_reg_info - contains all callback function pointers
208ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
209ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
210ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns          BNEP_SUCCESS        if registered successfully
211ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  BNEP_FAILURE        if connection state callback is missing
212ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
213ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
214911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern tBNEP_RESULT BNEP_Register(tBNEP_REGISTER* p_reg_info);
2155738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2165738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
217ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
218ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         BNEP_Deregister
219ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
220ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function is called by the upper layer to de-register
221ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  its callbacks.
222ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
223ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Parameters:      void
224ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
225ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
226ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns          void
227ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
228ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
229911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern void BNEP_Deregister(void);
2305738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2315738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
232ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
233ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         BNEP_Connect
234ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
235ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function creates a BNEP connection to a remote
236ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  device.
237ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
2389ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson * Parameters:      p_rem_addr - BD_ADDR of the peer
2399ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  src_uuid   - source uuid for the connection
2409ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  dst_uuid   - destination uuid for the connection
2419ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  p_handle   - pointer to return the handle for the connection
242ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
243ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns          BNEP_SUCCESS                if connection started
244ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  BNEP_NO_RESOURCES           if no resources
245ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
246ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
247911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern tBNEP_RESULT BNEP_Connect(BD_ADDR p_rem_bda, tBT_UUID* src_uuid,
248911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                 tBT_UUID* dst_uuid, uint16_t* p_handle);
2495738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2505738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
251ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
252ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         BNEP_ConnectResp
253ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
254ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function is called in responce to connection indication
255ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
256ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
257ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Parameters:      handle  - handle given in the connection indication
258ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  resp    - responce for the connection indication
259ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
260ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns          BNEP_SUCCESS                if connection started
261ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  BNEP_WRONG_HANDLE           if the connection is not found
262ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  BNEP_WRONG_STATE            if the responce is not expected
263ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
264ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
265911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern tBNEP_RESULT BNEP_ConnectResp(uint16_t handle, tBNEP_RESULT resp);
2665738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2675738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
268ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
269ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         BNEP_Disconnect
270ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
271ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function is called to close the specified connection.
272ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
273ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Parameters:      handle   - handle of the connection
274ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
275ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns          BNEP_SUCCESS                if connection is disconnected
276ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  BNEP_WRONG_HANDLE           if no connection is not found
277ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
278ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
279911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern tBNEP_RESULT BNEP_Disconnect(uint16_t handle);
2805738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2815738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
282ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
283ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         BNEP_WriteBuf
284ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
285ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function sends data in a GKI buffer on BNEP connection
286ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
287ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Parameters:      handle       - handle of the connection to write
288ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  p_dest_addr  - BD_ADDR/Ethernet addr of the destination
289ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  p_buf        - pointer to address of buffer with data
290ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  protocol     - protocol type of the packet
2919ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  p_src_addr   - (optional) BD_ADDR/ethernet address of the
2929ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                 source (should be NULL if it is the local BD
2939ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                         Addr)
294ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  fw_ext_present - forwarded extensions present
295ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
296ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns:         BNEP_WRONG_HANDLE       - if passed handle is not valid
2979ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  BNEP_MTU_EXCEDED        - If the data length is greater
2989ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                            than MTU
299ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  BNEP_IGNORE_CMD         - If the packet is filtered out
300ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  BNEP_Q_SIZE_EXCEEDED    - If the Tx Q is full
301ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  BNEP_SUCCESS            - If written successfully
302ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
303ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
304911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern tBNEP_RESULT BNEP_WriteBuf(uint16_t handle, uint8_t* p_dest_addr,
305911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                  BT_HDR* p_buf, uint16_t protocol,
306911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                  uint8_t* p_src_addr, bool fw_ext_present);
3075738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
3085738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
309ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
310ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         BNEP_Write
311ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
312ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function sends data over a BNEP connection
313ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
314ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Parameters:      handle       - handle of the connection to write
315ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  p_dest_addr  - BD_ADDR/Ethernet addr of the destination
316ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  p_data       - pointer to data start
317ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  protocol     - protocol type of the packet
3189ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  p_src_addr   - (optional) BD_ADDR/ethernet address of the
3199ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                 source (should be NULL if it is the local BD
3209ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                 Addr)
321ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  fw_ext_present - forwarded extensions present
322ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
323ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns:         BNEP_WRONG_HANDLE       - if passed handle is not valid
3249ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  BNEP_MTU_EXCEDED        - If the data length is greater than
3259ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                            the MTU
326ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  BNEP_IGNORE_CMD         - If the packet is filtered out
327ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  BNEP_Q_SIZE_EXCEEDED    - If the Tx Q is full
328ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  BNEP_NO_RESOURCES       - If not able to allocate a buffer
329ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  BNEP_SUCCESS            - If written successfully
330ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
331ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
332911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern tBNEP_RESULT BNEP_Write(uint16_t handle, uint8_t* p_dest_addr,
333911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                               uint8_t* p_data, uint16_t len, uint16_t protocol,
334911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                               uint8_t* p_src_addr, bool fw_ext_present);
3355738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
3365738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
337ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
338ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         BNEP_SetProtocolFilters
339ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
340ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function sets the protocol filters on peer device
341ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
342ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Parameters:      handle        - Handle for the connection
343ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  num_filters   - total number of filter ranges
344ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  p_start_array - Array of beginings of all protocol ranges
345ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  p_end_array   - Array of ends of all protocol ranges
346ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
3479ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson * Returns          BNEP_WRONG_HANDLE           - if the connection handle is
3489ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                                not valid
3499ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  BNEP_SET_FILTER_FAIL        - if the connection is in the
3509ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                                wrong state
351ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  BNEP_TOO_MANY_FILTERS       - if too many filters
352ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  BNEP_SUCCESS                - if request sent successfully
353ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
354ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
355911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern tBNEP_RESULT BNEP_SetProtocolFilters(uint16_t handle,
356911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                            uint16_t num_filters,
357911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                            uint16_t* p_start_array,
358911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                            uint16_t* p_end_array);
3595738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
3605738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
361ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
362ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         BNEP_SetMulticastFilters
363ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
3649ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson * Description      This function sets the filters for multicast addresses for
3659ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  BNEP.
366ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
367ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Parameters:      handle        - Handle for the connection
368ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  num_filters   - total number of filter ranges
369ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  p_start_array - Pointer to sequence of beginings of all
370ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                                         multicast address ranges
371ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  p_end_array   - Pointer to sequence of ends of all
372ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                                         multicast address ranges
373ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
3749ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson * Returns          BNEP_WRONG_HANDLE           - if the connection handle is
3759ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                                not valid
3769ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  BNEP_SET_FILTER_FAIL        - if the connection is in the
3779ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                                wrong state
378ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  BNEP_TOO_MANY_FILTERS       - if too many filters
379ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  BNEP_SUCCESS                - if request sent successfully
380ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
381ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
382911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern tBNEP_RESULT BNEP_SetMulticastFilters(uint16_t handle,
383911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                             uint16_t num_filters,
384911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                             uint8_t* p_start_array,
385911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                             uint8_t* p_end_array);
3865738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
3875738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
388ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
389ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         BNEP_SetTraceLevel
390ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
391ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function sets the trace level for BNEP. If called with
392ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  a value of 0xFF, it simply reads the current trace level.
393ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
394ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns          the new (current) trace level
395ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
396ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
397911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern uint8_t BNEP_SetTraceLevel(uint8_t new_level);
3985738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
3995738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
400ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
401ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         BNEP_Init
402ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
403ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function initializes the BNEP unit. It should be called
4049ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  before accessing any other APIs to initialize the control
4059ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  block
406ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
407ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns          void
408ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
409ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
410911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern void BNEP_Init(void);
4115738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
4125738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
413ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
414ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         BNEP_GetStatus
415ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
4169ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson * Description      This function gets the status information for BNEP
4179ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  connection
418ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
419ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns          BNEP_SUCCESS            - if the status is available
4209ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  BNEP_NO_RESOURCES       - if no structure is passed for
4219ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                            output
422ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  BNEP_WRONG_HANDLE       - if the handle is invalid
423ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  BNEP_WRONG_STATE        - if not in connected state
424ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
425ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
426911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern tBNEP_RESULT BNEP_GetStatus(uint16_t handle, tBNEP_STATUS* p_status);
4275738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
4285738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#endif
429