diff options
author | Sharvil Nanavati <sharvil@google.com> | 2015-01-20 23:12:31 -0800 |
---|---|---|
committer | Andre Eisenbach <eisenbach@google.com> | 2015-03-16 16:51:42 -0700 |
commit | f105417abd42ccdc3c36a154a86596d5aa5ae424 (patch) | |
tree | 860c5df146d78459f74ec87e9f54489fcf5ffc92 /stack | |
parent | 41e319644db0b951c8c08fb3b50cbb0e1778b381 (diff) | |
download | android_system_bt-f105417abd42ccdc3c36a154a86596d5aa5ae424.tar.gz android_system_bt-f105417abd42ccdc3c36a154a86596d5aa5ae424.tar.bz2 android_system_bt-f105417abd42ccdc3c36a154a86596d5aa5ae424.zip |
Collapse BNEP #defines that don't need to be configurable.
In some instances, defining these macros to FALSE would result in
broken runtime behavior (e.g. UUID fields containing uninitialized
values). This change collapses the following defines:
BNEP_SUPPORTS_PROT_FILTERS
BNEP_SUPPORTS_MULTI_FILTERS
BNEP_SUPPORTS_DEBUG_DUMP
BNEP_SUPPORTS_ALL_UUID_LENGTHS
Diffstat (limited to 'stack')
-rw-r--r-- | stack/bnep/bnep_api.c | 13 | ||||
-rw-r--r-- | stack/bnep/bnep_int.h | 1 | ||||
-rw-r--r-- | stack/bnep/bnep_main.c | 4 | ||||
-rw-r--r-- | stack/bnep/bnep_utils.c | 74 | ||||
-rw-r--r-- | stack/pan/pan_api.c | 8 | ||||
-rw-r--r-- | stack/pan/pan_main.c | 11 |
6 files changed, 0 insertions, 111 deletions
diff --git a/stack/bnep/bnep_api.c b/stack/bnep/bnep_api.c index c9987cb2f..76bffca50 100644 --- a/stack/bnep/bnep_api.c +++ b/stack/bnep/bnep_api.c @@ -150,11 +150,6 @@ tBNEP_RESULT BNEP_Connect (BD_ADDR p_rem_bda, if (src_uuid->len != dst_uuid->len) return BNEP_CONN_FAILED_UUID_SIZE; -#if (!defined (BNEP_SUPPORTS_ALL_UUID_LENGTHS) || BNEP_SUPPORTS_ALL_UUID_LENGTHS == FALSE) - if (src_uuid->len != 2) - return BNEP_CONN_FAILED_UUID_SIZE; -#endif - if (!p_bcb) { if ((p_bcb = bnepu_allocate_bcb (p_rem_bda)) == NULL) @@ -585,7 +580,6 @@ tBNEP_RESULT BNEP_SetProtocolFilters (UINT16 handle, UINT16 *p_start_array, UINT16 *p_end_array) { -#if (defined (BNEP_SUPPORTS_PROT_FILTERS) && BNEP_SUPPORTS_PROT_FILTERS == TRUE) UINT16 xx; tBNEP_CONN *p_bcb; @@ -618,9 +612,6 @@ tBNEP_RESULT BNEP_SetProtocolFilters (UINT16 handle, bnepu_send_peer_our_filters (p_bcb); return (BNEP_SUCCESS); -#else - return (BNEP_SET_FILTER_FAIL); -#endif } @@ -648,7 +639,6 @@ tBNEP_RESULT BNEP_SetMulticastFilters (UINT16 handle, UINT8 *p_start_array, UINT8 *p_end_array) { -#if (defined (BNEP_SUPPORTS_MULTI_FILTERS) && BNEP_SUPPORTS_MULTI_FILTERS == TRUE) UINT16 xx; tBNEP_CONN *p_bcb; @@ -684,9 +674,6 @@ tBNEP_RESULT BNEP_SetMulticastFilters (UINT16 handle, bnepu_send_peer_our_multi_filters (p_bcb); return (BNEP_SUCCESS); -#else - return (BNEP_SET_FILTER_FAIL); -#endif } /******************************************************************************* diff --git a/stack/bnep/bnep_int.h b/stack/bnep/bnep_int.h index 9d641b5b6..5322e5039 100644 --- a/stack/bnep/bnep_int.h +++ b/stack/bnep/bnep_int.h @@ -239,7 +239,6 @@ extern void bnep_sec_check_complete (BD_ADDR bd_addr, tBT_TRANSPORT trasn extern tBNEP_RESULT bnep_is_packet_allowed (tBNEP_CONN *p_bcb, BD_ADDR p_dest_addr, UINT16 protocol, BOOLEAN fw_ext_present, UINT8 *p_data); extern UINT32 bnep_get_uuid32 (tBT_UUID *src_uuid); -extern void bnep_dump_status (void); diff --git a/stack/bnep/bnep_main.c b/stack/bnep/bnep_main.c index 3ea7dc021..b29884075 100644 --- a/stack/bnep/bnep_main.c +++ b/stack/bnep/bnep_main.c @@ -726,7 +726,6 @@ void bnep_process_timeout (TIMER_LIST_ENT *p_tle) bnepu_release_bcb (p_bcb); } -#if (defined (BNEP_SUPPORTS_PROT_FILTERS) && BNEP_SUPPORTS_PROT_FILTERS == TRUE) else if (p_bcb->con_flags & BNEP_FLAGS_FILTER_RESP_PEND) { if (p_bcb->re_transmits++ != BNEP_MAX_RETRANSMITS) @@ -746,8 +745,6 @@ void bnep_process_timeout (TIMER_LIST_ENT *p_tle) return; } } -#endif -#if (defined (BNEP_SUPPORTS_MULTI_FILTERS) && BNEP_SUPPORTS_MULTI_FILTERS == TRUE) else if (p_bcb->con_flags & BNEP_FLAGS_MULTI_RESP_PEND) { if (p_bcb->re_transmits++ != BNEP_MAX_RETRANSMITS) @@ -767,7 +764,6 @@ void bnep_process_timeout (TIMER_LIST_ENT *p_tle) return; } } -#endif } diff --git a/stack/bnep/bnep_utils.c b/stack/bnep/bnep_utils.c index c88a9b443..8c76b0028 100644 --- a/stack/bnep/bnep_utils.c +++ b/stack/bnep/bnep_utils.c @@ -197,7 +197,6 @@ void bnep_send_conn_req (tBNEP_CONN *p_bcb) UINT16_TO_BE_STREAM (p, p_bcb->dst_uuid.uu.uuid16); UINT16_TO_BE_STREAM (p, p_bcb->src_uuid.uu.uuid16); } -#if (defined (BNEP_SUPPORTS_ALL_UUID_LENGTHS) && BNEP_SUPPORTS_ALL_UUID_LENGTHS == TRUE) else if (p_bcb->dst_uuid.len == 4) { UINT32_TO_BE_STREAM (p, p_bcb->dst_uuid.uu.uuid32); @@ -210,7 +209,6 @@ void bnep_send_conn_req (tBNEP_CONN *p_bcb) memcpy (p, p_bcb->src_uuid.uu.uuid128, p_bcb->dst_uuid.len); p += p_bcb->dst_uuid.len; } -#endif p_buf->len = (UINT16)(p - p_start); @@ -268,7 +266,6 @@ void bnep_send_conn_responce (tBNEP_CONN *p_bcb, UINT16 resp_code) *******************************************************************************/ void bnepu_send_peer_our_filters (tBNEP_CONN *p_bcb) { -#if (defined (BNEP_SUPPORTS_PROT_FILTERS) && BNEP_SUPPORTS_PROT_FILTERS == TRUE) BT_HDR *p_buf; UINT8 *p; UINT16 xx; @@ -305,7 +302,6 @@ void bnepu_send_peer_our_filters (tBNEP_CONN *p_bcb) /* Start timer waiting for setup response */ btu_start_timer (&p_bcb->conn_tle, BTU_TTYPE_BNEP, BNEP_FILTER_SET_TIMEOUT); -#endif } @@ -320,7 +316,6 @@ void bnepu_send_peer_our_filters (tBNEP_CONN *p_bcb) *******************************************************************************/ void bnepu_send_peer_our_multi_filters (tBNEP_CONN *p_bcb) { -#if (defined (BNEP_SUPPORTS_MULTI_FILTERS) && BNEP_SUPPORTS_MULTI_FILTERS == TRUE) BT_HDR *p_buf; UINT8 *p; UINT16 xx; @@ -359,7 +354,6 @@ void bnepu_send_peer_our_multi_filters (tBNEP_CONN *p_bcb) /* Start timer waiting for setup response */ btu_start_timer (&p_bcb->conn_tle, BTU_TTYPE_BNEP, BNEP_FILTER_SET_TIMEOUT); -#endif } @@ -637,7 +631,6 @@ void bnep_process_setup_conn_req (tBNEP_CONN *p_bcb, UINT8 *p_setup, UINT8 len) return; } } -#if (defined (BNEP_SUPPORTS_ALL_UUID_LENGTHS) && BNEP_SUPPORTS_ALL_UUID_LENGTHS == TRUE) else if (p_bcb->dst_uuid.len == 4) { BE_STREAM_TO_UINT32 (p_bcb->src_uuid.uu.uuid32, p_setup); @@ -650,7 +643,6 @@ void bnep_process_setup_conn_req (tBNEP_CONN *p_bcb, UINT8 *p_setup, UINT8 len) memcpy (p_bcb->dst_uuid.uu.uuid128, p_setup, p_bcb->dst_uuid.len); p_setup += p_bcb->dst_uuid.len; } -#endif else { BNEP_TRACE_ERROR ("BNEP - Bad UID len %d in ConnReq", p_bcb->dst_uuid.len); @@ -902,7 +894,6 @@ UINT8 *bnep_process_control_packet (tBNEP_CONN *p_bcb, UINT8 *p, UINT16 *rem_len *******************************************************************************/ void bnepu_process_peer_filter_set (tBNEP_CONN *p_bcb, UINT8 *p_filters, UINT16 len) { -#if (defined (BNEP_SUPPORTS_PROT_FILTERS) && BNEP_SUPPORTS_PROT_FILTERS == TRUE) UINT16 num_filters = 0; UINT16 xx, resp_code = BNEP_FILTER_CRL_OK; UINT16 start, end; @@ -966,9 +957,6 @@ void bnepu_process_peer_filter_set (tBNEP_CONN *p_bcb, UINT8 *p_filters, UINT16 } bnepu_send_peer_filter_rsp (p_bcb, resp_code); -#else - bnepu_send_peer_filter_rsp (p_bcb, BNEP_FILTER_CRL_UNSUPPORTED); -#endif } @@ -984,7 +972,6 @@ void bnepu_process_peer_filter_set (tBNEP_CONN *p_bcb, UINT8 *p_filters, UINT16 *******************************************************************************/ void bnepu_process_peer_filter_rsp (tBNEP_CONN *p_bcb, UINT8 *p_data) { -#if (defined (BNEP_SUPPORTS_PROT_FILTERS) && BNEP_SUPPORTS_PROT_FILTERS == TRUE) UINT16 resp_code; tBNEP_RESULT result; @@ -1017,13 +1004,8 @@ void bnepu_process_peer_filter_rsp (tBNEP_CONN *p_bcb, UINT8 *p_data) if (bnep_cb.p_filter_ind_cb) (*bnep_cb.p_filter_ind_cb) (p_bcb->handle, FALSE, result, 0, NULL); - - return; -#endif } - - /******************************************************************************* ** ** Function bnepu_process_multicast_filter_rsp @@ -1036,7 +1018,6 @@ void bnepu_process_peer_filter_rsp (tBNEP_CONN *p_bcb, UINT8 *p_data) *******************************************************************************/ void bnepu_process_multicast_filter_rsp (tBNEP_CONN *p_bcb, UINT8 *p_data) { -#if (defined (BNEP_SUPPORTS_MULTI_FILTERS) && BNEP_SUPPORTS_MULTI_FILTERS == TRUE) UINT16 resp_code; tBNEP_RESULT result; @@ -1069,13 +1050,8 @@ void bnepu_process_multicast_filter_rsp (tBNEP_CONN *p_bcb, UINT8 *p_data) if (bnep_cb.p_mfilter_ind_cb) (*bnep_cb.p_mfilter_ind_cb) (p_bcb->handle, FALSE, result, 0, NULL); - - return; -#endif } - - /******************************************************************************* ** ** Function bnepu_process_peer_multicast_filter_set @@ -1089,7 +1065,6 @@ void bnepu_process_multicast_filter_rsp (tBNEP_CONN *p_bcb, UINT8 *p_data) *******************************************************************************/ void bnepu_process_peer_multicast_filter_set (tBNEP_CONN *p_bcb, UINT8 *p_filters, UINT16 len) { -#if (defined (BNEP_SUPPORTS_MULTI_FILTERS) && BNEP_SUPPORTS_MULTI_FILTERS == TRUE) UINT16 resp_code = BNEP_FILTER_CRL_OK; UINT16 num_filters, xx; UINT8 *p_temp_filters, null_bda[BD_ADDR_LEN] = {0,0,0,0,0,0}; @@ -1156,9 +1131,6 @@ void bnepu_process_peer_multicast_filter_set (tBNEP_CONN *p_bcb, UINT8 *p_filter if (bnep_cb.p_mfilter_ind_cb) (*bnep_cb.p_mfilter_ind_cb) (p_bcb->handle, TRUE, 0, len, p_filters); -#else - bnepu_send_peer_multicast_filter_rsp (p_bcb, BNEP_FILTER_CRL_UNSUPPORTED); -#endif } @@ -1321,7 +1293,6 @@ tBNEP_RESULT bnep_is_packet_allowed (tBNEP_CONN *p_bcb, BOOLEAN fw_ext_present, UINT8 *p_data) { -#if (defined (BNEP_SUPPORTS_PROT_FILTERS) && BNEP_SUPPORTS_PROT_FILTERS == TRUE) if (p_bcb->rcvd_num_filters) { UINT16 i, proto; @@ -1359,9 +1330,7 @@ tBNEP_RESULT bnep_is_packet_allowed (tBNEP_CONN *p_bcb, return BNEP_IGNORE_CMD; } } -#endif -#if (defined (BNEP_SUPPORTS_MULTI_FILTERS) && BNEP_SUPPORTS_MULTI_FILTERS == TRUE) /* Ckeck for multicast address filtering */ if ((p_dest_addr[0] & 0x01) && p_bcb->rcvd_mcast_filters) @@ -1392,15 +1361,10 @@ tBNEP_RESULT bnep_is_packet_allowed (tBNEP_CONN *p_bcb, return BNEP_IGNORE_CMD; } } -#endif return BNEP_SUCCESS; } - - - - /******************************************************************************* ** ** Function bnep_get_uuid32 @@ -1425,41 +1389,3 @@ UINT32 bnep_get_uuid32 (tBT_UUID *src_uuid) return result; } } - - - - -/******************************************************************************* -** -** Function bnep_dump_status -** -** Description This function dumps the bnep control block and connection -** blocks information -** -** Returns none -** -*******************************************************************************/ -void bnep_dump_status (void) -{ -#if (defined (BNEP_SUPPORTS_DEBUG_DUMP) && BNEP_SUPPORTS_DEBUG_DUMP == TRUE) - UINT16 i; - char buff[200]; - tBNEP_CONN *p_bcb; - - BNEP_TRACE_DEBUG ("profile registered %d, trace %d", bnep_cb.profile_registered, bnep_cb.trace_level); - - for (i = 0, p_bcb = bnep_cb.bcb; i < BNEP_MAX_CONNECTIONS; i++, p_bcb++) - { - sprintf (buff, "%d state %d, flags 0x%x, cid %d, pfilts %d, mfilts %d, src 0x%x, dst 0x%x, BD %x.%x.%x.%x.%x.%x", - i, p_bcb->con_state, p_bcb->con_flags, p_bcb->l2cap_cid, - p_bcb->rcvd_num_filters, p_bcb->rcvd_mcast_filters, - p_bcb->src_uuid.uu.uuid16, p_bcb->dst_uuid.uu.uuid16, - p_bcb->rem_bda[0], p_bcb->rem_bda[1], p_bcb->rem_bda[2], - p_bcb->rem_bda[3], p_bcb->rem_bda[4], p_bcb->rem_bda[5]); - - BNEP_TRACE_DEBUG (buff); - } -#endif -} - - diff --git a/stack/pan/pan_api.c b/stack/pan/pan_api.c index 61175c62c..583f1d236 100644 --- a/stack/pan/pan_api.c +++ b/stack/pan/pan_api.c @@ -673,7 +673,6 @@ tPAN_RESULT PAN_SetProtocolFilters (UINT16 handle, UINT16 *p_start_array, UINT16 *p_end_array) { -#if (defined (BNEP_SUPPORTS_PROT_FILTERS) && BNEP_SUPPORTS_PROT_FILTERS == TRUE) tPAN_CONN *pcb; tPAN_RESULT result; @@ -694,9 +693,6 @@ tPAN_RESULT PAN_SetProtocolFilters (UINT16 handle, PAN_TRACE_API ("PAN successfully sent protocol filters for handle %d", handle); return PAN_SUCCESS; -#else - return PAN_FAILURE; -#endif } @@ -722,7 +718,6 @@ tBNEP_RESULT PAN_SetMulticastFilters (UINT16 handle, UINT8 *p_start_array, UINT8 *p_end_array) { -#if (defined (BNEP_SUPPORTS_MULTI_FILTERS) && BNEP_SUPPORTS_MULTI_FILTERS == TRUE) tPAN_CONN *pcb; tPAN_RESULT result; @@ -744,9 +739,6 @@ tBNEP_RESULT PAN_SetMulticastFilters (UINT16 handle, PAN_TRACE_API ("PAN successfully sent multicast filters for handle %d", handle); return PAN_SUCCESS; -#else - return PAN_FAILURE; -#endif } diff --git a/stack/pan/pan_main.c b/stack/pan/pan_main.c index 8306df302..56a8f12cf 100644 --- a/stack/pan/pan_main.c +++ b/stack/pan/pan_main.c @@ -112,7 +112,6 @@ void pan_conn_ind_cb (UINT16 handle, ** is for NAP */ wrong_uuid = FALSE; -#if (defined (BNEP_SUPPORTS_ALL_UUID_LENGTHS) && BNEP_SUPPORTS_ALL_UUID_LENGTHS == TRUE) if (remote_uuid->len == 16) { /* @@ -189,7 +188,6 @@ void pan_conn_ind_cb (UINT16 handle, BNEP_ConnectResp (handle, BNEP_CONN_FAILED_UUID_SIZE); return; } -#endif /* Check if the source UUID is a valid one */ if (remote_uuid->uu.uuid16 != UUID_SERVCLASS_PANU && @@ -681,15 +679,11 @@ void pan_proto_filt_ind_cb (UINT16 handle, UINT16 num_filters, UINT8 *p_filters) { -#if (defined (BNEP_SUPPORTS_PROT_FILTERS) && BNEP_SUPPORTS_PROT_FILTERS == TRUE) PAN_TRACE_EVENT ("pan_proto_filt_ind_cb - called for handle %d with ind %d, result %d, num %d", handle, indication, result, num_filters); if (pan_cb.pan_pfilt_ind_cb) (*pan_cb.pan_pfilt_ind_cb) (handle, indication, result, num_filters, p_filters); -#endif - - return; } @@ -719,14 +713,9 @@ void pan_mcast_filt_ind_cb (UINT16 handle, UINT16 num_filters, UINT8 *p_filters) { -#if (defined (BNEP_SUPPORTS_MULTI_FILTERS) && BNEP_SUPPORTS_MULTI_FILTERS == TRUE) PAN_TRACE_EVENT ("pan_mcast_filt_ind_cb - called for handle %d with ind %d, result %d, num %d", handle, indication, result, num_filters); if (pan_cb.pan_mfilt_ind_cb) (*pan_cb.pan_mfilt_ind_cb) (handle, indication, result, num_filters, p_filters); -#endif - - return; } - |