2006-10-11 11:01:23

by Andrea Carlevato

[permalink] [raw]
Subject: [Bluez-devel] How extract client address on server ??

Hello,
i ve a very simple question. I got a simple obex server code that runs
fine.I ve taken the obexserver sample souce code as a tamplate. Question is:
how/where can i get, on my server, the bt address of the client ??

thanks a lot

Andrea


Attachments:
(No filename) (244.00 B)
(No filename) (264.00 B)
(No filename) (373.00 B)
(No filename) (164.00 B)
Download all attachments

2006-10-11 14:33:25

by Peter Wippich

[permalink] [raw]
Subject: Re: [Bluez-devel] How extract client address on server ??


Hi Andrea,

On Wed, 11 Oct 2006, Andrea Carlevato wrote:

> including obex_main.h conflicts with the necessary inclusion in my code of
> <openobex/obex.h>...
> Moreover obex_main.h require all other header file of openobex libs to
> compile...
>
> is there any way to get out of all this ?
>
>
> grazie
> andrea

I'm afraid not an easy one. When I look into the source code (1.3) in
obex_const.h there is an obex_interface_t structure which for usb gives
you all information about the connection. However, for the case of a
Bluetooth transport it is "to be added" ..........

There is another function defined in obex.h which may give you what you
want (just found this) :

int OBEX_GetFD(obex_t *self);

You may try using the return value of this function as the fd for
getpeername(). Don't have any documentation for it.

Ciao,

Peter

>
>
>
>
>
>
>
> On 10/11/06, Peter Wippich <[email protected]> wrote:
> >
> >
> > Hi,
> >
> >
> > On Wed, 11 Oct 2006, Andrea Carlevato wrote:
> >
> > > ok,
> > > i get that stratcure as "handle" with this call:
> > >
> > > obex_t *handle = NULL;
> > > handle = OBEX_Init(OBEX_TRANS_BLUETOOTH, obex_event, 0);
> > > ....
> > > btobex_accept(handle);
> > >
> > > OK, but if i add this code:
> > >
> > > getpeername(handle->fd, &addr, &addr_len);
> > >
> > > my compiler gives me this error:
> > >
> > > > > > request for member 'fd' in something not a structure or union
> > >
> > >
> > > Do you wonder why ?
> > > thanks a lot
> > No ;-)
> >
> > You have to do something like this:
> >
> > #include "(path to file)/obex_main.h"
> >
> > .....
> >
> > getpeername( (struct obex *)handle->fd, ....)
> >
> > Ciao,
> >
> > Peter
> >
> >
> > >
> > >
> > >
> > >
> > >
> > > On 10/11/06, Peter Wippich <[email protected]> wrote:
> > > >
> > > >
> > > > Hi Andrea,
> > > >
> > > > On Wed, 11 Oct 2006, Andrea Carlevato wrote:
> > > >
> > > > > what do you mean with "obex structure" ? which structure are you
> > > > referring ?
> > > > >
> > > > > andrea
> > > >
> > > > The structure defined in lib/obex_main.h It is not exported directly
> > by
> > > > the api, as far as I can see. The OBEX_Init() shall return a pointer
> > to
> > > > such a structure (defined as a void * for the API). It is not realy
> > good
> > > > style to access internal structure of the library, but I can see no
> > > > "official" way to get the bd_addr of a remote client (but may be I
> > missed
> > > > something).
> > > >
> > > > Ciao,
> > > >
> > > > Peter
> > > >
> > > >
> > > >
> > > > | Peter Wippich Voice: +49 30
> > 46776411 |
> > > > | G&W Instruments GmbH fax: +49 30
> > 46776419 |
> > > > | Gustav-Meyer-Allee 25, Geb. 12 Email: [email protected]
> > |
> > > > | D-13355 Berlin /
> > Germany |
> > > >
> > > >
> > > >
> > -------------------------------------------------------------------------
> > > > Using Tomcat but need to do more? Need to support web services,
> > security?
> > > > Get stuff done quickly with pre-integrated technology to make your job
> > > > easier
> > > > Download IBM WebSphere Application Server v.1.0.1 based on Apache
> > Geronimo
> > > >
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > > > _______________________________________________
> > > > Bluez-devel mailing list
> > > > [email protected]
> > > > https://lists.sourceforge.net/lists/listinfo/bluez-devel
> > > >
> > >
> > >
> >
> >
> > | Peter Wippich Voice: +49 30 46776411 |
> > | G&W Instruments GmbH fax: +49 30 46776419 |
> > | Gustav-Meyer-Allee 25, Geb. 12 Email: [email protected] |
> > | D-13355 Berlin / Germany |
> >
> >
> > -------------------------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job
> > easier
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > _______________________________________________
> > Bluez-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/bluez-devel
> >
>
>


