mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-29 13:20:39 +00:00
sdp_util: add sdp_attribute_list_valid
This commit is contained in:
parent
c95caec03e
commit
3bb8bc6f34
@ -391,6 +391,36 @@ bool sdp_attribute_list_contains_id(uint8_t *attributeIDList, uint16_t attribute
|
||||
return attributeID_search.result;
|
||||
}
|
||||
|
||||
static int sdp_traversal_attribute_list_valie(uint8_t * element, de_type_t type, de_size_t size, void *my_context) {
|
||||
bool ok = true;
|
||||
if (type == DE_UINT) {
|
||||
ok = false;
|
||||
}
|
||||
if ((size != DE_SIZE_16) && (size != DE_SIZE_32)) {
|
||||
ok = false;
|
||||
}
|
||||
if (size == DE_SIZE_32){
|
||||
uint16_t lower = big_endian_read_16(element, 1);
|
||||
uint16_t higher = big_endian_read_16(element, 3);
|
||||
if (lower > higher){
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
if (ok){
|
||||
return 0;
|
||||
} else {
|
||||
*(bool *)my_context = false;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool sdp_attribute_list_valid(uint8_t *attributeIDList){
|
||||
bool attribute_list_valid = true;
|
||||
de_traverse_sequence(attributeIDList, sdp_traversal_attribute_list_valie, &attribute_list_valid);
|
||||
return attribute_list_valid;
|
||||
}
|
||||
|
||||
|
||||
// MARK: Append Attributes for AttributeIDList
|
||||
// pre: buffer contains DES with 2 byte length field
|
||||
struct sdp_context_append_attributes {
|
||||
|
@ -145,6 +145,7 @@ bool sdp_record_matches_service_search_pattern(uint8_t *record, uint8_t *se
|
||||
uint16_t sdp_get_filtered_size(uint8_t *record, uint8_t *attributeIDList);
|
||||
bool sdp_filter_attributes_in_attributeIDList(uint8_t *record, uint8_t *attributeIDList, uint16_t startOffset, uint16_t maxBytes, uint16_t *usedBytes, uint8_t *buffer);
|
||||
bool sdp_attribute_list_contains_id(uint8_t *attributeIDList, uint16_t attributeID);
|
||||
bool sdp_attribute_list_valid(uint8_t *attributeIDList);
|
||||
|
||||
/*
|
||||
* @brief Returns service search pattern for given UUID-16
|
||||
|
0
test/pts/sdp.md
Normal file
0
test/pts/sdp.md
Normal file
Loading…
x
Reference in New Issue
Block a user