public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [Bluez-devel] [PATCH] bluez-libs UUID-128 support for Protocol Descriptor List
@ 2006-08-21 12:28 Markus Becker
  2006-08-23 17:35 ` Marcel Holtmann
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Becker @ 2006-08-21 12:28 UTC (permalink / raw)
  To: bluez-devel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1486 bytes --]

Hello Marcel et al.,

I've created a patch for bluez-libs/src/sdp.c to support the finding of
UUID128 encoded protocols. So that also kdebluetooth and others can
recognize those protocols. It changes the display of the Protocol
Descriptor List for example from:

Service Name: ATEmulator
Service RecHandle: 0x10010
Service Class ID List:
  "Error: This is UUID-128" (0x7dd6b763-99a9-4a92-87b5-bc8efe565c37)
  "Error: This is UUID-128" (0x00001101-0000-1000-8000-00805f9b34fb)
Protocol Descriptor List:
  "Error: " (0x00000100-0000-1000-8000-00805f9b34fb)
  "Error: " (0x00000003-0000-1000-8000-00805f9b34fb)
    Channel: 25

to:

Service Name: ATEmulator
Service RecHandle: 0x10010
Service Class ID List:
  UUID 128: 7dd6b763-99a9-4a92-87b5-bc8efe565c37
  UUID 128: 00001101-0000-1000-8000-00805f9b34fb
Protocol Descriptor List:
  "L2CAP" (0x00000100-0000-1000-8000-00805f9b34fb)
  "RFCOMM" (0x00000003-0000-1000-8000-00805f9b34fb)
    Channel: 25

Please consider it for integration into mainline bluez-libs.

Best regards,
Markus Becker

P.S.: When replying please CC me, because I'm not subscribed to the list.

------------------------------------------------
| Dipl.-Ing. Markus Becker 
| Communication Networks
| University Bremen
| Germany
------------------------------------------------
| web: http://www.comnets.uni-bremen.de/~mab/
| mailto: mab@comnets.uni-bremen.de 
| telephone: +49 421 218 2287
| building: NW1 room: N2260
------------------------------------------------

[-- Attachment #2: Type: TEXT/PLAIN, Size: 1055 bytes --]

diff -u bluez-libs-3.2/src/sdp.c bluez-libs-3.2.mod/src/sdp.c
--- bluez-libs-3.2/src/sdp.c	2006-07-27 06:36:59.000000000 +0200
+++ bluez-libs-3.2.mod/src/sdp.c	2006-08-21 13:45:46.000000000 +0200
@@ -208,6 +208,25 @@
 	return "";
 }
 
+static char *string_lookup128(struct tupla *pt0, uint128_t index)
+{
+  	struct tupla *pt;
+
+	int i_index = index.data[0];
+	i_index = i_index <<8;
+	i_index += index.data[1];
+	i_index = i_index  <<8;
+	i_index += index.data[2];
+	i_index = i_index  <<8;
+	i_index += index.data[3];
+
+	for (pt = pt0; pt->index; pt++) {
+	  if (pt->index == i_index)
+	    return pt->str;
+	}
+	return "";
+}
+
 /*
  * Prints into a string the Protocol UUID
  * coping a maximum of n characters.
@@ -231,7 +250,8 @@
 		snprintf(str, n, str2);
 		break;
 	case SDP_UUID128:
-		snprintf(str, n, "Error: This is UUID-128");
+		str2 = string_lookup128(message, uuid->value.uuid128);
+		snprintf(str, n, str2);
 		return -4;
 	default:
 		snprintf(str, n, "Type of UUID (%x) unknown.", uuid->type);

[-- Attachment #3: Type: text/plain, Size: 373 bytes --]

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

[-- Attachment #4: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Bluez-devel] [PATCH] bluez-libs UUID-128 support for Protocol Descriptor List
  2006-08-21 12:28 [Bluez-devel] [PATCH] bluez-libs UUID-128 support for Protocol Descriptor List Markus Becker
@ 2006-08-23 17:35 ` Marcel Holtmann
  2006-08-24 10:35   ` Markus Becker
  0 siblings, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2006-08-23 17:35 UTC (permalink / raw)
  To: BlueZ development; +Cc: Markus Becker

Hi Markus,

> I've created a patch for bluez-libs/src/sdp.c to support the finding of
> UUID128 encoded protocols. So that also kdebluetooth and others can
> recognize those protocols. It changes the display of the Protocol
> Descriptor List for example from:
> 
> Service Name: ATEmulator
> Service RecHandle: 0x10010
> Service Class ID List:
>   "Error: This is UUID-128" (0x7dd6b763-99a9-4a92-87b5-bc8efe565c37)
>   "Error: This is UUID-128" (0x00001101-0000-1000-8000-00805f9b34fb)
> Protocol Descriptor List:
>   "Error: " (0x00000100-0000-1000-8000-00805f9b34fb)
>   "Error: " (0x00000003-0000-1000-8000-00805f9b34fb)
>     Channel: 25
> 
> to:
> 
> Service Name: ATEmulator
> Service RecHandle: 0x10010
> Service Class ID List:
>   UUID 128: 7dd6b763-99a9-4a92-87b5-bc8efe565c37
>   UUID 128: 00001101-0000-1000-8000-00805f9b34fb
> Protocol Descriptor List:
>   "L2CAP" (0x00000100-0000-1000-8000-00805f9b34fb)
>   "RFCOMM" (0x00000003-0000-1000-8000-00805f9b34fb)
>     Channel: 25
> 
> Please consider it for integration into mainline bluez-libs.

the patch is wrong. Before you are doing a lookup against the short
UUIDs of Bluetooth you should check if the base UUID is the Bluetooth
base UUID. Otherwise you can't do the lookup.

Regards

Marcel



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Bluez-devel] [PATCH] bluez-libs UUID-128 support for Protocol Descriptor List
  2006-08-23 17:35 ` Marcel Holtmann
