~ubuntu-branches/ubuntu/wily/bluez/wily

« back to all changes in this revision

Viewing changes to compat/sdp.c

ImportĀ upstreamĀ versionĀ 4.81

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 *
3
3
 *  BlueZ - Bluetooth protocol stack for Linux
4
4
 *
5
 
 *  Copyright (C) 2003-2009  Marcel Holtmann <marcel@holtmann.org>
 
5
 *  Copyright (C) 2003-2010  Marcel Holtmann <marcel@holtmann.org>
6
6
 *
7
7
 *
8
8
 *  This program is free software; you can redistribute it and/or modify
152
152
                        &vendor, &product, &version, &subclass, &country,
153
153
                        &parser, desc, &req->flags, &pos);
154
154
 
155
 
        free(str);
156
155
 
157
156
        req->vendor   = vendor;
158
157
        req->product  = product;
163
162
 
164
163
        snprintf(req->name, 128, "%s", str + pos);
165
164
 
 
165
        free(str);
166
166
        req->rd_size = strlen(desc) / 2;
167
167
        req->rd_data = malloc(req->rd_size);
168
168
        if (!req->rd_data) {
248
248
 
249
249
        rec = (sdp_record_t *) hid_rsp->data;
250
250
 
251
 
        pdlist = sdp_data_get(rec, 0x0101);
252
 
        pdlist2 = sdp_data_get(rec, 0x0102);
253
 
        if (pdlist) {
254
 
                if (pdlist2) {
255
 
                        if (strncmp(pdlist->val.str, pdlist2->val.str, 5)) {
256
 
                                strncpy(req->name, pdlist2->val.str, sizeof(req->name) - 1);
257
 
                                strcat(req->name, " ");
258
 
                        }
259
 
                        strncat(req->name, pdlist->val.str,
260
 
                                        sizeof(req->name) - strlen(req->name));
261
 
                } else
262
 
                        strncpy(req->name, pdlist->val.str, sizeof(req->name) - 1);
263
 
        } else {
264
 
                pdlist2 = sdp_data_get(rec, 0x0100);
265
 
                if (pdlist2)
266
 
                        strncpy(req->name, pdlist2->val.str, sizeof(req->name) - 1);
 
251
        pdlist2 = sdp_data_get(rec, 0x0100);
 
252
        if (pdlist2)
 
253
                strncpy(req->name, pdlist2->val.str, sizeof(req->name) - 1);
 
254
        else {
 
255
                pdlist = sdp_data_get(rec, 0x0101);
 
256
                pdlist2 = sdp_data_get(rec, 0x0102);
 
257
                if (pdlist) {
 
258
                        if (pdlist2) {
 
259
                                if (strncmp(pdlist->val.str, pdlist2->val.str, 5)) {
 
260
                                        strncpy(req->name, pdlist2->val.str, sizeof(req->name) - 1);
 
261
                                        strcat(req->name, " ");
 
262
                                }
 
263
                                strncat(req->name, pdlist->val.str,
 
264
                                                sizeof(req->name) - strlen(req->name));
 
265
                        } else
 
266
                                strncpy(req->name, pdlist->val.str, sizeof(req->name) - 1);
 
267
                }
267
268
        }
268
269
 
269
270
        pdlist = sdp_data_get(rec, 0x0201);
368
369
        return -EIO;
369
370
}
370
371
 
371
 
void bnep_sdp_unregister(void) 
 
372
void bnep_sdp_unregister(void)
372
373
{
373
374
        if (record && sdp_record_unregister(session, record))
374
375
                syslog(LOG_ERR, "Service record unregistration failed.");
424
425
 
425
426
        /* Supported protocols */
426
427
        {
427
 
                uint16_t ptype[4] = { 
 
428
                uint16_t ptype[4] = {
428
429
                        0x0800,  /* IPv4 */
429
430
                        0x0806,  /* ARP */
430
431
                };
483
484
                profile[0].version = 0x0100;
484
485
                pfseq = sdp_list_append(NULL, &profile[0]);
485
486
                sdp_set_profile_descs(record, pfseq);
486
 
                
 
487
 
487
488
                sdp_set_info_attr(record, "Group Network Service", name, desc);
488
489
                break;
489
490
 
558
559
static unsigned char async_uuid[] = {   0x03, 0x50, 0x27, 0x8F, 0x3D, 0xCA, 0x4E, 0x62,
559
560
                                        0x83, 0x1D, 0xA4, 0x11, 0x65, 0xFF, 0x90, 0x6C };
560
561
 
561
 
void dun_sdp_unregister(void) 
 
562
void dun_sdp_unregister(void)
562
563
{
563
564
        if (record && sdp_record_unregister(session, record))
564
565
                syslog(LOG_ERR, "Service record unregistration failed.");
575
576
 
576
577
        session = sdp_connect(BDADDR_ANY, BDADDR_LOCAL, 0);
577
578
        if (!session) {
578
 
                syslog(LOG_ERR, "Failed to connect to the local SDP server. %s(%d)", 
 
579
                syslog(LOG_ERR, "Failed to connect to the local SDP server. %s(%d)",
579
580
                                strerror(errno), errno);
580
581
                return -1;
581
582
        }
670
671
 
671
672
        s = sdp_connect(src, dst, 0);
672
673
        if (!s) {
673
 
                syslog(LOG_ERR, "Failed to connect to the SDP server. %s(%d)", 
 
674
                syslog(LOG_ERR, "Failed to connect to the SDP server. %s(%d)",
674
675
                                strerror(errno), errno);
675
676
                return -1;
676
677
        }