1 /****************************************************************************** 2 * 3 * Copyright (C) 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 { 46 #define PAN_STATE_IDLE 0 47 #define PAN_STATE_CONN_START 1 48 #define PAN_STATE_CONNECTED 2 49 UINT8 con_state; 50 51 #define PAN_FLAGS_CONN_COMPLETED 0x01 52 UINT8 con_flags; 53 54 UINT16 handle; 55 BD_ADDR rem_bda; 56 57 UINT16 bad_pkts_rcvd; 58 UINT16 src_uuid; 59 UINT16 dst_uuid; 60 UINT16 prv_src_uuid; 61 UINT16 prv_dst_uuid; 62 UINT16 ip_addr_known; 63 UINT32 ip_addr; 64 65 } tPAN_CONN; 66 67 68 /* The main PAN control block 69 */ 70 typedef struct 71 { 72 UINT8 role; 73 UINT8 active_role; 74 UINT8 prv_active_role; 75 tPAN_CONN pcb[MAX_PAN_CONNS]; 76 77 tPAN_CONN_STATE_CB *pan_conn_state_cb; /* Connection state callback */ 78 tPAN_BRIDGE_REQ_CB *pan_bridge_req_cb; 79 tPAN_DATA_IND_CB *pan_data_ind_cb; 80 tPAN_DATA_BUF_IND_CB *pan_data_buf_ind_cb; 81 tPAN_FILTER_IND_CB *pan_pfilt_ind_cb; /* protocol filter indication callback */ 82 tPAN_MFILTER_IND_CB *pan_mfilt_ind_cb; /* multicast filter indication callback */ 83 tPAN_TX_DATA_FLOW_CB *pan_tx_data_flow_cb; 84 85 BD_ADDR my_bda; /* BD Address of this device */ 86 char *user_service_name; 87 char *gn_service_name; 88 char *nap_service_name; 89 UINT32 pan_user_sdp_handle; 90 UINT32 pan_gn_sdp_handle; 91 UINT32 pan_nap_sdp_handle; 92 UINT8 num_conns; 93 UINT8 trace_level; 94 } tPAN_CB; 95 96 97 #ifdef __cplusplus 98 extern "C" { 99 #endif 100 101 /* Global PAN data 102 */ 103 #if PAN_DYNAMIC_MEMORY == FALSE 104 PAN_API extern tPAN_CB pan_cb; 105 #else 106 PAN_API extern tPAN_CB *pan_cb_ptr; 107 #define pan_cb (*pan_cb_ptr) 108 #endif 109 110 /*******************************************************************************/ 111 extern void pan_register_with_bnep (void); 112 extern void pan_conn_ind_cb (UINT16 handle, 113 BD_ADDR p_bda, 114 tBT_UUID *remote_uuid, 115 tBT_UUID *local_uuid, 116 BOOLEAN is_role_change); 117 extern void pan_connect_state_cb (UINT16 handle, BD_ADDR rem_bda, tBNEP_RESULT result, BOOLEAN is_role_change); 118 extern void pan_data_ind_cb (UINT16 handle, 119 UINT8 *src, 120 UINT8 *dst, 121 UINT16 protocol, 122 UINT8 *p_data, 123 UINT16 len, 124 BOOLEAN fw_ext_present); 125 extern void pan_data_buf_ind_cb (UINT16 handle, 126 UINT8 *src, 127 UINT8 *dst, 128 UINT16 protocol, 129 BT_HDR *p_buf, 130 BOOLEAN ext); 131 extern void pan_tx_data_flow_cb (UINT16 handle, 132 tBNEP_RESULT event); 133 void pan_proto_filt_ind_cb (UINT16 handle, 134 BOOLEAN indication, 135 tBNEP_RESULT result, 136 UINT16 num_filters, 137 UINT8 *p_filters); 138 void pan_mcast_filt_ind_cb (UINT16 handle, 139 BOOLEAN indication, 140 tBNEP_RESULT result, 141 UINT16 num_filters, 142 UINT8 *p_filters); 143 extern UINT32 pan_register_with_sdp (UINT16 uuid, UINT8 sec_mask, char *p_name, char *p_desc); 144 extern tPAN_CONN *pan_allocate_pcb (BD_ADDR p_bda, UINT16 handle); 145 extern tPAN_CONN *pan_get_pcb_by_handle (UINT16 handle); 146 extern tPAN_CONN *pan_get_pcb_by_addr (BD_ADDR p_bda); 147 extern void pan_close_all_connections (void); 148 extern void pan_release_pcb (tPAN_CONN *p_pcb); 149 extern void pan_dump_status (void); 150 151 /********************************************************************************/ 152 153 #ifdef __cplusplus 154 } 155 #endif 156 157 #endif 158 159