sdp_util: add getter for DE_STRING type

This commit is contained in:
Matthias Ringwald 2017-12-04 14:56:04 +01:00
parent 12ccb71b49
commit d4efbfbf55
2 changed files with 8 additions and 1 deletions

View File

@ -168,6 +168,11 @@ uint32_t de_get_uuid32(const uint8_t * element){
return big_endian_read_32(uuid128, 0);
}
const uint8_t * de_get_string(const uint8_t * element){
if (de_get_element_type(element) != DE_STRING) return NULL;
return &element[de_get_header_size(element)];
}
// functions to create record
static void de_store_descriptor(uint8_t * header, de_type_t type, de_size_t size){
header[0] = (type << 3) | size;

View File

@ -78,6 +78,9 @@ void de_dump_data_element(const uint8_t * record);
int de_get_len(const uint8_t * header);
// @note returned "string" is not NULL terminated
const uint8_t * de_get_string(const uint8_t * element);
de_size_t de_get_size_type(const uint8_t * header);
de_type_t de_get_element_type(const uint8_t * header);
uint32_t de_get_header_size(const uint8_t * header);
@ -85,7 +88,6 @@ int de_element_get_uint16(const uint8_t * element, uint16_t * value);
uint32_t de_get_data_size(const uint8_t * header);
uint32_t de_get_uuid32(const uint8_t * element);
int de_get_normalized_uuid(uint8_t *uuid128, const uint8_t *element);
void de_create_sequence(uint8_t * header);
void de_store_descriptor_with_len(uint8_t * header, de_type_t type, de_size_t size, uint32_t len);
uint8_t * de_push_sequence(uint8_t *header);