@ 2006-08-24 10:35   ` Markus Becker
  2006-08-24 14:43     ` Marcel Holtmann
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Becker @ 2006-08-24 10:35 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: BlueZ development

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1707 bytes --]

Hi Marcel.

On Wed, 23 Aug 2006, Marcel Holtmann wrote:

> Hi Markus,
> 
> > I've created a patch for bluez-libs/src/sdp.c to support the finding of
> > UUID128 encoded protocols. So that also kdebluetooth and others can
> > recognize those protocols. It changes the display of the Protocol
> > Descriptor List for example from:
> > 
> > Service Name: ATEmulator
> > Service RecHandle: 0x10010
> > Service Class ID List:
> >   "Error: This is UUID-128" (0x7dd6b763-99a9-4a92-87b5-bc8efe565c37)
> >   "Error: This is UUID-128" (0x00001101-0000-1000-8000-00805f9b34fb)
> > Protocol Descriptor List:
> >   "Error: " (0x00000100-0000-1000-8000-00805f9b34fb)
> >   "Error: " (0x00000003-0000-1000-8000-00805f9b34fb)
> >     Channel: 25
> > 
> > to:
> > 
> > Service Name: ATEmulator
> > Service RecHandle: 0x10010
> > Service Class ID List:
> >   UUID 128: 7dd6b763-99a9-4a92-87b5-bc8efe565c37
> >   UUID 128: 00001101-0000-1000-8000-00805f9b34fb
> > Protocol Descriptor List:
> >   "L2CAP" (0x00000100-0000-1000-8000-00805f9b34fb)
> >   "RFCOMM" (0x00000003-0000-1000-8000-00805f9b34fb)
> >     Channel: 25
> > 
> > Please consider it for integration into mainline bluez-libs.
> 
> the patch is wrong. Before you are doing a lookup against the short
> UUIDs of Bluetooth you should check if the base UUID is the Bluetooth
> base UUID. Otherwise you can't do the lookup.
> 
OK. I attached a patch that does the whole String_lookup differently and
using sdp_uuid128_to_uuid for 128 bit UUIDs. Unfortunately I had to change
the interface in sdp_lib.h because of "const" not being fulfilled by
sdp_uuid128_to_uuid.

