summaryrefslogtreecommitdiffstats
path: root/hcid/dbus-sdp.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2006-08-23 14:33:58 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2006-08-23 14:33:58 +0000
commit684ba3688de17a3b8a6defd3139e1b8bf8971ef5 (patch)
treeab10267b189a8d6a26730e2dd5621a0eaa5b233a /hcid/dbus-sdp.c
parentd6faebdc8a88ed8338dc68beefbfbae7e303f895 (diff)
Add preliminary RFCOMM.Connect and RFCOMM.CancelConnect support
Diffstat (limited to 'hcid/dbus-sdp.c')
-rw-r--r--hcid/dbus-sdp.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/hcid/dbus-sdp.c b/hcid/dbus-sdp.c
index cfc4f4f2..2634a5ea 100644
--- a/hcid/dbus-sdp.c
+++ b/hcid/dbus-sdp.c
@@ -833,6 +833,77 @@ search_request:
}
+static int sdp_uuid_comp_func(const void *key1, const void *key2)
+{
+ const uuid_t *a = (const uuid_t *)key1;
+ const uuid_t *b = (const uuid_t *)key2;
+
+ if (a->type != b->type)
+ return 1;
+
+ switch (a->type) {
+ case SDP_UUID16:
+ return !(a->value.uuid16 == b->value.uuid16);
+ break;
+ case SDP_UUID32:
+ return !(a->value.uuid32 == b->value.uuid32);
+ break;
+ case SDP_UUID128:
+ return !memcmp(&a->value.uuid128, &b->value.uuid128,
+ sizeof(uint128_t));
+ break;
+ }
+ return 1;
+}
+
+sdp_record_t *find_record_by_uuid(const char *address, uuid_t *uuid)
+{
+ struct slist *lp, *lr;
+ struct service_provider *p;
+ struct service_record *r;
+ sdp_list_t *list = 0;
+
+
+ for (lp = sdp_cache; lp; lp = lp->next) {
+ p = lp->data;
+ if (strcmp(p->prov, address))
+ continue;
+
+ for (lr = p->lrec; lr; lr = lr->next) {
+ r = lr->data;
+ /* Check whether the record has the correct uuid */
+ if (sdp_get_service_classes(r->record, &list) !=0)
+ continue;
+
+ if (sdp_list_find (list, &uuid, sdp_uuid_comp_func))
+ return r->record;
+ }
+ }
+
+ return NULL;
+}
+
+sdp_record_t *find_record_by_handle(const char *address, int handle)
+{
+ struct slist *lp, *lr;
+ struct service_provider *p;
+ struct service_record *r;
+
+ for (lp = sdp_cache; lp; lp = lp->next) {
+ p = lp->data;
+ if (strcmp(p->prov, address))
+ continue;
+
+ for (lr = p->lrec; lr; lr = lr->next) {
+ r = lr->data;
+ if (r->record->handle == handle)
+ return r->record;
+ }
+ }
+
+ return NULL;
+}
+
static sdp_record_t *find_record(const char *address, int id)
{
struct slist *lp, *lr;