Lines Matching refs:uuid
198 static char *string_lookup_uuid(struct tupla *pt0, const uuid_t* uuid)
202 memcpy(&tmp_uuid, uuid, sizeof(tmp_uuid));
217 * Prints into a string the Protocol UUID
220 static int uuid2str(struct tupla *message, const uuid_t *uuid, char *str, size_t n)
224 if (!uuid) {
229 switch (uuid->type) {
231 str2 = string_lookup(message, uuid->value.uuid16);
235 str2 = string_lookup(message, uuid->value.uuid32);
239 str2 = string_lookup_uuid(message, uuid);
243 snprintf(str, n, "Type of UUID (%x) unknown.", uuid->type);
250 int sdp_proto_uuid2strn(const uuid_t *uuid, char *str, size_t n)
252 return uuid2str(Protocol, uuid, str, n);
255 int sdp_svclass_uuid2strn(const uuid_t *uuid, char *str, size_t n)
257 return uuid2str(ServiceClass, uuid, str, n);
260 int sdp_profile_uuid2strn(const uuid_t *uuid, char *str, size_t n)
262 return uuid2str(Profile, uuid, str, n);
266 * convert the UUID to string, copying a maximum of n characters.
268 int sdp_uuid2strn(const uuid_t *uuid, char *str, size_t n)
270 if (!uuid) {
274 switch (uuid->type) {
276 snprintf(str, n, "%.4x", uuid->value.uuid16);
279 snprintf(str, n, "%.8x", uuid->value.uuid32);
289 memcpy(&data0, &uuid->value.uuid128.data[0], 4);
290 memcpy(&data1, &uuid->value.uuid128.data[4], 2);
291 memcpy(&data2, &uuid->value.uuid128.data[6], 2);
292 memcpy(&data3, &uuid->value.uuid128.data[8], 2);
293 memcpy(&data4, &uuid->value.uuid128.data[10], 4);
294 memcpy(&data5, &uuid->value.uuid128.data[14], 2);
303 snprintf(str, n, "Type of UUID (%x) unknown.", uuid->type);
304 return -1; /* Enum type of UUID not set */
311 * Function prints the UUID in hex as per defined syntax -
319 void sdp_uuid_print(const uuid_t *uuid)
321 if (uuid == NULL) {
322 SDPERR("Null passed to print UUID\n");
325 if (uuid->type == SDP_UUID16) {
326 SDPDBG(" uint16_t : 0x%.4x\n", uuid->value.uuid16);
327 } else if (uuid->type == SDP_UUID32) {
328 SDPDBG(" uint32_t : 0x%.8x\n", uuid->value.uuid32);
329 } else if (uuid->type == SDP_UUID128) {
337 memcpy(&data0, &uuid->value.uuid128.data[0], 4);
338 memcpy(&data1, &uuid->value.uuid128.data[4], 2);
339 memcpy(&data2, &uuid->value.uuid128.data[6], 2);
340 memcpy(&data3, &uuid->value.uuid128.data[8], 2);
341 memcpy(&data4, &uuid->value.uuid128.data[10], 4);
342 memcpy(&data5, &uuid->value.uuid128.data[14], 2);
351 SDPERR("Enum type of UUID not set\n");
413 sdp_uuid16_create(&d->val.uuid, bt_get_unaligned((uint16_t *) value));
417 sdp_uuid32_create(&d->val.uuid, bt_get_unaligned((uint32_t *) value));
421 sdp_uuid128_create(&d->val.uuid, value);
568 static void extract_svclass_uuid(sdp_data_t *data, uuid_t *uuid)
582 *uuid = d->val.uuid;
887 u16 = htons(d->val.uuid.value.uuid16);
891 u32 = htonl(d->val.uuid.value.uuid32);
895 src = (unsigned char *) &d->val.uuid.value.uuid128;
998 int sdp_uuid_extract(const uint8_t *p, int bufsize, uuid_t *uuid, int *scanned)
1010 SDPERR("Unknown data type : %d expecting a svc UUID\n", type);
1018 SDPERR("Not enough room for 16-bit UUID");
1021 sdp_uuid16_create(uuid, ntohs(bt_get_unaligned((uint16_t *) p)));
1025 SDPERR("Not enough room for 32-bit UUID");
1028 sdp_uuid32_create(uuid, ntohl(bt_get_unaligned((uint32_t *) p)));
1032 SDPERR("Not enough room for 128-bit UUID");
1035 sdp_uuid128_create(uuid, p);
1130 SDPDBG("Extracting UUID");
1132 if (sdp_uuid_extract(p, bufsize, &d->val.uuid, len) < 0) {
1138 sdp_pattern_add_uuid(rec, &d->val.uuid);
1471 uuid_t *uuid = value;
1474 sdp_pattern_add_uuid(rec, uuid);
1516 val = &data->val.uuid.value.uuid16;
1519 val = &data->val.uuid.value.uuid32;
1522 val = &data->val.uuid.value.uuid128;
1648 SDPDBG("UUID\n");
1649 sdp_uuid_print(&d->val.uuid);
1827 if (SDP_IS_UUID(seq->dtd) && sdp_uuid_to_proto(&seq->val.uuid) == proto) {
1865 sdp_uuid_to_proto(&seq->val.uuid) == proto)
1938 *u = d->val.uuid;
1972 uuid_t *uuid = p->data;
1973 if (uuid)
1974 switch (uuid->type) {
1977 values[i] = &uuid->value.uuid16;
1981 values[i] = &uuid->value.uuid32;
1985 values[i] = &uuid->value.uuid128;
2063 uuid_t *uuid = NULL;
2067 uuid = &seq->val.uuid;
2072 uuid = &puuid->val.uuid;
2077 if (uuid != NULL) {
2084 profDesc->uuid = *uuid;
2087 sdp_uuid_print(&profDesc->uuid);
2156 int sdp_get_service_id(const sdp_record_t *rec, uuid_t *uuid)
2158 get_basic_attr(SDP_ATTR_SERVICE_ID, uuid, uuid);
2161 int sdp_get_group_id(const sdp_record_t *rec, uuid_t *uuid)
2163 get_basic_attr(SDP_ATTR_GROUP_ID, uuid, uuid);
2258 uuid_t *uuid = NULL;
2265 uuid = (uuid_t *) d;
2266 values[pslen] = &uuid->value.uuid16;
2269 uuid = (uuid_t *) d;
2270 values[pslen] = &uuid->value.uuid32;
2273 uuid = (uuid_t *) d;
2274 values[pslen] = &uuid->value.uuid128;
2294 if (uuid)
2295 sdp_pattern_add_uuid(rec, uuid);
2412 * This is the UUID of the service.
2416 void sdp_set_service_id(sdp_record_t *rec, uuid_t uuid)
2418 switch (uuid.type) {
2421 &uuid.value.uuid16);
2425 &uuid.value.uuid32);
2429 &uuid.value.uuid128);
2432 sdp_pattern_add_uuid(rec, &uuid);
2438 * This is the UUID of the group.
2442 void sdp_set_group_id(sdp_record_t *rec, uuid_t uuid)
2444 switch (uuid.type) {
2447 &uuid.value.uuid16);
2451 &uuid.value.uuid32);
2455 &uuid.value.uuid128);
2458 sdp_pattern_add_uuid(rec, &uuid);
2506 switch (profile->uuid.type) {
2509 values[0] = &profile->uuid.value.uuid16;
2513 values[0] = &profile->uuid.value.uuid32;
2517 values[0] = &profile->uuid.value.uuid128;
2529 sdp_pattern_add_uuid(rec, &profile->uuid);
2591 * UUID comparison function
2609 * UUID comparison function
2620 * UUID comparison function
2631 * 128 to 16 bit and 32 to 16 bit UUID conversion functions
2643 /* allocate a 128bit UUID and init to the Bluetooth base UUID */
2647 /* extract bytes 2 and 3 of 128bit BT base UUID */
2650 /* add the given UUID (16 bits) */
2665 /* allocate a 128bit UUID and init to the Bluetooth base UUID */
2672 /* add the given UUID (32bits) */
2679 uuid_t *sdp_uuid_to_uuid128(const uuid_t *uuid)
2687 switch (uuid->type) {
2689 *uuid128 = *uuid;
2692 sdp_uuid32_to_uuid128(uuid128, uuid);
2695 sdp_uuid16_to_uuid128(uuid128, uuid);
2702 * converts a 128-bit uuid to a 16/32-bit one if possible
2703 * returns true if uuid contains a 16/32-bit UUID at exit
2705 int sdp_uuid128_to_uuid(uuid_t *uuid)
2708 uint128_t *u = &uuid->value.uuid128;
2712 if (uuid->type != SDP_UUID128)
2722 uuid->type = SDP_UUID16;
2723 uuid->value.uuid16 = (uint16_t) data;
2725 uuid->type = SDP_UUID32;
2726 uuid->value.uuid32 = data;
2732 * convert a UUID to the 16-bit short-form
2734 int sdp_uuid_to_proto(uuid_t *uuid)
2736 uuid_t u = *uuid;
3136 void sdp_pattern_add_uuid(sdp_record_t *rec, uuid_t *uuid)
3138 uuid_t *uuid128 = sdp_uuid_to_uuid128(uuid);
3154 uuid_t *uuid = (uuid_t *)seq->data;
3155 sdp_pattern_add_uuid(rec, uuid);
3256 uuid_t *uuid = seq->data;
3257 return gen_dataseq_pdu(dst, seq, uuid->type);
3293 * pattern. Each entry in the list is a UUID (DataTypeSDP_UUID16)
3716 * pattern. Each entry in the list is a UUID (DataTypeSDP_UUID16)
3920 * pattern. Each entry in the list is a UUID(DataTypeSDP_UUID16)
4255 * pattern. Each entry in the list is a UUID(DataTypeSDP_UUID16)