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

Commit 11911dbd authored by Chris Manton's avatar Chris Manton
Browse files

stack::sdp Use conventional structure definition

Remove the typedefs

Bug: 352112759
Test: m .
Flag: EXEMPT, Mechanical refactor

Change-Id: Ief5b942fed9a0e9ee6b46927ae955eee6b2eb510
parent fb344c67
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@
#include <cstdint>

#include "internal_include/bt_target.h"
#include "os/log.h"
#include "osi/include/allocator.h"
#include "stack/include/bt_types.h"
#include "stack/include/bt_uuid16.h"
+18 −16
Original line number Diff line number Diff line
@@ -32,35 +32,37 @@
#define SDP_MAX_LIST_ELEMS 3

/* Define a structure to hold the discovered service information. */
typedef struct {
struct tSDP_DISC_ATVAL {
  union {
    uint8_t u8;                         /* 8-bit integer            */
    uint16_t u16;                       /* 16-bit integer           */
    uint32_t u32;                       /* 32-bit integer           */
    struct t_sdp_disc_attr* p_sub_attr; /* Addr of first sub-attr (list)*/
    struct tSDP_DISC_ATTR* p_sub_attr;  /* Addr of first sub-attr (list)*/
    uint8_t array[];                    /* Variable length field    */
                                        /* flexible array member    */
                                        /* requiring backing store  */
                                        /* from SDP DB    */
  } v;
};

} tSDP_DISC_ATVAL;

typedef struct t_sdp_disc_attr {
  struct t_sdp_disc_attr* p_next_attr; /* Addr of next linked attr     */
struct tSDP_DISC_ATTR {
  struct tSDP_DISC_ATTR* p_next_attr;  /* Addr of next linked attr     */
  uint16_t attr_id;                    /* Attribute ID                 */
  uint16_t attr_len_type;              /* Length and type fields       */
  tSDP_DISC_ATVAL attr_value;          /* Variable length entry data   */
} tSDP_DISC_ATTR;
};

typedef struct t_sdp_disc_rec {
struct tSDP_DISC_REC {
  tSDP_DISC_ATTR* p_first_attr;      /* First attribute of record    */
  struct t_sdp_disc_rec* p_next_rec; /* Addr of next linked record   */
  struct tSDP_DISC_REC* p_next_rec;  /* Addr of next linked record   */
  uint32_t time_read;                /* The time the record was read */
  RawAddress remote_bd_addr;         /* Remote BD address            */
} tSDP_DISC_REC;
};

// Typedef alias used by profiles
typedef tSDP_DISC_REC t_sdp_disc_rec;

typedef struct {
struct tSDP_DISCOVERY_DB {
  uint32_t mem_size;                                  /* Memory size of the DB        */
  uint32_t mem_free;                                  /* Memory still available       */
  tSDP_DISC_REC* p_first_rec;                         /* Addr of first record in DB   */
@@ -72,16 +74,16 @@ typedef struct {
  uint8_t* raw_data; /* Received record from server. allocated/released by client  */
  uint32_t raw_size; /* size of raw_data */
  uint32_t raw_used; /* length of raw_data used */
} tSDP_DISCOVERY_DB;
};

/* This structure is used to add protocol lists and find protocol elements */
typedef struct {
struct tSDP_PROTOCOL_ELEM {
  uint16_t protocol_uuid;
  uint16_t num_params;
  uint16_t params[SDP_MAX_PROTOCOL_PARAMS];
} tSDP_PROTOCOL_ELEM;
};

typedef struct {
struct tSDP_PROTO_LIST_ELEM {
  uint16_t num_elems;
  tSDP_PROTOCOL_ELEM list_elem[SDP_MAX_LIST_ELEMS];
} tSDP_PROTO_LIST_ELEM;
};
+2 −2
Original line number Diff line number Diff line
@@ -68,13 +68,13 @@
using namespace bluetooth;

/* Used to set PBAP local SDP device record for PBAP 1.2 upgrade */
typedef struct {
struct tSDP_PSE_LOCAL_RECORD {
  int32_t rfcomm_channel_number;
  int32_t l2cap_psm;
  int32_t profile_version;
  uint32_t supported_features;
  uint32_t supported_repositories;
} tSDP_PSE_LOCAL_RECORD;
};

static tSDP_PSE_LOCAL_RECORD sdpPseLocalRecord;

+18 −18
Original line number Diff line number Diff line
@@ -69,53 +69,53 @@
#endif

/* Internal UUID sequence representation */
typedef struct {
struct tUID_ENT {
  uint16_t len;
  uint8_t value[bluetooth::Uuid::kNumBytes128];
} tUID_ENT;
};

typedef struct {
struct tSDP_UUID_SEQ {
  uint16_t num_uids;
  tUID_ENT uuid_entry[MAX_UUIDS_PER_SEQ];
} tSDP_UUID_SEQ;
};

/* Internal attribute sequence definitions */
typedef struct {
struct tATT_ENT {
  uint16_t start;
  uint16_t end;
} tATT_ENT;
};

typedef struct {
struct tSDP_ATTR_SEQ {
  uint16_t num_attr;
  tATT_ENT attr_entry[MAX_ATTR_PER_SEQ];
} tSDP_ATTR_SEQ;
};

/* Define the attribute element of the SDP database record */
typedef struct {
struct tSDP_ATTRIBUTE {
  uint32_t len;       /* Number of bytes in the entry */
  uint8_t* value_ptr; /* Points to attr_pad */
  uint16_t id;
  uint8_t type;
} tSDP_ATTRIBUTE;
};

/* An SDP record consists of a handle, and 1 or more attributes */
typedef struct {
struct tSDP_RECORD {
  uint32_t record_handle;
  uint32_t free_pad_ptr;
  uint16_t num_attributes;
  tSDP_ATTRIBUTE attribute[SDP_MAX_REC_ATTR];
  uint8_t attr_pad[SDP_MAX_PAD_LEN];
} tSDP_RECORD;
};

/* Define the SDP database */
typedef struct {
struct tSDP_DB {
  uint32_t di_primary_handle; /* Device ID Primary record or NULL if nonexistent */
  uint16_t num_records;
  tSDP_RECORD record[SDP_MAX_RECORDS];
} tSDP_DB;
};

/* Continuation information for the SDP server response */
typedef struct {
struct tSDP_CONT_INFO {
  uint16_t next_attr_index;        /* attr index for next continuation response */
  uint16_t next_attr_start_id;     /* attr id to start with for the attr index in
                                      next cont. response */
@@ -125,7 +125,7 @@ typedef struct {
                                      previously */
  uint16_t attr_offset;            /* offset within the attr to keep trak of partial
                                      attributes in the responses */
} tSDP_CONT_INFO;
};

enum class tSDP_STATE : uint8_t {
  IDLE = 0,
@@ -224,14 +224,14 @@ inline std::string sdp_disc_wait_text(const tSDP_DISC_WAIT& state) {
}

/*  The main SDP control block */
typedef struct {
struct tSDP_CB {
  tL2CAP_CFG_INFO l2cap_my_cfg; /* My L2CAP config     */
  tCONN_CB ccb[SDP_MAX_CONNECTIONS];
  tSDP_DB server_db;
  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  */
} tSDP_CB;
};

/* Global SDP data */
extern tSDP_CB sdp_cb;