I hope this patch is more to your liking. If not, contact me.

> Regards
> 
> Marcel


Bye,
Markus

[-- Attachment #2: Type: TEXT/PLAIN, Size: 3197 bytes --]

diff -u bluez-libs-3.2/src/sdp.c bluez-libs-3.2.mod/src/sdp.c
--- bluez-libs-3.2/src/sdp.c	2006-07-27 06:36:59.000000000 +0200
+++ bluez-libs-3.2.mod/src/sdp.c	2006-08-24 12:29:31.000000000 +0200
@@ -208,11 +208,36 @@
 	return "";
 }
 
+static char *string_lookup16(struct tupla *pt0, uuid_t* uuid)
+{
+  return string_lookup(pt0, uuid->value.uuid16);
+}
+
+static char *string_lookup32(struct tupla *pt0, uuid_t* uuid)
+{
+  return string_lookup(pt0, uuid->value.uuid32);
+}
+
+static char *string_lookup128(struct tupla *pt0, uuid_t* uuid)
+{
+  if (sdp_uuid128_to_uuid(uuid)) {
+    if (uuid->type == SDP_UUID16) {
+      return string_lookup(pt0, uuid->value.uuid16);
+    } else if (uuid->type == SDP_UUID32)  {
+      return string_lookup(pt0, uuid->value.uuid32);
+    } else {
+      return "";
+    }
+  } else {
+    return "";
+  }
+}
+
 /*
  * Prints into a string the Protocol UUID
  * coping a maximum of n characters.
  */
