1 /* sdp_internal.h - Service Discovery Protocol handling */ 2 3 /* 4 * Copyright (c) 2015-2016 Intel Corporation 5 * 6 * SPDX-License-Identifier: Apache-2.0 7 */ 8 9 /* 10 * The PDU identifiers of SDP packets between client and server 11 */ 12 #define BT_SDP_ERROR_RSP 0x01 13 #define BT_SDP_SVC_SEARCH_REQ 0x02 14 #define BT_SDP_SVC_SEARCH_RSP 0x03 15 #define BT_SDP_SVC_ATTR_REQ 0x04 16 #define BT_SDP_SVC_ATTR_RSP 0x05 17 #define BT_SDP_SVC_SEARCH_ATTR_REQ 0x06 18 #define BT_SDP_SVC_SEARCH_ATTR_RSP 0x07 19 20 /* 21 * Some additions to support service registration. 22 * These are outside the scope of the Bluetooth specification 23 */ 24 #define BT_SDP_SVC_REGISTER_REQ 0x75 25 #define BT_SDP_SVC_REGISTER_RSP 0x76 26 #define BT_SDP_SVC_UPDATE_REQ 0x77 27 #define BT_SDP_SVC_UPDATE_RSP 0x78 28 #define BT_SDP_SVC_REMOVE_REQ 0x79 29 #define BT_SDP_SVC_REMOVE_RSP 0x80 30 31 /* 32 * SDP Error codes 33 */ 34 #define BT_SDP_INVALID_VERSION 0x0001 35 #define BT_SDP_INVALID_RECORD_HANDLE 0x0002 36 #define BT_SDP_INVALID_SYNTAX 0x0003 37 #define BT_SDP_INVALID_PDU_SIZE 0x0004 38 #define BT_SDP_INVALID_CSTATE 0x0005 39 40 #define BT_SDP_MAX_SERVICES 10 41 42 struct bt_sdp_data_elem_seq { 43 uint8_t type; /* Type: Will be data element sequence */ 44 uint16_t size; /* We only support 2 byte sizes for now */ 45 } __packed; 46 47 struct bt_sdp_hdr { 48 uint8_t op_code; 49 uint16_t tid; 50 uint16_t param_len; 51 } __packed; 52 53 struct bt_sdp_svc_rsp { 54 uint16_t total_recs; 55 uint16_t current_recs; 56 } __packed; 57 58 struct bt_sdp_att_rsp { 59 uint16_t att_list_len; 60 } __packed; 61 62 /* Allowed attributes length in SSA Request PDU to be taken from server */ 63 #define BT_SDP_MAX_ATTR_LEN 0xffff 64 65 /* Max allowed length of PDU Continuation State */ 66 #define BT_SDP_MAX_PDU_CSTATE_LEN 16 67 68 /* Type mapping SDP PDU Continuation State */ 69 struct bt_sdp_pdu_cstate { 70 uint8_t length; 71 uint8_t data[BT_SDP_MAX_PDU_CSTATE_LEN]; 72 } __packed; 73 74 void bt_sdp_init(void); 75