| Peter Wippich Voice: +49 30 46776411 |
| G&W Instruments GmbH fax: +49 30 46776419 |
| Gustav-Meyer-Allee 25, Geb. 12 Email: [email protected] |
| D-13355 Berlin / Germany |


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-10-11 14:02:59

by Andrea Carlevato

[permalink] [raw]
Subject: Re: [Bluez-devel] How extract client address on server ??

including obex_main.h conflicts with the necessary inclusion in my code of
<openobex/obex.h>...
Moreover obex_main.h require all other header file of openobex libs to
compile...

is there any way to get out of all this ?


grazie
andrea








On 10/11/06, Peter Wippich <[email protected]> wrote:
>
>
> Hi,
>
>
> On Wed, 11 Oct 2006, Andrea Carlevato wrote:
>
> > ok,
> > i get that stratcure as "handle" with this call:
> >
> > obex_t *handle = NULL;
> > handle = OBEX_Init(OBEX_TRANS_BLUETOOTH, obex_event, 0);
> > ....
> > btobex_accept(handle);
> >
> > OK, but if i add this code:
> >
> > getpeername(handle->fd, &addr, &addr_len);
> >
> > my compiler gives me this error:
> >
> > > > > request for member 'fd' in something not a structure or union
> >
> >
> > Do you wonder why ?
> > thanks a lot
> No ;-)
>
> You have to do something like this:
>
> #include "(path to file)/obex_main.h"
>
> .....
>
> getpeername( (struct obex *)handle->fd, ....)
>
> Ciao,
>
> Peter
>
>
> >
> >
> >
> >
> >
> > On 10/11/06, Peter Wippich <[email protected]> wrote:
> > >
> > >
> > > Hi Andrea,
> > >
> > > On Wed, 11 Oct 2006, Andrea Carlevato wrote:
> > >
> > > > what do you mean with "obex structure" ? which structure are you
> > > referring ?
> > > >
> > > > andrea
> > >
> > > The structure defined in lib/obex_main.h It is not exported directly
> by
> > > the api, as far as I can see. The OBEX_Init() shall return a pointer
> to
> > > such a structure (defined as a void * for the API). It is not realy
> good
> > > style to access internal structure of the library, but I can see no
> > > "official" way to get the bd_addr of a remote client (but may be I
> missed
> > > something).
> > >
> > > Ciao,
> > >
> > > Peter
> > >
> > >
> > >
> > > | Peter Wippich Voice: +49 30
> 46776411 |
> > > | G&W Instruments GmbH fax: +49 30
> 46776419 |
> > > | Gustav-Meyer-Allee 25, Geb. 12 Email: [email protected]
> |
> > > | D-13355 Berlin /
> Germany |
> > >
> > >
> > >
> -------------------------------------------------------------------------
> > > Using Tomcat but need to do more? Need to support web services,
> security?
> > > Get stuff done quickly with pre-integrated technology to make your job
> > > easier
> > > Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> > >
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > > _______________________________________________
> > > Bluez-devel mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/bluez-devel
> > >
> >
> >
>
>
> | Peter Wippich Voice: +49 30 46776411 |
> | G&W Instruments GmbH fax: +49 30 46776419 |
> | Gustav-Meyer-Allee 25, Geb. 12 Email: [email protected] |
> | D-13355 Berlin / Germany |
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Bluez-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>


Attachments:
(No filename) (3.49 kB)
(No filename) (6.09 kB)
(No filename) (373.00 B)
(No filename) (164.00 B)
Download all attachments

2006-10-11 13:54:15

by Peter Wippich

[permalink] [raw]
Subject: Re: [Bluez-devel] How extract client address on server ??


Hi,


On Wed, 11 Oct 2006, Andrea Carlevato wrote:

> ok,
> i get that stratcure as "handle" with this call:
>
> obex_t *handle = NULL;
> handle = OBEX_Init(OBEX_TRANS_BLUETOOTH, obex_event, 0);
> ....
> btobex_accept(handle);
>
> OK, but if i add this code:
>
> getpeername(handle->fd, &addr, &addr_len);
>
> my compiler gives me this error:
>
> > > > request for member 'fd' in something not a structure or union
>
>
> Do you wonder why ?
> thanks a lot
No ;-)

