Skip to contentSkip to conversation

baswap neccesity

Bluez-devel soraberri 3 participants 5 messages Jan 10, 2005 – Jan 11, 2005 Bluetooth drivers

lore
Share & tools
lore

soraberri

author
#0 lore raw

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

#1 lore raw

Re: [SPAM?]: [Bluez-devel] baswap neccesity

Hi,

Quoted 2 lines · soraberri

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

Signature · 14 lines
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
maintainer
#2 lore raw
In reply to soraberri

Hi,

Quoted 9 lines

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?

Quoted 3 lines

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

author
#3 lore raw

Hello Marcel,

Quoted 9 lines · Marcel Holtmann

Hi,

Quoted 6 lines

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

Quoted 7 lines
Quoted 1 line

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

maintainer
#4 lore raw

Hi,

Quoted 11 lines
Quoted 11 lines
Quoted 9 lines

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?

Quoted 8 lines
Quoted 4 lines

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