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 #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 BD_ADDR 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, BD_ADDR p_bda, 101 tBT_UUID* remote_uuid, tBT_UUID* local_uuid, 102 bool is_role_change); 103 extern void pan_connect_state_cb(uint16_t handle, BD_ADDR rem_bda, 104 tBNEP_RESULT result, bool is_role_change); 105 extern void pan_data_ind_cb(uint16_t handle, uint8_t* src, uint8_t* dst, 106 uint16_t protocol, uint8_t* p_data, uint16_t len, 107 bool fw_ext_present); 108 extern void pan_data_buf_ind_cb(uint16_t handle, uint8_t* src, uint8_t* dst, 109 uint16_t protocol, BT_HDR* p_buf, bool ext); 110 extern void pan_tx_data_flow_cb(uint16_t handle, tBNEP_RESULT event); 111 void pan_proto_filt_ind_cb(uint16_t handle, bool indication, 112 tBNEP_RESULT result, uint16_t num_filters, 113 uint8_t* p_filters); 114 void pan_mcast_filt_ind_cb(uint16_t handle, bool indication, 115 tBNEP_RESULT result, uint16_t num_filters, 116 uint8_t* p_filters); 117 extern uint32_t pan_register_with_sdp(uint16_t uuid, uint8_t sec_mask, 118 const char* p_name, const char* p_desc); 119 extern tPAN_CONN* pan_allocate_pcb(BD_ADDR p_bda, uint16_t handle); 120 extern tPAN_CONN* pan_get_pcb_by_handle(uint16_t handle); 121 extern tPAN_CONN* pan_get_pcb_by_addr(BD_ADDR p_bda); 122 extern void pan_close_all_connections(void); 123 extern void pan_release_pcb(tPAN_CONN* p_pcb); 124 extern void pan_dump_status(void); 125 126 /******************************************************************************/ 127 128 #endif 129