public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [Bluez-devel] can bluez dynamically allocate l2cap psm?
@ 2004-05-12  1:17 Albert Huang
  2004-05-12  9:17 ` Stephen Crane
  0 siblings, 1 reply; 2+ messages in thread
From: Albert Huang @ 2004-05-12  1:17 UTC (permalink / raw)
  To: bluez-devel

I want a simple client/server that operates as follows.

server listens for l2cap connections.  accepts a connection, does
something with it.

client discovers server by entering inquiry mode and then checking SDP
records for service id of the server.

I don't want to hard-code the l2cap psm, as that seems like it defeats
half the point of SDP, but I can't figure out how to request a dynamic
psm.  I want to be able to do somethiing like this:

int s;
struct sockaddr_l2 s_addr;
s = socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP);

s_addr.l2_family = AF_BLUETOOTH;
bacopy( &s_addr.l2_bdaddr, BDADDR_ANY );
s_addr.l2_psm = L2CAP_PSM_ANY;

bind(s, (struct sockaddr *)&s_addr, sizeof(s_addr) );

struct sockaddr_l2 local_addr;
struct socklen_t addr_len = sizeof(local_addr);
getsockname( s, (struct sockaddr *)&local_addr, &addr_len);
int psm = btohs( local_addr.l2_psm );

// register service with SDP using dynamic psm


Is this possible with bluez?  Or do I have to do the ugly thing and
pick an arbitrary psm?

thanks!
-albert


-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver
higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] can bluez dynamically allocate l2cap psm?
  2004-05-12  1:17 [Bluez-devel] can bluez dynamically allocate l2cap psm? Albert Huang
@ 2004-05-12  9:17 ` Stephen Crane
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Crane @ 2004-05-12  9:17 UTC (permalink / raw)
  To: albert; +Cc: bluez-devel

Hi Albert,
At the moment you have to cycle through the available PSMs trying to
bind to each one. BlueZ sockets don't yet support binding to PSM_ANY.

Steve

On Wed, 2004-05-12 at 02:17, Albert Huang wrote:
> I want a simple client/server that operates as follows.
> 
> server listens for l2cap connections.  accepts a connection, does
> something with it.
> 
> client discovers server by entering inquiry mode and then checking SDP
> records for service id of the server.
> 
> I don't want to hard-code the l2cap psm, as that seems like it defeats
> half the point of SDP, but I can't figure out how to request a dynamic
> psm.  I want to be able to do somethiing like this:
> 
> int s;
> struct sockaddr_l2 s_addr;
> s = socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP);
> 
> s_addr.l2_family = AF_BLUETOOTH;
> bacopy( &s_addr.l2_bdaddr, BDADDR_ANY );
> s_addr.l2_psm = L2CAP_PSM_ANY;
> 
> bind(s, (struct sockaddr *)&s_addr, sizeof(s_addr) );
> 
> struct sockaddr_l2 local_addr;
> struct socklen_t addr_len = sizeof(local_addr);
> getsockname( s, (struct sockaddr *)&local_addr, &addr_len);
> int psm = btohs( local_addr.l2_psm );
> 
> // register service with SDP using dynamic psm
> 
> 
> Is this possible with bluez?  Or do I have to do the ugly thing and
> pick an arbitrary psm?
> 
> thanks!
> -albert
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by Sleepycat Software
> Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver
> higher performing products faster, at low TCO.
> http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
> _______________________________________________
> Bluez-devel mailing list
> Bluez-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
-- 
Stephen Crane, Rococo Software Ltd. http://www.rococosoft.com
steve.crane@rococosoft.com +353-1-6601315 (ext 209)



-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver
higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

end of thread, other threads:[~2004-05-12  9:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-12  1:17 [Bluez-devel] can bluez dynamically allocate l2cap psm? Albert Huang
2004-05-12  9:17 ` Stephen Crane

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