You have to do something like this:

#include "(path to file)/obex_main.h"

.....

getpeername( (struct obex *)handle->fd, ....)

Ciao,

Peter


>
>
>
>
>
> On 10/11/06, Peter Wippich <[email protected]> wrote:
> >
> >
> > Hi Andrea,
> >
> > On Wed, 11 Oct 2006, Andrea Carlevato wrote:
> >
> > > what do you mean with "obex structure" ? which structure are you
> > referring ?
> > >
> > > andrea
> >
> > The structure defined in lib/obex_main.h It is not exported directly by
> > the api, as far as I can see. The OBEX_Init() shall return a pointer to
> > such a structure (defined as a void * for the API). It is not realy good
> > style to access internal structure of the library, but I can see no
> > "official" way to get the bd_addr of a remote client (but may be I missed
> > something).
> >
> > Ciao,
> >
> > Peter
> >
> >
> >
> > | Peter Wippich Voice: +49 30 46776411 |
> > | G&W Instruments GmbH fax: +49 30 46776419 |
> > | Gustav-Meyer-Allee 25, Geb. 12 Email: [email protected] |
> > | D-13355 Berlin / Germany |
> >
> >
> > -------------------------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job
> > easier
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > _______________________________________________
> > Bluez-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/bluez-devel
> >
>
>


| Peter Wippich Voice: +49 30 46776411 |
| G&W Instruments GmbH fax: +49 30 46776419 |
| Gustav-Meyer-Allee 25, Geb. 12 Email: [email protected] |
| D-13355 Berlin / Germany |


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-10-11 13:08:50

by Andrea Carlevato

[permalink] [raw]
Subject: Re: [Bluez-devel] How extract client address on server ??

ok,
i get that stratcure as "handle" with this call:

obex_t *handle = NULL;
handle = OBEX_Init(OBEX_TRANS_BLUETOOTH, obex_event, 0);
....
btobex_accept(handle);

OK, but if i add this code:

getpeername(handle->fd, &addr, &addr_len);

my compiler gives me this error:

>>> request for member 'fd' in something not a structure or union


Do you wonder why ?


thanks a lot





On 10/11/06, Peter Wippich <[email protected]> wrote:
>
>
> Hi Andrea,
>
> On Wed, 11 Oct 2006, Andrea Carlevato wrote:
>
> > what do you mean with "obex structure" ? which structure are you
> referring ?
> >
> > andrea
>
> The structure defined in lib/obex_main.h It is not exported directly by
> the api, as far as I can see. The OBEX_Init() shall return a pointer to
> such a structure (defined as a void * for the API). It is not realy good
> style to access internal structure of the library, but I can see no
> "official" way to get the bd_addr of a remote client (but may be I missed
> something).
>
> Ciao,
>
> Peter
>
>
>
> | Peter Wippich Voice: +49 30 46776411 |
> | G&W Instruments GmbH fax: +49 30 46776419 |
> | Gustav-Meyer-Allee 25, Geb. 12 Email: [email protected] |
> | D-13355 Berlin / Germany |
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Bluez-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>


Attachments:
(No filename) (1.84 kB)
(No filename) (3.15 kB)
(No filename) (373.00 B)
(No filename) (164.00 B)
Download all attachments

2006-10-11 12:56:36

by Peter Wippich

[permalink] [raw]
Subject: Re: [Bluez-devel] How extract client address on server ??


Hi Andrea,

On Wed, 11 Oct 2006, Andrea Carlevato wrote:

> what do you mean with "obex structure" ? which structure are you referring ?
>
> andrea

The structure defined in lib/obex_main.h It is not exported directly by
the api, as far as I can see. The OBEX_Init() shall return a pointer to
such a structure (defined as a void * for the API). It is not realy good
style to access internal structure of the library, but I can see no
"official" way to get the bd_addr of a remote client (but may be I missed
something).

Ciao,

Peter



| Peter Wippich Voice: +49 30 46776411 |
| G&W Instruments GmbH fax: +49 30 46776419 |
| Gustav-Meyer-Allee 25, Geb. 12 Email: [email protected] |
| D-13355 Berlin / Germany |


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-10-11 12:35:02

by Andrea Carlevato

[permalink] [raw]
Subject: Re: [Bluez-devel] How extract client address on server ??

what do you mean with "obex structure" ? which structure are you referring ?

andrea



