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

Commit fa464118 authored by Hansong Zhang's avatar Hansong Zhang Committed by android-build-merger
Browse files

Remove dead code in SDP

am: 33485d02

Change-Id: I61bbfd340e56acb30bb8d297cca78157ab53bad0
parents ed4826a8 33485d02
Loading
Loading
Loading
Loading
+0 −47
Original line number Diff line number Diff line
@@ -83,9 +83,6 @@ typedef union {
  tSDP_DR_DATA data;
} tSDP_DATA;

/* Define a callback function for when discovery result is received. */
typedef void(tSDP_DISC_RES_CB)(uint16_t event, tSDP_DATA* p_data);

/* Define a structure to hold the discovered service information. */
typedef struct {
  union {
@@ -238,21 +235,6 @@ bool SDP_ServiceSearchAttributeRequest2(const RawAddress& p_bd_addr,

/* API of utilities to find data in the local discovery database */

/*******************************************************************************
 *
 * Function         SDP_FindAttributeInDb
 *
 * Description      This function queries an SDP database for a specific
 *                  attribute. If the p_start_rec pointer is NULL, it looks from
 *                  the beginning of the database, else it continues from the
 *                  next record after p_start_rec.
 *
 * Returns          Pointer to matching record, or NULL
 *
 ******************************************************************************/
tSDP_DISC_REC* SDP_FindAttributeInDb(tSDP_DISCOVERY_DB* p_db, uint16_t attr_id,
                                     tSDP_DISC_REC* p_start_rec);

/*******************************************************************************
 *
 * Function         SDP_FindAttributeInRec
@@ -346,20 +328,6 @@ tSDP_DISC_REC* SDP_FindServiceInDb_128bit(tSDP_DISCOVERY_DB* p_db,
bool SDP_FindProtocolListElemInRec(tSDP_DISC_REC* p_rec, uint16_t layer_uuid,
                                   tSDP_PROTOCOL_ELEM* p_elem);

/*******************************************************************************
 *
 * Function         SDP_FindAddProtoListsElemInRec
 *
 * Description      This function looks at a specific discovery record for a
 *                  protocol list element.
 *
 * Returns          true if found, false if not
 *                  If found, the passed protocol list element is filled in.
 *
 ******************************************************************************/
bool SDP_FindAddProtoListsElemInRec(tSDP_DISC_REC* p_rec, uint16_t layer_uuid,
                                    tSDP_PROTOCOL_ELEM* p_elem);

/*******************************************************************************
 *
 * Function         SDP_FindProfileVersionInRec
@@ -408,21 +376,6 @@ uint32_t SDP_CreateRecord(void);
 ******************************************************************************/
bool SDP_DeleteRecord(uint32_t handle);

/*******************************************************************************
 *
 * Function         SDP_ReadRecord
 *
 * Description      This function is called to get the raw data of the record
 *                  with the given handle from the database.
 *
 * Returns          -1, if the record is not found.
 *                  Otherwise, the offset (0 or 1) to start of data in p_data.
 *
 *                  The size of data copied into p_data is in *p_data_len.
 *
 ******************************************************************************/
int32_t SDP_ReadRecord(uint32_t handle, uint8_t* p_data, int32_t* p_data_len);

/*******************************************************************************
 *
 * Function         SDP_AddAttribute
+0 −85
Original line number Diff line number Diff line
@@ -22,18 +22,10 @@
 *
 ******************************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "bt_common.h"
#include "bt_target.h"
#include "bt_utils.h"
#include "hcidefs.h"
#include "hcimsgs.h"
#include "l2cdefs.h"

#include "btu.h"
#include "sdp_api.h"
#include "sdpint.h"

@@ -215,45 +207,6 @@ bool SDP_ServiceSearchAttributeRequest2(const RawAddress& p_bd_addr,
  return (true);
}

/*******************************************************************************
 *
 * Function         SDP_FindAttributeInDb
 *
 * Description      This function queries an SDP database for a specific
 *                  attribute. If the p_start_rec pointer is NULL, it looks from
 *                  the beginning of the database, else it continues from the
 *                  next record after p_start_rec.
 *
 * Returns          Pointer to matching record, or NULL
 *
 ******************************************************************************/
tSDP_DISC_REC* SDP_FindAttributeInDb(tSDP_DISCOVERY_DB* p_db, uint16_t attr_id,
                                     tSDP_DISC_REC* p_start_rec) {
  tSDP_DISC_REC* p_rec;
  tSDP_DISC_ATTR* p_attr;

  /* Must have a valid database */
  if (p_db == NULL) return (NULL);

  if (!p_start_rec)
    p_rec = p_db->p_first_rec;
  else
    p_rec = p_start_rec->p_next_rec;

  while (p_rec) {
    p_attr = p_rec->p_first_attr;
    while (p_attr) {
      if (p_attr->attr_id == attr_id) return (p_rec);

      p_attr = p_attr->p_next_attr;
    }

    p_rec = p_rec->p_next_rec;
  }
  /* If here, no matching attribute found */
  return (NULL);
}

/*******************************************************************************
 *
 * Function         SDP_FindAttributeInRec
@@ -693,44 +646,6 @@ bool SDP_FindProtocolListElemInRec(tSDP_DISC_REC* p_rec, uint16_t layer_uuid,
  return (false);
}

/*******************************************************************************
 *
 * Function         SDP_FindAddProtoListsElemInRec
 *
 * Description      This function looks at a specific discovery record for a
 *                  protocol list element.
 *
 * Returns          true if found, false if not
 *                  If found, the passed protocol list element is filled in.
 *
 ******************************************************************************/
bool SDP_FindAddProtoListsElemInRec(tSDP_DISC_REC* p_rec, uint16_t layer_uuid,
                                    tSDP_PROTOCOL_ELEM* p_elem) {
  tSDP_DISC_ATTR *p_attr, *p_sattr;
  bool ret = false;

  p_attr = p_rec->p_first_attr;
  while (p_attr) {
    /* Find the additional protocol descriptor list attribute */
    if ((p_attr->attr_id == ATTR_ID_ADDITION_PROTO_DESC_LISTS) &&
        (SDP_DISC_ATTR_TYPE(p_attr->attr_len_type) == DATA_ELE_SEQ_DESC_TYPE)) {
      for (p_sattr = p_attr->attr_value.v.p_sub_attr; p_sattr;
           p_sattr = p_sattr->p_next_attr) {
        /* Safety check - each entry should itself be a sequence */
        if (SDP_DISC_ATTR_TYPE(p_sattr->attr_len_type) ==
            DATA_ELE_SEQ_DESC_TYPE) {
          ret = sdp_fill_proto_elem(p_sattr, layer_uuid, p_elem);
          if (ret) break;
        }
      }
      return ret;
    }
    p_attr = p_attr->p_next_attr;
  }
  /* If here, no match found */
  return (false);
}

/*******************************************************************************
 *
 * Function         SDP_FindProfileVersionInRec
+0 −69
Original line number Diff line number Diff line
@@ -23,17 +23,12 @@
 ******************************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "bt_target.h"

#include "bt_common.h"

#include "hcidefs.h"
#include "hcimsgs.h"
#include "l2cdefs.h"

#include "sdp_api.h"
#include "sdpint.h"

@@ -844,67 +839,3 @@ bool SDP_DeleteAttribute(uint32_t handle, uint16_t attr_id) {
  /* If here, not found */
  return (false);
}

/*******************************************************************************
 *
 * Function         SDP_ReadRecord
 *
 * Description      This function is called to get the raw data of the record
 *                  with the given handle from the database.
 *
 * Returns          -1, if the record is not found.
 *                  Otherwise, the offset (0 or 1) to start of data in p_data.
 *
 *                  The size of data copied into p_data is in *p_data_len.
 *
 ******************************************************************************/
#if (SDP_RAW_DATA_INCLUDED == TRUE)
int32_t SDP_ReadRecord(uint32_t handle, uint8_t* p_data, int32_t* p_data_len) {
  int32_t len = 0;     /* Number of bytes in the entry */
  int32_t offset = -1; /* default to not found */
#if (SDP_SERVER_ENABLED == TRUE)
  tSDP_RECORD* p_rec;
  uint16_t start = 0;
  uint16_t end = 0xffff;
  tSDP_ATTRIBUTE* p_attr;
  uint16_t rem_len;
  uint8_t* p_rsp;

  /* Find the record in the database */
  p_rec = sdp_db_find_record(handle);
  if (p_rec && p_data && p_data_len) {
    p_rsp = &p_data[3];
    while ((p_attr = sdp_db_find_attr_in_rec(p_rec, start, end)) != NULL) {
      /* Check if attribute fits. Assume 3-byte value type/length */
      rem_len = *p_data_len - (uint16_t)(p_rsp - p_data);

      if (p_attr->len > (uint32_t)(rem_len - 6)) break;

      p_rsp = sdpu_build_attrib_entry(p_rsp, p_attr);

      /* next attr id */
      start = p_attr->id + 1;
    }
    len = (int32_t)(p_rsp - p_data);

    /* Put in the sequence header (2 or 3 bytes) */
    if (len > 255) {
      offset = 0;
      p_data[0] = (uint8_t)((DATA_ELE_SEQ_DESC_TYPE << 3) | SIZE_IN_NEXT_WORD);
      p_data[1] = (uint8_t)((len - 3) >> 8);
      p_data[2] = (uint8_t)(len - 3);
    } else {
      offset = 1;

      p_data[1] = (uint8_t)((DATA_ELE_SEQ_DESC_TYPE << 3) | SIZE_IN_NEXT_BYTE);
      p_data[2] = (uint8_t)(len - 3);

      len--;
    }
    *p_data_len = len;
  }
#endif
  /* If here, not found */
  return (offset);
}
#endif
+0 −25
Original line number Diff line number Diff line
@@ -22,22 +22,17 @@
 *
 ******************************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "bt_common.h"
#include "bt_target.h"
#include "bt_utils.h"
#include "hcidefs.h"
#include "hcimsgs.h"

#include "l2c_api.h"
#include "l2cdefs.h"
#include "osi/include/osi.h"

#include "btm_api.h"
#include "btu.h"

#include "sdp_api.h"
#include "sdpint.h"
@@ -134,26 +129,6 @@ void sdp_free(void) {
  }
}

#if (SDP_DEBUG == TRUE)
/*******************************************************************************
 *
 * Function         sdp_set_max_attr_list_size
 *
 * Description      This function sets the max attribute list size to use
 *
 * Returns          void
 *
 ******************************************************************************/
uint16_t sdp_set_max_attr_list_size(uint16_t max_size) {
  if (max_size > (sdp_cb.l2cap_my_cfg.mtu - 16))
    max_size = sdp_cb.l2cap_my_cfg.mtu - 16;

  sdp_cb.max_attr_list_size = max_size;

  return sdp_cb.max_attr_list_size;
}
#endif

/*******************************************************************************
 *
 * Function         sdp_connect_ind
+0 −8
Original line number Diff line number Diff line
@@ -24,18 +24,10 @@
 ******************************************************************************/

#include <log/log.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "bt_common.h"
#include "bt_types.h"
#include "bt_utils.h"
#include "btu.h"

#include "hcidefs.h"
#include "hcimsgs.h"
#include "l2cdefs.h"

#include "osi/include/osi.h"
#include "sdp_api.h"
Loading