3
* BlueZ - Bluetooth protocol stack for Linux
5
* Copyright (C) 2003-2008 Marcel Holtmann <marcel@holtmann.org>
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or
11
* (at your option) any later version.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32
#include <sys/socket.h>
34
#include <bluetooth/bluetooth.h>
35
#include <bluetooth/sdp.h>
36
#include <bluetooth/sdp_lib.h>
38
int sdp_search_hcrp(sdp_session_t *sdp, unsigned short *ctrl_psm, unsigned short *data_psm)
40
sdp_list_t *srch, *attrs, *rsp;
42
uint16_t attr1, attr2;
48
sdp_uuid16_create(&svclass, HCR_PRINT_SVCLASS_ID);
49
srch = sdp_list_append(NULL, &svclass);
51
attr1 = SDP_ATTR_PROTO_DESC_LIST;
52
attrs = sdp_list_append(NULL, &attr1);
53
attr2 = SDP_ATTR_ADD_PROTO_DESC_LIST;
54
attrs = sdp_list_append(attrs, &attr2);
56
err = sdp_service_search_attr_req(sdp, srch, SDP_ATTR_REQ_INDIVIDUAL, attrs, &rsp);
60
for (; rsp; rsp = rsp->next) {
61
sdp_record_t *rec = (sdp_record_t *) rsp->data;
64
if (!sdp_get_access_protos(rec, &protos)) {
65
unsigned short psm = sdp_get_proto_port(protos, L2CAP_UUID);
71
if (!sdp_get_add_access_protos(rec, &protos)) {
72
unsigned short psm = sdp_get_proto_port(protos, L2CAP_UUID);
73
if (psm > 0 && *ctrl_psm > 0) {
83
int sdp_search_spp(sdp_session_t *sdp, uint8_t *channel)
85
sdp_list_t *srch, *attrs, *rsp;
93
sdp_uuid16_create(&svclass, SERIAL_PORT_SVCLASS_ID);
94
srch = sdp_list_append(NULL, &svclass);
96
attr = SDP_ATTR_PROTO_DESC_LIST;
97
attrs = sdp_list_append(NULL, &attr);
99
err = sdp_service_search_attr_req(sdp, srch, SDP_ATTR_REQ_INDIVIDUAL, attrs, &rsp);
103
for (; rsp; rsp = rsp->next) {
104
sdp_record_t *rec = (sdp_record_t *) rsp->data;
107
if (!sdp_get_access_protos(rec, &protos)) {
108
uint8_t ch = sdp_get_proto_port(protos, RFCOMM_UUID);