public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Albert Huang <ashuang@gmail.com>
To: bluez-devel@lists.sourceforge.net
Subject: [Bluez-devel] can bluez dynamically allocate l2cap psm?
Date: Tue, 11 May 2004 21:17:29 -0400	[thread overview]
Message-ID: <ef9938ec04051118174f3302f3@mail.gmail.com> (raw)

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

             reply	other threads:[~2004-05-12  1:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-12  1:17 Albert Huang [this message]
2004-05-12  9:17 ` [Bluez-devel] can bluez dynamically allocate l2cap psm? Stephen Crane

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ef9938ec04051118174f3302f3@mail.gmail.com \
    --to=ashuang@gmail.com \
    --cc=albert@csail.mit.edu \
    --cc=bluez-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox