• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  *  Copyright 2001-2012 Broadcom Corporation
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 
19 /******************************************************************************
20  *
21  *  This file contains internally used PAN definitions
22  *
23  ******************************************************************************/
24 
25 #ifndef PAN_INT_H
26 #define PAN_INT_H
27 
28 #include "pan_api.h"
29 
30 /*
31  * This role is used to shutdown the profile. Used internally
32  * Applications should call PAN_Deregister to shutdown the profile
33  */
34 #define PAN_ROLE_INACTIVE 0
35 
36 /* Protocols supported by the host internal stack, are registered with SDP */
37 #define PAN_PROTOCOL_IP 0x0800
38 #define PAN_PROTOCOL_ARP 0x0806
39 
40 #define PAN_PROFILE_VERSION 0x0100 /* Version 1.00 */
41 
42 /* Define the PAN Connection Control Block
43  */
44 typedef struct {
45 #define PAN_STATE_IDLE 0
46 #define PAN_STATE_CONN_START 1
47 #define PAN_STATE_CONNECTED 2
48   uint8_t con_state;
49 
50 #define PAN_FLAGS_CONN_COMPLETED 0x01
51   uint8_t con_flags;
52 
53   uint16_t handle;
54   RawAddress rem_bda;
55 
56   uint16_t bad_pkts_rcvd;
57   uint16_t src_uuid;
58   uint16_t dst_uuid;
59   uint16_t prv_src_uuid;
60   uint16_t prv_dst_uuid;
61   uint16_t ip_addr_known;
62   uint32_t ip_addr;
63 
64 } tPAN_CONN;
65 
66 /*  The main PAN control block
67  */
68 typedef struct {
69   uint8_t role;
70   uint8_t active_role;
71   uint8_t prv_active_role;
72   tPAN_CONN pcb[MAX_PAN_CONNS];
73 
74   tPAN_CONN_STATE_CB* pan_conn_state_cb; /* Connection state callback */
75   tPAN_BRIDGE_REQ_CB* pan_bridge_req_cb;
76   tPAN_DATA_IND_CB* pan_data_ind_cb;
77   tPAN_DATA_BUF_IND_CB* pan_data_buf_ind_cb;
78   tPAN_FILTER_IND_CB*
79       pan_pfilt_ind_cb; /* protocol filter indication callback */
80   tPAN_MFILTER_IND_CB*
81       pan_mfilt_ind_cb; /* multicast filter indication callback */
82   tPAN_TX_DATA_FLOW_CB* pan_tx_data_flow_cb;
83 
84   char* user_service_name;
85   char* gn_service_name;
86   char* nap_service_name;
87   uint32_t pan_user_sdp_handle;
88   uint32_t pan_gn_sdp_handle;
89   uint32_t pan_nap_sdp_handle;
90   uint8_t num_conns;
91   uint8_t trace_level;
92 } tPAN_CB;
93 
94 /* Global PAN data
95  */
96 extern tPAN_CB pan_cb;
97 
98 /******************************************************************************/
99 extern void pan_register_with_bnep(void);
100 extern void pan_conn_ind_cb(uint16_t handle, const RawAddress& p_bda,
101                             const bluetooth::Uuid& remote_uuid,
102                             const bluetooth::Uuid& local_uuid,
103                             bool is_role_change);
104 extern void pan_connect_state_cb(uint16_t handle, const RawAddress& rem_bda,
105                                  tBNEP_RESULT result, bool is_role_change);
106 extern void pan_data_ind_cb(uint16_t handle, const RawAddress& src,
107                             const RawAddress& dst, uint16_t protocol,
108                             uint8_t* p_data, uint16_t len, bool fw_ext_present);
109 extern void pan_data_buf_ind_cb(uint16_t handle, const RawAddress& src,
110                                 const RawAddress& dst, uint16_t protocol,
111                                 BT_HDR* p_buf, bool ext);
112 extern void pan_tx_data_flow_cb(uint16_t handle, tBNEP_RESULT event);
113 void pan_proto_filt_ind_cb(uint16_t handle, bool indication,
114                            tBNEP_RESULT result, uint16_t num_filters,
115                            uint8_t* p_filters);
116 void pan_mcast_filt_ind_cb(uint16_t handle, bool indication,
117                            tBNEP_RESULT result, uint16_t num_filters,
118                            uint8_t* p_filters);
119 extern uint32_t pan_register_with_sdp(uint16_t uuid, uint8_t sec_mask,
120                                       const char* p_name, const char* p_desc);
121 extern tPAN_CONN* pan_allocate_pcb(const RawAddress& p_bda, uint16_t handle);
122 extern tPAN_CONN* pan_get_pcb_by_handle(uint16_t handle);
123 extern tPAN_CONN* pan_get_pcb_by_addr(const RawAddress& p_bda);
124 extern void pan_close_all_connections(void);
125 extern void pan_release_pcb(tPAN_CONN* p_pcb);
126 extern void pan_dump_status(void);
127 
128 /******************************************************************************/
129 
130 #endif
131