On 10/11/06, Peter Wippich <[email protected]> wrote:
>
>
> Hello Andrea,
>
> On Wed, 11 Oct 2006, Andrea Carlevato wrote:
>
> > Sorry Peter but using openobex libs i ve no socket there, only an
> > handle...How can i use getpeername() if i ve no socket to pass it ???
> >
> >
> > andrea
> >
> I've not used Oben Obex so far. But when I look at the source code of
> btobex_listen / btobex_accept / btobex_connect_request use sockets for
> bluetooth communication. And the file descriptor inside the obex structure
> is a socket file descriptor. Also you have an obex_transport structure
> which should already contain the source / destination addresses (not sure
> if this is realy the bluetooth address for BT transport, just had a short
> look).
>
> Ciao,
>
> Peter
>
>
> | Peter Wippich Voice: +49 30 46776411 |
> | G&W Instruments GmbH fax: +49 30 46776419 |
> | Gustav-Meyer-Allee 25, Geb. 12 Email: [email protected] |
> | D-13355 Berlin / Germany |
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Bluez-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>


Attachments:
(No filename) (1.69 kB)
(No filename) (2.93 kB)
(No filename) (373.00 B)
(No filename) (164.00 B)
Download all attachments

2006-10-11 12:34:21

by Peter Wippich

[permalink] [raw]
Subject: Re: [Bluez-devel] How extract client address on server ??


Hello Andrea,

On Wed, 11 Oct 2006, Andrea Carlevato wrote:

> Sorry Peter but using openobex libs i ve no socket there, only an
> handle...How can i use getpeername() if i ve no socket to pass it ???
>
>
> andrea
>
I've not used Oben Obex so far. But when I look at the source code of
btobex_listen / btobex_accept / btobex_connect_request use sockets for
bluetooth communication. And the file descriptor inside the obex structure
is a socket file descriptor. Also you have an obex_transport structure
which should already contain the source / destination addresses (not sure
if this is realy the bluetooth address for BT transport, just had a short
look).

Ciao,

Peter


| Peter Wippich Voice: +49 30 46776411 |
| G&W Instruments GmbH fax: +49 30 46776419 |
| Gustav-Meyer-Allee 25, Geb. 12 Email: [email protected] |
| D-13355 Berlin / Germany |


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

2006-10-11 12:15:54

by Andrea Carlevato

[permalink] [raw]
Subject: Re: [Bluez-devel] How extract client address on server ??

Sorry Peter but using openobex libs i ve no socket there, only an
handle...How can i use getpeername() if i ve no socket to pass it ???


andrea


On 10/11/06, Peter Wippich <[email protected]> wrote:
>
>
> Hi Andrea,
>
> usualy you use getpeername() to her the remote address of a socket.
>
> Ciao,
>
> Peter
>
> On Wed, 11 Oct 2006, Andrea Carlevato wrote:
>
> > Hello,
> > i ve a very simple question. I got a simple obex server code that runs
> > fine.I ve taken the obexserver sample souce code as a tamplate. Question
> is:
> > how/where can i get, on my server, the bt address of the client ??
> >
> > thanks a lot
> >
> > Andrea
> >
> >
>
>
> | Peter Wippich Voice: +49 30 46776411 |
> | G&W Instruments GmbH fax: +49 30 46776419 |
> | Gustav-Meyer-Allee 25, Geb. 12 Email: [email protected] |
> | D-13355 Berlin / Germany |
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Bluez-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>


Attachments:
(No filename) (1.49 kB)
(No filename) (2.73 kB)
(No filename) (373.00 B)
(No filename) (164.00 B)
Download all attachments

2006-10-11 11:08:58

by Peter Wippich

[permalink] [raw]
Subject: Re: [Bluez-devel] How extract client address on server ??


Hi Andrea,

usualy you use getpeername() to her the remote address of a socket.

Ciao,

Peter

On Wed, 11 Oct 2006, Andrea Carlevato wrote:

> Hello,
> i ve a very simple question. I got a simple obex server code that runs
> fine.I ve taken the obexserver sample souce code as a tamplate. Question is:
> how/where can i get, on my server, the bt address of the client ??
>
> thanks a lot
>
> Andrea
>
>


| Peter Wippich Voice: +49 30 46776411 |
| G&W Instruments GmbH fax: +49 30 46776419 |
| Gustav-Meyer-Allee 25, Geb. 12 Email: [email protected] |
| D-13355 Berlin / Germany |


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel