15738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/******************************************************************************
25738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *
35b790feeeb211c42bf78ca3ae9c26aa30e516765Jakub Pawlowski *  Copyright 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 file contains the PAN API definitions
225738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project *
235738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project ******************************************************************************/
245738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#ifndef PAN_API_H
255738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#define PAN_API_H
265738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
275738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project#include "bnep_api.h"
285738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
295738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*****************************************************************************
30ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *  Constants
31ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ****************************************************************************/
325738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
335738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* Define the minimum offset needed in a GKI buffer for
34ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * sending PAN packets. Note, we are currently not sending
35ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * extension headers, but may in the future, so allow
36ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * space for them
375738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
38911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson#define PAN_MINIMUM_OFFSET BNEP_MINIMUM_OFFSET
395738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
405738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*
41ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * The handle is passed from BNEP to PAN. The same handle is used
42ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * between PAN and application as well
435738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
44911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson#define PAN_INVALID_HANDLE BNEP_INVALID_HANDLE
455738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
465738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* Bit map for PAN roles */
47911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson#define PAN_ROLE_CLIENT 0x01     /* PANU role */
48911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson#define PAN_ROLE_GN_SERVER 0x02  /* GN role */
49911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson#define PAN_ROLE_NAP_SERVER 0x04 /* NAP role */
505738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
515738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* Bitmap to indicate the usage of the Data */
52911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson#define PAN_DATA_TO_HOST 0x01
53911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson#define PAN_DATA_TO_LAN 0x02
545738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
555738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*****************************************************************************
56ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *  Type Definitions
57ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ****************************************************************************/
585738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
595738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* Define the result codes from PAN */
60911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonenum {
61911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  PAN_SUCCESS, /* Success                           */
62911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  PAN_DISCONNECTED = BNEP_CONN_DISCONNECTED, /* Connection terminated   */
63911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  PAN_CONN_FAILED = BNEP_CONN_FAILED,   /* Connection failed                 */
64911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  PAN_NO_RESOURCES = BNEP_NO_RESOURCES, /* No resources                      */
65911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  PAN_MTU_EXCEDED = BNEP_MTU_EXCEDED,   /* Attempt to write long data        */
66911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  PAN_INVALID_OFFSET =
67911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson      BNEP_INVALID_OFFSET, /* Insufficient offset in GKI buffer */
68911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  PAN_CONN_FAILED_CFG =
69911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson      BNEP_CONN_FAILED_CFG, /* Connection failed cos of config   */
70911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  PAN_INVALID_SRC_ROLE =
71911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson      BNEP_CONN_FAILED_SRC_UUID, /* Connection failed wrong source UUID   */
72911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  PAN_INVALID_DST_ROLE =
73911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson      BNEP_CONN_FAILED_DST_UUID, /* Connection failed wrong destination UUID */
74911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  PAN_CONN_FAILED_UUID_SIZE =
75911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson      BNEP_CONN_FAILED_UUID_SIZE, /* Connection failed wrong size UUID   */
76911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  PAN_Q_SIZE_EXCEEDED = BNEP_Q_SIZE_EXCEEDED, /* Too many buffers to dest */
77911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  PAN_TOO_MANY_FILTERS =
78911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson      BNEP_TOO_MANY_FILTERS, /* Too many local filters specified  */
79911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  PAN_SET_FILTER_FAIL = BNEP_SET_FILTER_FAIL, /* Set Filter failed  */
80911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  PAN_WRONG_HANDLE = BNEP_WRONG_HANDLE,   /* Wrong handle for the connection  */
81911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  PAN_WRONG_STATE = BNEP_WRONG_STATE,     /* Connection is in wrong state */
82911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  PAN_SECURITY_FAIL = BNEP_SECURITY_FAIL, /* Failed because of security */
83911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  PAN_IGNORE_CMD = BNEP_IGNORE_CMD,       /* To ignore the rcvd command */
84911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  PAN_TX_FLOW_ON = BNEP_TX_FLOW_ON,       /* tx data flow enabled */
85911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  PAN_TX_FLOW_OFF = BNEP_TX_FLOW_OFF,     /* tx data flow disabled */
86911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  PAN_FAILURE                             /* Failure                      */
875738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
885738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project};
89d19e0785e662e640191a075eda07acce61c2aedaMarie Janssentypedef uint8_t tPAN_RESULT;
905738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
915738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*****************************************************************
92ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *       Callback Function Prototypes
93ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ****************************************************************/
945738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
955738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* This is call back function used to report connection status
96ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *      to the application. The second parameter true means
97ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *      to create the bridge and false means to remove it.
985738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
99a484a888196ddf8bcbf1ad3226d6451bc735a94bJakub Pawlowskitypedef void(tPAN_CONN_STATE_CB)(uint16_t handle, const RawAddress& bd_addr,
100911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                 tPAN_RESULT state, bool is_role_change,
101911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                 uint8_t src_role, uint8_t dst_role);
1025738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1035738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* This is call back function used to create bridge for the
104ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *      Connected device. The parameter "state" indicates
105ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *      whether to create the bridge or remove it. true means
106ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *      to create the bridge and false means to remove it.
1075738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
108a484a888196ddf8bcbf1ad3226d6451bc735a94bJakub Pawlowskitypedef void(tPAN_BRIDGE_REQ_CB)(const RawAddress& bd_addr, bool state);
1095738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1105738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* Data received indication callback prototype. Parameters are
111ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Source BD/Ethernet Address
112ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Dest BD/Ethernet address
113ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Protocol
114ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Address of buffer (or data if non-GKI)
115ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Length of data (non-GKI)
116ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              ext is flag to indicate whether it has aby extension headers
117ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Flag used to indicate to forward on LAN
118ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      false - Use it for internal stack
119ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      true  - Send it across the ethernet as well
1205738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
121a484a888196ddf8bcbf1ad3226d6451bc735a94bJakub Pawlowskitypedef void(tPAN_DATA_IND_CB)(uint16_t handle, const RawAddress& src,
122a484a888196ddf8bcbf1ad3226d6451bc735a94bJakub Pawlowski                               const RawAddress& dst, uint16_t protocol,
123a83ac12406eaa90e5f1f8a699b8b17e4440e2687Jakub Pawlowski                               uint8_t* p_data, uint16_t len, bool ext,
124a83ac12406eaa90e5f1f8a699b8b17e4440e2687Jakub Pawlowski                               bool forward);
1255738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1265738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* Data buffer received indication callback prototype. Parameters are
127ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Source BD/Ethernet Address
128ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Dest BD/Ethernet address
129ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Protocol
130ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              pointer to the data buffer
131ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              ext is flag to indicate whether it has aby extension headers
132ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Flag used to indicate to forward on LAN
133ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      false - Use it for internal stack
134ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      true  - Send it across the ethernet as well
1355738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
136a484a888196ddf8bcbf1ad3226d6451bc735a94bJakub Pawlowskitypedef void(tPAN_DATA_BUF_IND_CB)(uint16_t handle, const RawAddress& src,
137a484a888196ddf8bcbf1ad3226d6451bc735a94bJakub Pawlowski                                   const RawAddress& dst, uint16_t protocol,
138a83ac12406eaa90e5f1f8a699b8b17e4440e2687Jakub Pawlowski                                   BT_HDR* p_buf, bool ext, bool forward);
1395738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1405738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* Flow control callback for TX data. Parameters are
141ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Handle to the connection
142ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Event  flow status
1435738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
144911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsontypedef void(tPAN_TX_DATA_FLOW_CB)(uint16_t handle, tPAN_RESULT event);
1455738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1465738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* Filters received indication callback prototype. Parameters are
147ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Handle to the connection
148ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              true if the cb is called for indication
149ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Ignore this if it is indication, otherwise it is the result
150ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      for the filter set operation performed by the local
151ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      device
152ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Number of protocol filters present
153ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Pointer to the filters start. Filters are present in pairs
154ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      of start of the range and end of the range.
155ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      They will be present in big endian order. First
156ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      two bytes will be starting of the first range and
157ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      next two bytes will be ending of the range.
1585738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
159911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsontypedef void(tPAN_FILTER_IND_CB)(uint16_t handle, bool indication,
160911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                 tBNEP_RESULT result, uint16_t num_filters,
161911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                 uint8_t* p_filters);
1625738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1635738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* Multicast Filters received indication callback prototype. Parameters are
164ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Handle to the connection
165ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              true if the cb is called for indication
166ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Ignore this if it is indication, otherwise it is the result
167ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      for the filter set operation performed by the local
168ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      device
169ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Number of multicast filters present
170ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Pointer to the filters start. Filters are present in pairs
171ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      of start of the range and end of the range.
172ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      First six bytes will be starting of the first range and
173ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      next six bytes will be ending of the range.
1745738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
175911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsontypedef void(tPAN_MFILTER_IND_CB)(uint16_t handle, bool indication,
176911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                  tBNEP_RESULT result, uint16_t num_mfilters,
177911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                  uint8_t* p_mfilters);
1785738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1795738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* This structure is used to register with PAN profile
180ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * It is passed as a parameter to PAN_Register call.
1815738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
182911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsontypedef struct {
183911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  tPAN_CONN_STATE_CB* pan_conn_state_cb; /* Connection state callback */
184911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  tPAN_BRIDGE_REQ_CB* pan_bridge_req_cb; /* Bridge request callback */
185911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  tPAN_DATA_IND_CB* pan_data_ind_cb;     /* Data indication callback */
186911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  tPAN_DATA_BUF_IND_CB*
187911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson      pan_data_buf_ind_cb; /* Data buffer indication callback */
188911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  tPAN_FILTER_IND_CB*
189911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson      pan_pfilt_ind_cb; /* protocol filter indication callback */
190911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  tPAN_MFILTER_IND_CB*
191911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson      pan_mfilt_ind_cb; /* multicast filter indication callback */
192911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  tPAN_TX_DATA_FLOW_CB* pan_tx_data_flow_cb; /* data flow callback */
193911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  char* user_service_name;                   /* Service name for PANU role */
194911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  char* gn_service_name;                     /* Service name for GN role */
195911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  char* nap_service_name;                    /* Service name for NAP role */
1965738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1975738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project} tPAN_REGISTER;
1985738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1995738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*****************************************************************************
200ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *  External Function Declarations
201ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ****************************************************************************/
2025738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2035738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
204ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
205ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         PAN_Register
206ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
207ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function is called by the application to register
208ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  its callbacks with PAN profile. The application then
209ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  should set the PAN role explicitly.
210ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
211ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Parameters:      p_register - contains all callback function pointers
212ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
213ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
214ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns          none
215ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
216ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
217911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern void PAN_Register(tPAN_REGISTER* p_register);
2185738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2195738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
220ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
221ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         PAN_Deregister
222ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
223ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function is called by the application to de-register
224ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  its callbacks with PAN profile. This will make the PAN to
225ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  become inactive. This will deregister PAN services from SDP
226ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  and close all active connections
227ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
228ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns          none
229ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
230ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
231911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern void PAN_Deregister(void);
2325738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2335738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
234ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
235ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         PAN_SetRole
236ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
237ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function is called by the application to set the PAN
238ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  profile role. This should be called after PAN_Register.
239ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  This can be called any time to change the PAN role
240ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
241ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Parameters:      role        - is bit map of roles to be active
242ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                                      PAN_ROLE_CLIENT is for PANU role
243ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                                      PAN_ROLE_GN_SERVER is for GN role
244ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                                      PAN_ROLE_NAP_SERVER is for NAP role
245ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  sec_mask    - Security mask for different roles
2469ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                      It is array of uint8_t. The bytes
2479ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                      represent the security for roles PANU,
2489ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                      GN and NAP in order
2499ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *
250ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  p_user_name - Service name for PANU role
251ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  p_gn_name   - Service name for GN role
252ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  p_nap_name  - Service name for NAP role
2539ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                  Can be NULL if user wants it to be default
254ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
255ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns          PAN_SUCCESS     - if the role is set successfully
256ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  PAN_FAILURE     - if the role is not valid
257ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
258ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
259911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern tPAN_RESULT PAN_SetRole(uint8_t role, uint8_t* sec_mask,
260911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                               const char* p_user_name, const char* p_gn_name,
261911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                               const char* p_nap_name);
2625738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2635738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
264ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
265ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         PAN_Connect
266ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
267ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function is called by the application to initiate a
268ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  connection to the remote device
269ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
270ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Parameters:      rem_bda     - BD Addr of the remote device
271ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  src_role    - Role of the local device for the connection
272ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  dst_role    - Role of the remote device for the connection
273ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                                      PAN_ROLE_CLIENT is for PANU role
274ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                                      PAN_ROLE_GN_SERVER is for GN role
275ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                                      PAN_ROLE_NAP_SERVER is for NAP role
276ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  *handle     - Pointer for returning Handle to the connection
277ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
2789ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson * Returns          PAN_SUCCESS - if the connection is initiated successfully
279ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  PAN_NO_RESOURCES - resources are not sufficent
280ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  PAN_FAILURE      - if the connection cannot be initiated
2819ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                     this can be because of the combination of
2829ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                     src and dst roles may not be valid or
2839ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                     allowed at that point of time
284ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
285ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
286a484a888196ddf8bcbf1ad3226d6451bc735a94bJakub Pawlowskiextern tPAN_RESULT PAN_Connect(const RawAddress& rem_bda, uint8_t src_role,
287911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                               uint8_t dst_role, uint16_t* handle);
2885738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2895738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
290ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
291ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         PAN_Disconnect
292ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
293ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This is used to disconnect the connection
294ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
295ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Parameters:      handle           - handle for the connection
296ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
297ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns          PAN_SUCCESS      - if the connection is closed successfully
298ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  PAN_FAILURE      - if the connection is not found or
299ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                                           there is an error in disconnecting
300ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
301ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
302911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern tPAN_RESULT PAN_Disconnect(uint16_t handle);
3035738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
3045738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
305ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
306ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         PAN_Write
307ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
308ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This sends data over the PAN connections. If this is called
309ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  on GN or NAP side and the packet is multicast or broadcast
310ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  it will be sent on all the links. Otherwise the correct link
3119ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  is found based on the destination address and forwarded on
3129ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  it. If the return value is not PAN_SUCCESS the application
3139ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  should take care of releasing the message buffer
314ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
315ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Parameters:      dst      - MAC or BD Addr of the destination device
316ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  src      - MAC or BD Addr of the source who sent this packet
317ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  protocol - protocol of the ethernet packet like IP or ARP
318ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  p_data   - pointer to the data
319ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  len      - length of the data
320ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  ext      - to indicate that extension headers present
321ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
322ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns          PAN_SUCCESS       - if the data is sent successfully
323ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  PAN_FAILURE       - if the connection is not found or
324ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                                           there is an error in sending data
325ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
326ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
327a484a888196ddf8bcbf1ad3226d6451bc735a94bJakub Pawlowskiextern tPAN_RESULT PAN_Write(uint16_t handle, const RawAddress& dst,
328a484a888196ddf8bcbf1ad3226d6451bc735a94bJakub Pawlowski                             const RawAddress& src, uint16_t protocol,
329a83ac12406eaa90e5f1f8a699b8b17e4440e2687Jakub Pawlowski                             uint8_t* p_data, uint16_t len, bool ext);
3305738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
3315738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
332ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
333ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         PAN_WriteBuf
334ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
335ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This sends data over the PAN connections. If this is called
336ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  on GN or NAP side and the packet is multicast or broadcast
337ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  it will be sent on all the links. Otherwise the correct link
3389ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  is found based on the destination address and forwarded on
3399ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  it. If the return value is not PAN_SUCCESS the application
3409ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  should take care of releasing the message buffer
341ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
342ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Parameters:      dst      - MAC or BD Addr of the destination device
343ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  src      - MAC or BD Addr of the source who sent this packet
344ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  protocol - protocol of the ethernet packet like IP or ARP
345ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  p_buf    - pointer to the data buffer
346ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  ext      - to indicate that extension headers present
347ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
348ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns          PAN_SUCCESS       - if the data is sent successfully
349ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  PAN_FAILURE       - if the connection is not found or
350ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                                           there is an error in sending data
351ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
352ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
353a484a888196ddf8bcbf1ad3226d6451bc735a94bJakub Pawlowskiextern tPAN_RESULT PAN_WriteBuf(uint16_t handle, const RawAddress& dst,
354a484a888196ddf8bcbf1ad3226d6451bc735a94bJakub Pawlowski                                const RawAddress& src, uint16_t protocol,
355a83ac12406eaa90e5f1f8a699b8b17e4440e2687Jakub Pawlowski                                BT_HDR* p_buf, bool ext);
3565738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
3575738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
358ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
359ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         PAN_SetProtocolFilters
360ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
361ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function is used to set protocol filters on the peer
362ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
363ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Parameters:      handle      - handle for the connection
364ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  num_filters - number of protocol filter ranges
365ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  start       - array of starting protocol numbers
366ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  end         - array of ending protocol numbers
367ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
368ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
3699ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson * Returns          PAN_SUCCESS     if protocol filters are set successfully
3709ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  PAN_FAILURE     if connection not found or error in setting
371ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
372ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
373911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern tPAN_RESULT PAN_SetProtocolFilters(uint16_t handle, uint16_t num_filters,
374911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                          uint16_t* p_start_array,
375911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                          uint16_t* p_end_array);
3765738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
3775738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
378ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
379ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         PAN_SetMulticastFilters
380ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
381ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function is used to set multicast filters on the peer
382ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
383ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Parameters:      handle      - handle for the connection
384ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  num_filters - number of multicast filter ranges
385ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  p_start_array - Pointer to sequence of beginings of all
386ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                                         multicast address ranges
387ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  p_end_array   - Pointer to sequence of ends of all
388ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                                         multicast address ranges
389ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
390ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
3919ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson * Returns          PAN_SUCCESS     if multicast filters are set successfully
3929ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  PAN_FAILURE     if connection not found or error in setting
393ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
394ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
395911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern tBNEP_RESULT PAN_SetMulticastFilters(uint16_t handle,
396911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                            uint16_t num_mcast_filters,
397911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                            uint8_t* p_start_array,
398911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                            uint8_t* p_end_array);
3995738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
4005738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
401ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
402ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         PAN_SetTraceLevel
403ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
404ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function sets the trace level for PAN. If called with
405ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  a value of 0xFF, it simply reads the current trace level.
406ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
407ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns          the new (current) trace level
408ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
409ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
410911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern uint8_t PAN_SetTraceLevel(uint8_t new_level);
4115738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
4125738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
413ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
414ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         PAN_Init
415ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
416ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function initializes the PAN unit. It should be called
417ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  before accessing any other APIs to initialize the control
418ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  block.
419ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
420ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns          void
421ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
422ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
423911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern void PAN_Init(void);
4245738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
425911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson#endif /* PAN_API_H */
426