From: Hansong Zhang Date: Wed, 9 Sep 2020 20:07:47 +0000 (-0700) Subject: SDP_SERVER_ENABLED is always true X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f8c7eea0345621b1acdc25d0d7e58db5d4672fc2;p=android-x86%2Fsystem-bt.git SDP_SERVER_ENABLED is always true Bug: 159815595 Tag: #refactor Test: compile & verify basic functions working Change-Id: I22fa27b8eeab933b4529e6dec423327721428d8f --- diff --git a/internal_include/bt_target.h b/internal_include/bt_target.h index a0f815ea9..469e533b3 100644 --- a/internal_include/bt_target.h +++ b/internal_include/bt_target.h @@ -652,11 +652,6 @@ * *****************************************************************************/ -/* This is set to enable SDP server functionality. */ -#ifndef SDP_SERVER_ENABLED -#define SDP_SERVER_ENABLED TRUE -#endif - /* The maximum number of SDP records the server can support. */ #ifndef SDP_MAX_RECORDS #define SDP_MAX_RECORDS 30 diff --git a/stack/sdp/sdp_api.cc b/stack/sdp/sdp_api.cc index 34ac349d1..759b3b007 100644 --- a/stack/sdp/sdp_api.cc +++ b/stack/sdp/sdp_api.cc @@ -901,7 +901,6 @@ uint16_t SDP_GetDiRecord(uint8_t get_record_index, ******************************************************************************/ uint16_t SDP_SetLocalDiRecord(tSDP_DI_RECORD* p_device_info, uint32_t* p_handle) { -#if (SDP_SERVER_ENABLED == TRUE) uint16_t result = SDP_SUCCESS; uint32_t handle; uint16_t di_uuid = UUID_SERVCLASS_PNP_INFORMATION; @@ -1026,9 +1025,6 @@ uint16_t SDP_SetLocalDiRecord(tSDP_DI_RECORD* p_device_info, sdp_cb.server_db.di_primary_handle = handle; return result; -#else /* SDP_SERVER_ENABLED is FALSE */ - return SDP_DI_REG_FAILED; -#endif /* if SDP_SERVER_ENABLED */ } /******************************************************************************* diff --git a/stack/sdp/sdp_db.cc b/stack/sdp/sdp_db.cc index 2cc04b039..693f0bdc7 100644 --- a/stack/sdp/sdp_db.cc +++ b/stack/sdp/sdp_db.cc @@ -32,7 +32,6 @@ #include "sdp_api.h" #include "sdpint.h" -#if (SDP_SERVER_ENABLED == TRUE) /******************************************************************************/ /* L O C A L F U N C T I O N P R O T O T Y P E S */ /******************************************************************************/ @@ -232,8 +231,6 @@ static int sdp_compose_proto_list(uint8_t* p, uint16_t num_elem, return (p - p_head); } -#endif /* SDP_SERVER_ENABLED == TRUE */ - /******************************************************************************* * * Function SDP_CreateRecord @@ -247,7 +244,6 @@ static int sdp_compose_proto_list(uint8_t* p, uint16_t num_elem, * ******************************************************************************/ uint32_t SDP_CreateRecord(void) { -#if (SDP_SERVER_ENABLED == TRUE) uint32_t handle; uint8_t buf[4]; tSDP_DB* p_db = &sdp_cb.server_db; @@ -276,7 +272,6 @@ uint32_t SDP_CreateRecord(void) { } else SDP_TRACE_ERROR("SDP_CreateRecord fail, exceed maximum records:%d", SDP_MAX_RECORDS); -#endif return (0); } @@ -294,7 +289,6 @@ uint32_t SDP_CreateRecord(void) { * ******************************************************************************/ bool SDP_DeleteRecord(uint32_t handle) { -#if (SDP_SERVER_ENABLED == TRUE) uint16_t xx, yy, zz; tSDP_RECORD* p_rec = &sdp_cb.server_db.record[0]; @@ -333,7 +327,6 @@ bool SDP_DeleteRecord(uint32_t handle) { } } } -#endif return (false); } @@ -353,7 +346,6 @@ bool SDP_DeleteRecord(uint32_t handle) { ******************************************************************************/ bool SDP_AddAttribute(uint32_t handle, uint16_t attr_id, uint8_t attr_type, uint32_t attr_len, uint8_t* p_val) { -#if (SDP_SERVER_ENABLED == TRUE) uint16_t xx, yy, zz; tSDP_RECORD* p_rec = &sdp_cb.server_db.record[0]; @@ -451,7 +443,6 @@ bool SDP_AddAttribute(uint32_t handle, uint16_t attr_id, uint8_t attr_type, return (true); } } -#endif return (false); } @@ -471,7 +462,6 @@ bool SDP_AddAttribute(uint32_t handle, uint16_t attr_id, uint8_t attr_type, ******************************************************************************/ bool SDP_AddSequence(uint32_t handle, uint16_t attr_id, uint16_t num_elem, uint8_t type[], uint8_t len[], uint8_t* p_val[]) { -#if (SDP_SERVER_ENABLED == TRUE) uint16_t xx; uint8_t* p; uint8_t* p_head; @@ -526,9 +516,6 @@ bool SDP_AddSequence(uint32_t handle, uint16_t attr_id, uint16_t num_elem, (uint32_t)(p - p_buff), p_buff); osi_free(p_buff); return result; -#else /* SDP_SERVER_ENABLED == FALSE */ - return (false); -#endif } /******************************************************************************* @@ -545,7 +532,6 @@ bool SDP_AddSequence(uint32_t handle, uint16_t attr_id, uint16_t num_elem, ******************************************************************************/ bool SDP_AddUuidSequence(uint32_t handle, uint16_t attr_id, uint16_t num_uuids, uint16_t* p_uuids) { -#if (SDP_SERVER_ENABLED == TRUE) uint16_t xx; uint8_t* p; int32_t max_len = SDP_MAX_ATTR_LEN - 3; @@ -571,9 +557,6 @@ bool SDP_AddUuidSequence(uint32_t handle, uint16_t attr_id, uint16_t num_uuids, (uint32_t)(p - p_buff), p_buff); osi_free(p_buff); return result; -#else /* SDP_SERVER_ENABLED == FALSE */ - return (false); -#endif } /******************************************************************************* @@ -590,7 +573,6 @@ bool SDP_AddUuidSequence(uint32_t handle, uint16_t attr_id, uint16_t num_uuids, ******************************************************************************/ bool SDP_AddProtocolList(uint32_t handle, uint16_t num_elem, tSDP_PROTOCOL_ELEM* p_elem_list) { -#if (SDP_SERVER_ENABLED == TRUE) int offset; bool result; uint8_t* p_buff = @@ -601,9 +583,6 @@ bool SDP_AddProtocolList(uint32_t handle, uint16_t num_elem, DATA_ELE_SEQ_DESC_TYPE, (uint32_t)offset, p_buff); osi_free(p_buff); return result; -#else /* SDP_SERVER_ENABLED == FALSE */ - return (false); -#endif } /******************************************************************************* @@ -620,7 +599,6 @@ bool SDP_AddProtocolList(uint32_t handle, uint16_t num_elem, ******************************************************************************/ bool SDP_AddAdditionProtoLists(uint32_t handle, uint16_t num_elem, tSDP_PROTO_LIST_ELEM* p_proto_list) { -#if (SDP_SERVER_ENABLED == TRUE) uint16_t xx; uint8_t* p; uint8_t* p_len; @@ -647,10 +625,6 @@ bool SDP_AddAdditionProtoLists(uint32_t handle, uint16_t num_elem, DATA_ELE_SEQ_DESC_TYPE, (uint32_t)(p - p_buff), p_buff); osi_free(p_buff); return result; - -#else /* SDP_SERVER_ENABLED == FALSE */ - return (false); -#endif } /******************************************************************************* @@ -667,7 +641,6 @@ bool SDP_AddAdditionProtoLists(uint32_t handle, uint16_t num_elem, ******************************************************************************/ bool SDP_AddProfileDescriptorList(uint32_t handle, uint16_t profile_uuid, uint16_t version) { -#if (SDP_SERVER_ENABLED == TRUE) uint8_t* p; bool result; uint8_t* p_buff = (uint8_t*)osi_malloc(sizeof(uint8_t) * SDP_MAX_ATTR_LEN); @@ -692,10 +665,6 @@ bool SDP_AddProfileDescriptorList(uint32_t handle, uint16_t profile_uuid, DATA_ELE_SEQ_DESC_TYPE, (uint32_t)(p - p_buff), p_buff); osi_free(p_buff); return result; - -#else /* SDP_SERVER_ENABLED == FALSE */ - return (false); -#endif } /******************************************************************************* @@ -712,7 +681,6 @@ bool SDP_AddProfileDescriptorList(uint32_t handle, uint16_t profile_uuid, ******************************************************************************/ bool SDP_AddLanguageBaseAttrIDList(uint32_t handle, uint16_t lang, uint16_t char_enc, uint16_t base_id) { -#if (SDP_SERVER_ENABLED == TRUE) uint8_t* p; bool result; uint8_t* p_buff = (uint8_t*)osi_malloc(sizeof(uint8_t) * SDP_MAX_ATTR_LEN); @@ -735,9 +703,6 @@ bool SDP_AddLanguageBaseAttrIDList(uint32_t handle, uint16_t lang, DATA_ELE_SEQ_DESC_TYPE, (uint32_t)(p - p_buff), p_buff); osi_free(p_buff); return result; -#else /* SDP_SERVER_ENABLED == FALSE */ - return (false); -#endif } /******************************************************************************* @@ -754,7 +719,6 @@ bool SDP_AddLanguageBaseAttrIDList(uint32_t handle, uint16_t lang, ******************************************************************************/ bool SDP_AddServiceClassIdList(uint32_t handle, uint16_t num_services, uint16_t* p_service_uuids) { -#if (SDP_SERVER_ENABLED == TRUE) uint16_t xx; uint8_t* p; bool result; @@ -773,9 +737,6 @@ bool SDP_AddServiceClassIdList(uint32_t handle, uint16_t num_services, DATA_ELE_SEQ_DESC_TYPE, (uint32_t)(p - p_buff), p_buff); osi_free(p_buff); return result; -#else /* SDP_SERVER_ENABLED == FALSE */ - return (false); -#endif } /******************************************************************************* @@ -790,7 +751,6 @@ bool SDP_AddServiceClassIdList(uint32_t handle, uint16_t num_services, * ******************************************************************************/ bool SDP_DeleteAttribute(uint32_t handle, uint16_t attr_id) { -#if (SDP_SERVER_ENABLED == TRUE) tSDP_RECORD* p_rec = &sdp_cb.server_db.record[0]; uint8_t* pad_ptr; uint32_t len; /* Number of bytes in the entry */ @@ -835,7 +795,6 @@ bool SDP_DeleteAttribute(uint32_t handle, uint16_t attr_id) { } } } -#endif /* If here, not found */ return (false); } diff --git a/stack/sdp/sdp_main.cc b/stack/sdp/sdp_main.cc index 34505e988..84c6fc8b0 100644 --- a/stack/sdp/sdp_main.cc +++ b/stack/sdp/sdp_main.cc @@ -125,7 +125,6 @@ void sdp_free(void) { ******************************************************************************/ static void sdp_connect_ind(const RawAddress& bd_addr, uint16_t l2cap_cid, UNUSED_ATTR uint16_t psm, uint8_t l2cap_id) { -#if (SDP_SERVER_ENABLED == TRUE) tCONN_CB* p_ccb; /* Allocate a new CCB. Return if none available. */ @@ -163,10 +162,6 @@ static void sdp_connect_ind(const RawAddress& bd_addr, uint16_t l2cap_cid, SDP_TRACE_EVENT("SDP - Rcvd L2CAP conn ind, sent config req, CID 0x%x", p_ccb->connection_id); -#else /* No server */ - /* Reject the connection */ - L2CA_ConnectRsp(bd_addr, l2cap_id, l2cap_cid, L2CAP_CONN_NO_PSM, 0); -#endif } /******************************************************************************* diff --git a/stack/sdp/sdp_server.cc b/stack/sdp/sdp_server.cc index 9e3dd6197..d159379b8 100644 --- a/stack/sdp/sdp_server.cc +++ b/stack/sdp/sdp_server.cc @@ -33,8 +33,6 @@ #include "sdp_api.h" #include "sdpint.h" -#if (SDP_SERVER_ENABLED == TRUE) - /* Maximum number of bytes to reserve out of SDP MTU for response data */ #define SDP_MAX_SERVICE_RSPHDR_LEN 12 #define SDP_MAX_SERVATTR_RSPHDR_LEN 10 @@ -825,4 +823,3 @@ static void process_service_search_attr_req(tCONN_CB* p_ccb, uint16_t trans_num, /* Send the buffer through L2CAP */ L2CA_DataWrite(p_ccb->connection_id, p_buf); } -#endif /* SDP_SERVER_ENABLED == TRUE */ diff --git a/stack/sdp/sdpint.h b/stack/sdp/sdpint.h index af9ccb824..da6e0aa4f 100644 --- a/stack/sdp/sdpint.h +++ b/stack/sdp/sdpint.h @@ -106,7 +106,6 @@ typedef struct { tSDP_RECORD record[SDP_MAX_RECORDS]; } tSDP_DB; -#if (SDP_SERVER_ENABLED == TRUE) /* Continuation information for the SDP server response */ typedef struct { uint16_t next_attr_index; /* attr index for next continuation response */ @@ -119,7 +118,6 @@ typedef struct { uint16_t attr_offset; /* offset within the attr to keep trak of partial attributes in the responses */ } tSDP_CONT_INFO; -#endif /* SDP_SERVER_ENABLED == TRUE */ /* Define the SDP Connection Control Block */ typedef struct { @@ -165,11 +163,9 @@ typedef struct { uint8_t disc_state; uint8_t is_attr_search; -#if (SDP_SERVER_ENABLED == TRUE) uint16_t cont_offset; /* Continuation state data in the server response */ tSDP_CONT_INFO cont_info; /* structure to hold continuation information for the server response */ -#endif /* SDP_SERVER_ENABLED == TRUE */ } tCONN_CB; @@ -177,9 +173,7 @@ typedef struct { typedef struct { tL2CAP_CFG_INFO l2cap_my_cfg; /* My L2CAP config */ tCONN_CB ccb[SDP_MAX_CONNECTIONS]; -#if (SDP_SERVER_ENABLED == TRUE) tSDP_DB server_db; -#endif tL2CAP_APPL_INFO reg_info; /* L2CAP Registration info */ uint16_t max_attr_list_size; /* Max attribute list size to use */ uint16_t max_recs_per_search; /* Max records we want per seaarch */ @@ -247,11 +241,7 @@ extern tSDP_ATTRIBUTE* sdp_db_find_attr_in_rec(tSDP_RECORD* p_rec, /* Functions provided by sdp_server.cc */ -#if (SDP_SERVER_ENABLED == TRUE) extern void sdp_server_handle_client_req(tCONN_CB* p_ccb, BT_HDR* p_msg); -#else -#define sdp_server_handle_client_req(p_ccb, p_msg) -#endif /* Functions provided by sdp_discovery.cc */