return NULL;
}
- if (add_record_to_server(adapter_get_address(server->adapter),
- record) < 0) {
+ if (adapter_service_add(server->adapter, record) < 0) {
error("Unable to register A2DP service record");
sdp_record_free(record);
avdtp_unregister_sep(sep->lsep);
return -1;
}
- if (add_record_to_server(adapter_get_address(adapter), record) < 0) {
+ if (adapter_service_add(adapter, record) < 0) {
error("Unable to register AVRCP target service record");
avrcp_target_server_remove(p, adapter);
sdp_record_free(record);
return -1;
}
- if (add_record_to_server(adapter_get_address(adapter), record) < 0) {
+ if (adapter_service_add(adapter, record) < 0) {
error("Unable to register AVRCP service record");
avrcp_controller_server_remove(p, adapter);
sdp_record_free(record);
if (sdp_set_record_state(sdp_record, adapter->record_state++) < 0)
goto fail;
- if (add_record_to_server(adapter_get_address(adapter->btd_adapter),
- sdp_record) < 0)
+ if (adapter_service_add(adapter->btd_adapter, sdp_record) < 0)
goto fail;
adapter->sdp_handler = sdp_record->handle;
return TRUE;
return 0;
}
- if (add_record_to_server(&ns->src, record) < 0) {
+ if (adapter_service_add(ns->na->adapter, record) < 0) {
error("Failed to register service record");
sdp_record_free(record);
return 0;
goto sdp_err;
}
- if (add_record_to_server(adapter_get_address(adapter), record) < 0) {
+ if (adapter_service_add(adapter, record) < 0) {
error("Adding SAP SDP record to the SDP server failed.");
sdp_record_free(record);
goto sdp_err;
return sdp_uuid_cmp(&rec->svclass, uuid);
}
-void adapter_service_insert(struct btd_adapter *adapter, void *r)
+static void adapter_service_insert(struct btd_adapter *adapter, sdp_record_t *rec)
{
- sdp_record_t *rec = r;
sdp_list_t *browse_list = NULL;
uuid_t browse_uuid;
gboolean new_uuid;
DBG("%s", adapter->path);
/* skip record without a browse group */
- if (sdp_get_browse_groups(rec, &browse_list) < 0)
+ if (sdp_get_browse_groups(rec, &browse_list) < 0) {
+ DBG("skipping record without browse group");
return;
+ }
sdp_uuid16_create(&browse_uuid, PUBLIC_BROWSE_GROUP);
sdp_list_free(browse_list, free);
}
+int adapter_service_add(struct btd_adapter *adapter, sdp_record_t *rec)
+{
+ int ret;
+
+ DBG("%s", adapter->path);
+
+ ret = add_record_to_server(&adapter->bdaddr, rec);
+ if (ret < 0)
+ return ret;
+
+ adapter_service_insert(adapter, rec);
+
+ return 0;
+}
+
void adapter_service_remove(struct btd_adapter *adapter, void *r)
{
sdp_record_t *rec = r;
const char *adapter_get_path(struct btd_adapter *adapter);
const bdaddr_t *adapter_get_address(struct btd_adapter *adapter);
int adapter_set_name(struct btd_adapter *adapter, const char *name);
-void adapter_service_insert(struct btd_adapter *adapter, void *rec);
+
+int adapter_service_add(struct btd_adapter *adapter, sdp_record_t *rec);
void adapter_service_remove(struct btd_adapter *adapter, void *rec);
struct agent *adapter_get_agent(struct btd_adapter *adapter);
"http://www.bluez.org/");
}
- if (add_record_to_server(adapter_get_address(server->adapter), record)
- == 0)
+ if (adapter_service_add(server->adapter, record) == 0)
return record->handle;
sdp_record_free(record);
static uint32_t ext_register_record(struct ext_profile *ext,
struct ext_io *l2cap,
struct ext_io *rfcomm,
- const bdaddr_t *src)
+ struct btd_adapter *a)
{
sdp_record_t *rec;
char *dyn_record = NULL;
return 0;
}
- if (add_record_to_server(src, rec) < 0) {
+ if (adapter_service_add(a, rec) < 0) {
error("Failed to register service record");
sdp_record_free(rec);
return 0;
}
}
- return ext_register_record(ext, l2cap, rfcomm,
- adapter_get_address(adapter));
+ return ext_register_record(ext, l2cap, rfcomm, adapter);
failed:
if (l2cap) {
*/
void sdp_record_add(const bdaddr_t *device, sdp_record_t *rec)
{
- struct btd_adapter *adapter;
sdp_access_t *dev;
SDPDBG("Adding rec : 0x%lx", (long) rec);
dev->handle = rec->handle;
access_db = sdp_list_insert_sorted(access_db, dev, access_sort);
-
- if (bacmp(device, BDADDR_ANY) == 0) {
- adapter_foreach(adapter_service_insert, rec);
- return;
- }
-
- adapter = adapter_find(device);
- if (adapter)
- adapter_service_insert(adapter, rec);
}
static sdp_list_t *record_locate(uint32_t handle)
continue;
SDPDBG("adding record with handle %x", access->handle);
-
- adapter_foreach(adapter_service_insert, rec);
}
}