Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 617d91d1 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

SDP_SERVER_ENABLED is always true

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I22fa27b8eeab933b4529e6dec423327721428d8f
parent 6675b652
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -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
+0 −4
Original line number Diff line number Diff line
@@ -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 */
}

/*******************************************************************************
+0 −41
Original line number Diff line number Diff line
@@ -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);
}
+0 −5
Original line number Diff line number Diff line
@@ -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
}

/*******************************************************************************
+0 −3
Original line number Diff line number Diff line
@@ -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 */
Loading