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 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*/
99911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsontypedef void(tPAN_CONN_STATE_CB)(uint16_t handle, BD_ADDR 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*/
108911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsontypedef void(tPAN_BRIDGE_REQ_CB)(BD_ADDR 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*/
121911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsontypedef void(tPAN_DATA_IND_CB)(uint16_t handle, BD_ADDR src, BD_ADDR dst,
122911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                               uint16_t protocol, uint8_t* p_data, uint16_t len,
123911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                               bool ext, bool forward);
1245738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1255738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* Data buffer received indication callback prototype. Parameters are
126ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Source BD/Ethernet Address
127ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Dest BD/Ethernet address
128ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Protocol
129ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              pointer to the data buffer
130ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              ext is flag to indicate whether it has aby extension headers
131ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Flag used to indicate to forward on LAN
132ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      false - Use it for internal stack
133ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      true  - Send it across the ethernet as well
1345738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
135911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsontypedef void(tPAN_DATA_BUF_IND_CB)(uint16_t handle, BD_ADDR src, BD_ADDR dst,
136911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                   uint16_t protocol, BT_HDR* p_buf, bool ext,
137911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                   bool forward);
1385738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1395738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* Flow control callback for TX data. Parameters are
140ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Handle to the connection
141ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Event  flow status
1425738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
143911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsontypedef void(tPAN_TX_DATA_FLOW_CB)(uint16_t handle, tPAN_RESULT event);
1445738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1455738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* Filters received indication callback prototype. Parameters are
146ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Handle to the connection
147ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              true if the cb is called for indication
148ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Ignore this if it is indication, otherwise it is the result
149ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      for the filter set operation performed by the local
150ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      device
151ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Number of protocol filters present
152ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Pointer to the filters start. Filters are present in pairs
153ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      of start of the range and end of the range.
154ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      They will be present in big endian order. First
155ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      two bytes will be starting of the first range and
156ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      next two bytes will be ending of the range.
1575738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
158911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsontypedef void(tPAN_FILTER_IND_CB)(uint16_t handle, bool indication,
159911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                 tBNEP_RESULT result, uint16_t num_filters,
160911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                 uint8_t* p_filters);
1615738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1625738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* Multicast Filters received indication callback prototype. Parameters are
163ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Handle to the connection
164ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              true if the cb is called for indication
165ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Ignore this if it is indication, otherwise it is the result
166ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      for the filter set operation performed by the local
167ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      device
168ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Number of multicast filters present
169ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *              Pointer to the filters start. Filters are present in pairs
170ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      of start of the range and end of the range.
171ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      First six bytes will be starting of the first range and
172ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                      next six bytes will be ending of the range.
1735738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
174911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsontypedef void(tPAN_MFILTER_IND_CB)(uint16_t handle, bool indication,
175911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                  tBNEP_RESULT result, uint16_t num_mfilters,
176911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                  uint8_t* p_mfilters);
1775738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1785738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/* This structure is used to register with PAN profile
179ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * It is passed as a parameter to PAN_Register call.
1805738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project*/
181911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsontypedef struct {
182911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  tPAN_CONN_STATE_CB* pan_conn_state_cb; /* Connection state callback */
183911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  tPAN_BRIDGE_REQ_CB* pan_bridge_req_cb; /* Bridge request callback */
184911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  tPAN_DATA_IND_CB* pan_data_ind_cb;     /* Data indication callback */
185911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  tPAN_DATA_BUF_IND_CB*
186911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson      pan_data_buf_ind_cb; /* Data buffer indication callback */
187911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  tPAN_FILTER_IND_CB*
188911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson      pan_pfilt_ind_cb; /* protocol filter indication callback */
189911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  tPAN_MFILTER_IND_CB*
190911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson      pan_mfilt_ind_cb; /* multicast filter indication callback */
191911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  tPAN_TX_DATA_FLOW_CB* pan_tx_data_flow_cb; /* data flow callback */
192911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  char* user_service_name;                   /* Service name for PANU role */
193911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  char* gn_service_name;                     /* Service name for GN role */
194911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson  char* nap_service_name;                    /* Service name for NAP role */
1955738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1965738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project} tPAN_REGISTER;
1975738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
1985738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*****************************************************************************
199ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *  External Function Declarations
200ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ****************************************************************************/
2015738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2025738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
203ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
204ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         PAN_Register
205ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
206ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function is called by the application to register
207ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  its callbacks with PAN profile. The application then
208ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  should set the PAN role explicitly.
209ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
210ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Parameters:      p_register - contains all callback function pointers
211ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
212ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
213ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns          none
214ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
215ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
216911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern void PAN_Register(tPAN_REGISTER* p_register);
2175738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2185738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
219ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
220ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         PAN_Deregister
221ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
222ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function is called by the application to de-register
223ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  its callbacks with PAN profile. This will make the PAN to
224ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  become inactive. This will deregister PAN services from SDP
225ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  and close all active connections
226ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
227ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns          none
228ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
229ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
230911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern void PAN_Deregister(void);
2315738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2325738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
233ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
234ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         PAN_SetRole
235ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
236ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function is called by the application to set the PAN
237ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  profile role. This should be called after PAN_Register.
238ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  This can be called any time to change the PAN role
239ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
240ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Parameters:      role        - is bit map of roles to be active
241ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                                      PAN_ROLE_CLIENT is for PANU role
242ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                                      PAN_ROLE_GN_SERVER is for GN role
243ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                                      PAN_ROLE_NAP_SERVER is for NAP role
244ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  sec_mask    - Security mask for different roles
2459ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                      It is array of uint8_t. The bytes
2469ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                      represent the security for roles PANU,
2479ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                      GN and NAP in order
2489ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *
249ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  p_user_name - Service name for PANU role
250ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  p_gn_name   - Service name for GN role
251ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  p_nap_name  - Service name for NAP role
2529ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                  Can be NULL if user wants it to be default
253ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
254ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns          PAN_SUCCESS     - if the role is set successfully
255ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  PAN_FAILURE     - if the role is not valid
256ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
257ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
258911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern tPAN_RESULT PAN_SetRole(uint8_t role, uint8_t* sec_mask,
259911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                               const char* p_user_name, const char* p_gn_name,
260911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                               const char* p_nap_name);
2615738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2625738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
263ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
264ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         PAN_Connect
265ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
266ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function is called by the application to initiate a
267ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  connection to the remote device
268ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
269ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Parameters:      rem_bda     - BD Addr of the remote device
270ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  src_role    - Role of the local device for the connection
271ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  dst_role    - Role of the remote device for the connection
272ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                                      PAN_ROLE_CLIENT is for PANU role
273ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                                      PAN_ROLE_GN_SERVER is for GN role
274ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                                      PAN_ROLE_NAP_SERVER is for NAP role
275ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  *handle     - Pointer for returning Handle to the connection
276ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
2779ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson * Returns          PAN_SUCCESS - if the connection is initiated successfully
278ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  PAN_NO_RESOURCES - resources are not sufficent
279ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  PAN_FAILURE      - if the connection cannot be initiated
2809ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                     this can be because of the combination of
2819ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                     src and dst roles may not be valid or
2829ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                                     allowed at that point of time
283ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
284ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
285911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern tPAN_RESULT PAN_Connect(BD_ADDR rem_bda, uint8_t src_role,
286911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                               uint8_t dst_role, uint16_t* handle);
2875738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
2885738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
289ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
290ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         PAN_Disconnect
291ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
292ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This is used to disconnect the connection
293ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
294ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Parameters:      handle           - handle for the connection
295ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
296ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns          PAN_SUCCESS      - if the connection is closed successfully
297ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  PAN_FAILURE      - if the connection is not found or
298ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                                           there is an error in disconnecting
299ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
300ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
301911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern tPAN_RESULT PAN_Disconnect(uint16_t handle);
3025738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
3035738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
304ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
305ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         PAN_Write
306ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
307ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This sends data over the PAN connections. If this is called
308ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  on GN or NAP side and the packet is multicast or broadcast
309ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  it will be sent on all the links. Otherwise the correct link
3109ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  is found based on the destination address and forwarded on
3119ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  it. If the return value is not PAN_SUCCESS the application
3129ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  should take care of releasing the message buffer
313ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
314ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Parameters:      dst      - MAC or BD Addr of the destination device
315ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  src      - MAC or BD Addr of the source who sent this packet
316ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  protocol - protocol of the ethernet packet like IP or ARP
317ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  p_data   - pointer to the data
318ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  len      - length of the data
319ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  ext      - to indicate that extension headers present
320ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
321ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns          PAN_SUCCESS       - if the data is sent successfully
322ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  PAN_FAILURE       - if the connection is not found or
323ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                                           there is an error in sending data
324ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
325ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
326911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern tPAN_RESULT PAN_Write(uint16_t handle, BD_ADDR dst, BD_ADDR src,
327911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                             uint16_t protocol, uint8_t* p_data, uint16_t len,
328911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                             bool ext);
3295738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
3305738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
331ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
332ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         PAN_WriteBuf
333ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
334ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This sends data over the PAN connections. If this is called
335ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  on GN or NAP side and the packet is multicast or broadcast
336ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  it will be sent on all the links. Otherwise the correct link
3379ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  is found based on the destination address and forwarded on
3389ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  it. If the return value is not PAN_SUCCESS the application
3399ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  should take care of releasing the message buffer
340ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
341ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Parameters:      dst      - MAC or BD Addr of the destination device
342ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  src      - MAC or BD Addr of the source who sent this packet
343ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  protocol - protocol of the ethernet packet like IP or ARP
344ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  p_buf    - pointer to the data buffer
345ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  ext      - to indicate that extension headers present
346ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
347ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns          PAN_SUCCESS       - if the data is sent successfully
348ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  PAN_FAILURE       - if the connection is not found or
349ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                                           there is an error in sending data
350ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
351ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
352911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern tPAN_RESULT PAN_WriteBuf(uint16_t handle, BD_ADDR dst, BD_ADDR src,
353911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                uint16_t protocol, BT_HDR* p_buf, bool ext);
3545738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
3555738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
356ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
357ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         PAN_SetProtocolFilters
358ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
359ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function is used to set protocol filters on the peer
360ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
361ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Parameters:      handle      - handle for the connection
362ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  num_filters - number of protocol filter ranges
363ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  start       - array of starting protocol numbers
364ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  end         - array of ending protocol numbers
365ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
366ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
3679ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson * Returns          PAN_SUCCESS     if protocol filters are set successfully
3689ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  PAN_FAILURE     if connection not found or error in setting
369ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
370ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
371911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern tPAN_RESULT PAN_SetProtocolFilters(uint16_t handle, uint16_t num_filters,
372911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                          uint16_t* p_start_array,
373911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                          uint16_t* p_end_array);
3745738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
3755738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
376ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
377ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         PAN_SetMulticastFilters
378ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
379ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function is used to set multicast filters on the peer
380ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
381ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Parameters:      handle      - handle for the connection
382ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  num_filters - number of multicast filter ranges
383ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  p_start_array - Pointer to sequence of beginings of all
384ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                                         multicast address ranges
385ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  p_end_array   - Pointer to sequence of ends of all
386ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                                         multicast address ranges
387ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
388ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
3899ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson * Returns          PAN_SUCCESS     if multicast filters are set successfully
3909ca07091a1f07ea201cee0504dab6a1d7073d429Myles Watson *                  PAN_FAILURE     if connection not found or error in setting
391ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
392ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
393911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern tBNEP_RESULT PAN_SetMulticastFilters(uint16_t handle,
394911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                            uint16_t num_mcast_filters,
395911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                            uint8_t* p_start_array,
396911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson                                            uint8_t* p_end_array);
3975738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
3985738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
399ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
400ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         PAN_SetTraceLevel
401ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
402ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function sets the trace level for PAN. If called with
403ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  a value of 0xFF, it simply reads the current trace level.
404ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
405ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns          the new (current) trace level
406ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
407ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
408911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern uint8_t PAN_SetTraceLevel(uint8_t new_level);
4095738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
4105738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project/*******************************************************************************
411ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
412ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Function         PAN_Init
413ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
414ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Description      This function initializes the PAN unit. It should be called
415ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  before accessing any other APIs to initialize the control
416ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *                  block.
417ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
418ee96a3c60fca590d38025925c072d264e06493c4Myles Watson * Returns          void
419ee96a3c60fca590d38025925c072d264e06493c4Myles Watson *
420ee96a3c60fca590d38025925c072d264e06493c4Myles Watson ******************************************************************************/
421911d1ae03efec2d54c3b1b605589d790d1745488Myles Watsonextern void PAN_Init(void);
4225738f83aeb59361a0a2eda2460113f6dc919427The Android Open Source Project
423911d1ae03efec2d54c3b1b605589d790d1745488Myles Watson#endif /* PAN_API_H */
424