-static int uuid2str(struct tupla *message, const uuid_t *uuid, char *str, size_t n) 
+static int uuid2str(struct tupla *message, uuid_t *uuid, char *str, size_t n) 
 {
 	char *str2;
 
@@ -223,15 +248,16 @@
 
 	switch (uuid->type) {
 	case SDP_UUID16:
-		str2 = string_lookup(message, uuid->value.uuid16);
+		str2 = string_lookup16(message, uuid);
 		snprintf(str, n, str2);
 		break;
 	case SDP_UUID32:
-		str2 = string_lookup(message, uuid->value.uuid32);
+		str2 = string_lookup32(message, uuid);
 		snprintf(str, n, str2);
 		break;
 	case SDP_UUID128:
-		snprintf(str, n, "Error: This is UUID-128");
+		str2 = string_lookup128(message, uuid);
+		snprintf(str, n, str2);
 		return -4;
 	default:
 		snprintf(str, n, "Type of UUID (%x) unknown.", uuid->type);
@@ -241,17 +267,17 @@
 	return 0;
 }
 
-int sdp_proto_uuid2strn(const uuid_t *uuid, char *str, size_t n)
+int sdp_proto_uuid2strn(uuid_t *uuid, char *str, size_t n)
 {
 	return uuid2str(Protocol, uuid, str, n);
 }
 
-int sdp_svclass_uuid2strn(const uuid_t *uuid, char *str, size_t n)
+int sdp_svclass_uuid2strn(uuid_t *uuid, char *str, size_t n)
 {
 	return uuid2str(ServiceClass, uuid, str, n);
 }
 
-int sdp_profile_uuid2strn(const uuid_t *uuid, char *str, size_t n)
+int sdp_profile_uuid2strn(uuid_t *uuid, char *str, size_t n)
 {
 	return uuid2str(Profile, uuid, str, n);
 }
diff -u bluez-libs-3.2/include/sdp_lib.h bluez-libs-3.2.mod/include/sdp_lib.h
--- bluez-libs-3.2/include/sdp_lib.h	2006-01-03 13:56:09.000000000 +0100
+++ bluez-libs-3.2.mod/include/sdp_lib.h	2006-08-24 12:25:36.000000000 +0200
@@ -438,9 +438,9 @@
 #define MAX_LEN_PROFILEDESCRIPTOR_UUID_STR 28
 
 int sdp_uuid2strn(const uuid_t *uuid, char *str, size_t n);
-int sdp_proto_uuid2strn(const uuid_t *uuid, char *str, size_t n);
-int sdp_svclass_uuid2strn(const uuid_t *uuid, char *str, size_t n);
-int sdp_profile_uuid2strn(const uuid_t *uuid, char *str, size_t n);
+int sdp_proto_uuid2strn(uuid_t *uuid, char *str, size_t n);
+int sdp_svclass_uuid2strn(uuid_t *uuid, char *str, size_t n);
+int sdp_profile_uuid2strn(uuid_t *uuid, char *str, size_t n);
 
 /*
  * In all the sdp_get_XXX(handle, XXX *xxx) functions below, 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Bluez-devel] [PATCH] bluez-libs UUID-128 support for Protocol Descriptor List
  2006-08-24 14:43     ` Marcel Holtmann
@ 2006-08-24 13:51       ` Markus Becker
  0 siblings, 0 replies; 5+ messages in thread
From: Markus Becker @ 2006-08-24 13:51 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: BlueZ development


On Thu, 24 Aug 2006, Marcel Holtmann wrote:

> Hi Markus,
> 
> > > > I've created a patch for bluez-libs/src/sdp.c to support the finding of
> > > > UUID128 encoded protocols. So that also kdebluetooth and others can
> > > > recognize those protocols. It changes the display of the Protocol
> > > > Descriptor List for example from:
> > > > 
> > > > Service Name: ATEmulator
> > > > Service RecHandle: 0x10010
> > > > Service Class ID List:
> > > >   "Error: This is UUID-128" (0x7dd6b763-99a9-4a92-87b5-bc8efe565c37)
> > > >   "Error: This is UUID-128" (0x00001101-0000-1000-8000-00805f9b34fb)
> > > > Protocol Descriptor List:
> > > >   "Error: " (0x00000100-0000-1000-8000-00805f9b34fb)
> > > >   "Error: " (0x00000003-0000-1000-8000-00805f9b34fb)
> > > >     Channel: 25
> > > > 
> > > > to:
> > > > 
> > > > Service Name: ATEmulator
> > > > Service RecHandle: 0x10010
> > > > Service Class ID List:
> > > >   UUID 128: 7dd6b763-99a9-4a92-87b5-bc8efe565c37
> > > >   UUID 128: 00001101-0000-1000-8000-00805f9b34fb
> > > > Protocol Descriptor List:
> > > >   "L2CAP" (0x00000100-0000-1000-8000-00805f9b34fb)
> > > >   "RFCOMM" (0x00000003-0000-1000-8000-00805f9b34fb)
> > > >     Channel: 25
> > > > 
> > > > Please consider it for integration into mainline bluez-libs.
> > > 
> > > the patch is wrong. Before you are doing a lookup against the short
> > > UUIDs of Bluetooth you should check if the base UUID is the Bluetooth
> > > base UUID. Otherwise you can't do the lookup.
> > > 
> > OK. I attached a patch that does the whole String_lookup differently and
> > using sdp_uuid128_to_uuid for 128 bit UUIDs. Unfortunately I had to change
> > the interface in sdp_lib.h because of "const" not being fulfilled by
> > sdp_uuid128_to_uuid.
> > 
> > I hope this patch is more to your liking. If not, contact me.
> 
> your patch is a little bit too complex and the coding style is wrong and
> changing the prototypes is not a good idea.
> 
> Please test the attached patch. This is how I would do it.

Tested and works for me. Thanks.

> 
> Regards
> 
> Marcel
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Bluez-devel] [PATCH] bluez-libs UUID-128 support for Protocol Descriptor List
  2006-08-24 10:35   ` Markus Becker
@ 2006-08-24 14:43     ` Marcel Holtmann
  2006-08-24 13:51       ` Markus Becker
  0 siblings, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2006-08-24 14:43 UTC (permalink / raw)
  To: Markus Becker; +Cc: BlueZ development

[-- Attachment #1: Type: text/plain, Size: 1883 bytes --]

Hi Markus,

> > > I've created a patch for bluez-libs/src/sdp.c to support the finding of
> > > UUID128 encoded protocols. So that also kdebluetooth and others can
> > > recognize those protocols. It changes the display of the Protocol
> > > Descriptor List for example from:
> > > 
> > > Service Name: ATEmulator
> > > Service RecHandle: 0x10010
> > > Service Class ID List:
> > >   "Error: This is UUID-128" (0x7dd6b763-99a9-4a92-87b5-bc8efe565c37)
> > >   "Error: This is UUID-128" (0x00001101-0000-1000-8000-00805f9b34fb)
> > > Protocol Descriptor List:
> > >   "Error: " (0x00000100-0000-1000-8000-00805f9b34fb)
> > >   "Error: " (0x00000003-0000-1000-8000-00805f9b34fb)
> > >     Channel: 25
> > > 
> > > to:
> > > 
> > > Service Name: ATEmulator
> > > Service RecHandle: 0x10010
> > > Service Class ID List:
> > >   UUID 128: 7dd6b763-99a9-4a92-87b5-bc8efe565c37
> > >   UUID 128: 00001101-0000-1000-8000-00805f9b34fb
> > > Protocol Descriptor List:
> > >   "L2CAP" (0x00000100-0000-1000-8000-00805f9b34fb)
> > >   "RFCOMM" (0x00000003-0000-1000-8000-00805f9b34fb)
> > >     Channel: 25
> > > 
> > > Please consider it for integration into mainline bluez-libs.
> > 
> > the patch is wrong. Before you are doing a lookup against the short
> > UUIDs of Bluetooth you should check if the base UUID is the Bluetooth
> > base UUID. Otherwise you can't do the lookup.
> > 
> OK. I attached a patch that does the whole String_lookup differently and
> using sdp_uuid128_to_uuid for 128 bit UUIDs. Unfortunately I had to change
> the interface in sdp_lib.h because of "const" not being fulfilled by
> sdp_uuid128_to_uuid.
> 
> I hope this patch is more to your liking. If not, contact me.

your patch is a little bit too complex and the coding style is wrong and
changing the prototypes is not a good idea.

Please test the attached patch. This is how I would do it.

Regards

Marcel


[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 1081 bytes --]

Index: src/sdp.c
===================================================================
RCS file: /cvsroot/bluez/libs/src/sdp.c,v
retrieving revision 1.42
diff -u -r1.42 sdp.c
--- src/sdp.c	23 Aug 2006 15:05:30 -0000	1.42
+++ src/sdp.c	24 Aug 2006 12:40:53 -0000
@@ -208,6 +208,24 @@
 	return "";
 }
 
+static char *string_lookup_uuid(struct tupla *pt0, const uuid_t* uuid)
+{
+	uuid_t tmp_uuid;
+
+	memcpy(&tmp_uuid, uuid, sizeof(tmp_uuid));
+
+	if (sdp_uuid128_to_uuid(&tmp_uuid)) {
+		switch (tmp_uuid.type) {
+		case SDP_UUID16:
+			return string_lookup(pt0, tmp_uuid.value.uuid16);
+		case SDP_UUID32:
+			return string_lookup(pt0, tmp_uuid.value.uuid32);
+		}
+	}
+
+	return "";
+}
+
 /*
  * Prints into a string the Protocol UUID
  * coping a maximum of n characters.
@@ -231,8 +249,9 @@
 		snprintf(str, n, str2);
 		break;
 	case SDP_UUID128:
-		snprintf(str, n, "Error: This is UUID-128");
-		return -4;
+		str2 = string_lookup_uuid(message, uuid);
+		snprintf(str, n, str2);
+		break;
 	default:
 		snprintf(str, n, "Type of UUID (%x) unknown.", uuid->type);
 		return -1;

[-- Attachment #3: Type: text/plain, Size: 373 bytes --]

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

[-- Attachment #4: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-08-24 14:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-21 12:28 [Bluez-devel] [PATCH] bluez-libs UUID-128 support for Protocol Descriptor List Markus Becker
2006-08-23 17:35 ` Marcel Holtmann
2006-08-24 10:35   ` Markus Becker
2006-08-24 14:43     ` Marcel Holtmann
2006-08-24 13:51       ` Markus Becker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox