diff options
Diffstat (limited to 'lib/sdp.c')
-rw-r--r-- | lib/sdp.c | 93 |
1 files changed, 0 insertions, 93 deletions
@@ -2364,99 +2364,6 @@ void sdp_set_url_attr(sdp_record_t *rec, const char *client, const char *doc, co sdp_attr_add_new(rec, SDP_ATTR_ICON_URL, SDP_URL_STR8, icon); } -/* - * The code in this function is executed only once per - * thread. We compute the actual bit value of the Bluetooth - * base UUID which is a string defined in bt_std_values.h - * and is assumed to be of the standard form with "-" separators. - * - * The algorithm however converts the string to 4 unsigned longs - * using the strtoul() and assigns the values in sequence to - * the 128bit value - */ -uint128_t *sdp_create_base_uuid(void) -{ - uint128_t *base_uuid; - char baseStr[128]; - int delim = '-'; - unsigned long dataLongValue; - char *delimPtr; - char *dataPtr; - char temp[10]; - int toBeCopied; - uint8_t *data; - - strcpy(baseStr, BASE_UUID); - base_uuid = malloc(sizeof(uint128_t)); - if (!base_uuid) - return NULL; - - data = base_uuid->data; - memset(data, '\0', sizeof(uint128_t)); - memset(temp, '\0', 10); - dataPtr = baseStr; - delimPtr = NULL; - delimPtr = strchr(dataPtr, delim); - toBeCopied = delimPtr - dataPtr; - if (toBeCopied != 8) { - SDPDBG("To be copied(1) : %d\n", toBeCopied); - free(base_uuid); - return NULL; - } - strncpy(temp, dataPtr, toBeCopied); - dataLongValue = htonl(strtoul(temp, NULL, 16)); - memcpy(&data[0], &dataLongValue, 4); - - /* - * Get the next 4 bytes (note that there is a "-" - * between them now) - */ - memset(temp, '\0', 10); - dataPtr = delimPtr + 1; - delimPtr = strchr(dataPtr, delim); - toBeCopied = delimPtr - dataPtr; - if (toBeCopied != 4) { - SDPDBG("To be copied(2) : %d\n", toBeCopied); - free(base_uuid); - return NULL; - } - strncpy(temp, dataPtr, toBeCopied); - dataPtr = delimPtr + 1; - delimPtr = strchr(dataPtr, delim); - toBeCopied = delimPtr - dataPtr; - if (toBeCopied != 4) { - SDPDBG("To be copied(3) : %d\n", toBeCopied); - free(base_uuid); - return NULL; - } - strncat(temp, dataPtr, toBeCopied); - dataLongValue = htonl(strtoul(temp, NULL, 16)); - memcpy(&data[4], &dataLongValue, 4); - - /* - * Get the last 4 bytes (note that there are 6 bytes - * after the last separator, which is truncated (2+4) - */ - memset(temp, '\0', 10); - dataPtr = delimPtr + 1; - dataPtr = delimPtr + 1; - delimPtr = strchr(dataPtr, delim); - toBeCopied = delimPtr - dataPtr; - if (toBeCopied != 4) { - SDPDBG("To be copied(4) : %d\n", toBeCopied); - free(base_uuid); - return NULL; - } - strncpy(temp, dataPtr, toBeCopied); - strncat(temp, (delimPtr + 1), 4); - dataLongValue = htonl(strtoul(temp, NULL, 16)); - memcpy(&data[8], &dataLongValue, 4); - dataLongValue = htonl(strtoul(delimPtr + 5, NULL, 16)); - memcpy(&data[12], &dataLongValue, 4); - - return base_uuid; -} - uuid_t *sdp_uuid16_create(uuid_t *u, uint16_t val) { memset(u, 0, sizeof(uuid_t)); |