2005-01-10 18:36:02

by soraberri

[permalink] [raw]
Subject: [Bluez-devel] baswap neccesity

Hi

I'm reading rctest.c:
In do_connect function, a call to bswap is used just before the connect
call:
baswap(&rem_addr.rc_bdaddr, strtoba(svr));

In the server, baswap is again called just after the accept call

Why is it neccesary? Why does the server listening at the other side
expect addresses in such byte ordering?

mmm, again thank you for your time (sometimes I feel like trying to slow
down a bit your work would enable me to get up to date, but it's
useless, the rate of events is dramatic and you always reemerge... ;-) )



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel


2005-01-11 09:59:01

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] Re: baswap neccesity

Hi,

> >>I'm reading rctest.c:
> >>In do_connect function, a call to bswap is used just before the connect
> >>call:
> >> baswap(&rem_addr.rc_bdaddr, strtoba(svr));
> >>
> >>In the server, baswap is again called just after the accept call
> >>
> >>Why is it neccesary? Why does the server listening at the other side
> >>expect addresses in such byte ordering?
> >
> >
> > this is part of the specification. The textual representation and the
> > over-air BD_ADDR is swapped.
> >
> > However the code above has a memory leak. Where do you found it?
> this piece of code is from the 'bluez-utils-2.13.tar.gz' package which
> is downloadable now at the web site. Precisely in function 'int
> do_connect(char *svr)' of rctest.c.
> It's curious, I'm sure you'd see memory leaks where I only see flowers!

the strtoba() allocates memory that is never freed. The correct way of
doing this address swapping and converting from a string is:

str2ba(svr, &rem_addr.rc_bdaddr);

Regards

Marcel




-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-01-11 08:52:07

by soraberri

[permalink] [raw]
Subject: [Bluez-devel] Re: baswap neccesity

Hello Marcel,

Marcel Holtmann wrote:
> Hi,
>
>
>>I'm reading rctest.c:
>>In do_connect function, a call to bswap is used just before the connect
>>call:
>> baswap(&rem_addr.rc_bdaddr, strtoba(svr));
>>
>>In the server, baswap is again called just after the accept call
>>
>>Why is it neccesary? Why does the server listening at the other side
>>expect addresses in such byte ordering?
>
>
> this is part of the specification. The textual representation and the
> over-air BD_ADDR is swapped.
>
> However the code above has a memory leak. Where do you found it?
this piece of code is from the 'bluez-utils-2.13.tar.gz' package which
is downloadable now at the web site. Precisely in function 'int
do_connect(char *svr)' of rctest.c.
It's curious, I'm sure you'd see memory leaks where I only see flowers!

thanks Marcel



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-01-10 20:27:02

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [Bluez-devel] baswap neccesity

Hi,

> I'm reading rctest.c:
> In do_connect function, a call to bswap is used just before the connect
> call:
> baswap(&rem_addr.rc_bdaddr, strtoba(svr));
>
> In the server, baswap is again called just after the accept call
>
> Why is it neccesary? Why does the server listening at the other side
> expect addresses in such byte ordering?

this is part of the specification. The textual representation and the
over-air BD_ADDR is swapped.

However the code above has a memory leak. Where do you found it?

> mmm, again thank you for your time (sometimes I feel like trying to slow
> down a bit your work would enable me to get up to date, but it's
> useless, the rate of events is dramatic and you always reemerge... ;-) )

Sorry for that ;)

Regards

Marcel




-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2005-01-10 18:47:52

by Till Harbaum

[permalink] [raw]
Subject: Re: [SPAM?]: [Bluez-devel] baswap neccesity

Hi,

On Monday 10 January 2005 19:36, soraberri wrote:
> Why is it neccesary? Why does the server listening at the other side
> expect addresses in such byte ordering?
It's not the server on the other side but the local bluetooth chip that wants
to receive the address in the reverse order. If you want to know why this is
you'll probably have to ask someone from the Bluetooth SIG.

Till

--
Dr.-Ing. Till Harbaum Tel.: +49 721 4998963
BeeCon GmbH Fax: +49 721 4998962
Haid-und-Neu Strasse 7, 76131 Karlsruhe Mobil: +49 179 9087904
[email protected] http://www.beecon.de


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel