All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandros Karypidis <karypid@inf.uth.gr>
To: Marcel Holtmann <marcel@rvs.uni-bielefeld.de>,
	Max Krasnyansky <maxk@qualcomm.com>
Cc: bluez-devel@lists.sourceforge.net
Subject: Re: [Bluez-devel] Re: [Bluez-users] How do I obtain a free PSM automatically?
Date: Tue, 11 Feb 2003 19:26:14 +0200	[thread overview]
Message-ID: <200302111926.14743.karypid@inf.uth.gr> (raw)
In-Reply-To: <1044964883.19214.46.camel@linux>

On Tuesday 11 February 2003 14:01, Marcel Holtmann wrote:

> > Now if people really want dynamic PSMs. We could introduce something like
> > bind(psm == 0xffff).
>
> I think this is not a good idea, because 0xffff is a valid PSM according
> to the spec.

That is true. A simple problem that may arrise is that, suppose I write a 
program which binds to PSM 0xffff. This is my PSM of choice and I am not 
using BlueZ. However, if I try to port my program to a Linux architecture 
which uses BlueZ, my program may compile but will not run correctly. BlueZ 
would redirect it to another PSM ands clients would make connection attempts 
to 0xffff which would fail.

> But what about bind it with PSM 0 and the listen call assign a dynamic
> PSM if it is bind with PSM 0 ?

That is what I was suggesting BUT: in IP, there is no way that a conneted 
socket will ever return port==0. This is why it may be used as a special 
value for bind().

In BT however, there is no "illegal" PSM value. I do not know this, but Max 
mentioned that a client by default uses PSM zero if he does not specify one. 
Indeed, in the test I mentioned in previous e-mails, using getsockname() will 
return PSM 0 when you connect() without previously calling bind(). Plus, one 
may explicitly bind() to PSM==0 and then connect() on the basis of current 
behavior and instead get another PSM because of this change. Quoting Max:

"Currently psm zero means that socket doesn't have PSM assigned to it.
bind(psm==0) means that application doesn't need PSM it's simply wants to 
bind it's socket to some BD address. Which is exactly what L2CAP clients need.
So you proposing a change that will brake current bind() interface. Well I 
guess it won't really break it but it will allocated PSM for all client apps 
which doesn't make any sense."

An alternative which I may suggest is to define a socket option which may be 
set using setsockopt(), previously to calling bind(). Then, one might do this 
via:

	enable = 1;
	s = socket (...);
	setsockopt (s, SOL_SOCKET, BT_DYNAMIC_PSM, &enable, sizeof(enable));
	bind (s, ... );

-- 
To err is human, but to forgive is beyond the scope of the Operating System...

Alexandros Karypidis
University of Thessaly
Computer & Communications Engineering dept.

  reply	other threads:[~2003-02-11 17:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200302071951.35073.karypid@inf.uth.gr>
     [not found] ` <1044653120.32671.4.camel@pegasus.local>
2003-02-08 11:42   ` [Bluez-users] How do I obtain a free PSM automatically? Stephen Crane
     [not found] ` <200302072329.21333.karypid@inf.uth.gr>
     [not found]   ` <1044653775.32672.14.camel@pegasus.local>
2003-02-08 15:40     ` Alexandros Karypidis
2003-02-08 16:14       ` [Bluez-devel] " Alexandros Karypidis
2003-02-10 21:13         ` Max Krasnyansky
2003-02-11 12:01           ` Marcel Holtmann
2003-02-11 17:26             ` Alexandros Karypidis [this message]
2003-02-11 17:52               ` Maksim Yevmenkin
2003-02-11 18:58               ` Max Krasnyansky
2003-02-11 18:06             ` Max Krasnyansky
2003-02-17 14:12               ` Marcel Holtmann
2003-02-18 21:06                 ` Max Krasnyansky
2003-02-18 23:00                   ` Marcel Holtmann
2003-02-19 20:04                     ` Max Krasnyansky
2003-02-11 16:30           ` Alexandros Karypidis
2003-02-10 20:49       ` Max Krasnyansky
2003-02-11 16:22         ` Alexandros Karypidis
2003-02-11 18:04           ` [Bluez-devel] " Maksim Yevmenkin
2003-02-11 18:52             ` Max Krasnyansky
2003-02-11 20:01               ` Maksim Yevmenkin
2003-02-11 21:09                 ` Max Krasnyansky
2003-02-11 18:23           ` [Bluez-devel] Re: [Bluez-users] " Max Krasnyansky

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=200302111926.14743.karypid@inf.uth.gr \
    --to=karypid@inf.uth.gr \
    --cc=bluez-devel@lists.sourceforge.net \
    --cc=marcel@rvs.uni-bielefeld.de \
    --cc=maxk@qualcomm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.