Christopher Kohlhoff | 20 Jun 04:50 2008

Re: enumerating IP addresses

Carlos Rafael Giani wrote:
> but I thought that asio can do this?
> I prefer an asio solution, since it is a layer over the 
> platform-dependent issues after all. But if asio does NOT support it, 
> then I have no choice but to go platform dependent.

It's something I hope to support in the future, but it isn't right now.

Cheers,
Chris

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
Arvid Norberg | 20 Jun 09:29 2008
Picon
Picon

Re: enumerating IP addresses

Christopher Kohlhoff wrote:
> Carlos Rafael Giani wrote:
>   
>> but I thought that asio can do this?
>> I prefer an asio solution, since it is a layer over the 
>> platform-dependent issues after all. But if asio does NOT support it, 
>> then I have no choice but to go platform dependent.
>>     
>
> It's something I hope to support in the future, but it isn't right now.
>   
Chris, I would be more than happy to provide you with code to do this on 
linux, Mac and windows. I think the hard part is to come up with a 
unified API at a low enough level though. The different platforms 
provide different information.

--
Arvid Norberg

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
James Talbut | 20 Jun 11:08 2008

Re: enumerating IP addresses

We also have a solution for Mac, Intel and Linux.
It returns a vector of objects, with members functions returning:
1. NIC Identifier
2. NIC name (this is only different from identifier on windows)
3. MAC address
4. vector of IP addresses.

Making it more complete than that really does run into cross platform
problems.

Jim

> -----Original Message-----
> From: asio-users-bounces@... 
> [mailto:asio-users-bounces@...] On Behalf 
> Of Arvid Norberg
> Sent: 20 June 2008 08:30
> To: asio-users@...
> Subject: Re: [asio-users] enumerating IP addresses
> 
> Christopher Kohlhoff wrote:
> > Carlos Rafael Giani wrote:
> >   
> >> but I thought that asio can do this?
> >> I prefer an asio solution, since it is a layer over the 
> >> platform-dependent issues after all. But if asio does NOT 
> support it, 
> >> then I have no choice but to go platform dependent.
> >>     
> >
(Continue reading)

Simon Perreault | 20 Jun 14:30 2008
Picon

Re: enumerating IP addresses

On Friday 20 June 2008 05:08:52 James Talbut wrote:
> We also have a solution for Mac, Intel and Linux.
> It returns a vector of objects, with members functions returning:
> 1. NIC Identifier
> 2. NIC name (this is only different from identifier on windows)
> 3. MAC address
> 4. vector of IP addresses.

I'm also *very* interested in having such functionality in asio.

Don't know if it is possible, but it would be nice to also return the scope ID 
for an interface. You know, the IPv6 scope ID for link-local addresses... I 
guess you could always extract that from the vector of IP addresses since 
exactly one of them should be in the IPv6 link-local prefix.

Also, since nobody mentioned it, there is getifaddrs() available on Linux, 
BSD, Mac OS X. Higher-level than ioctl() and easier to use. On my Fedora 
system, it returns a linked list of structures containing:

- NIC name
- Flags as from SIOCGIFFLAGS ioctl
- Network address in a sockaddr*
- Netmask in a sockaddr*
- Broadcast address or point-to-point address, if applicable

When an interface has multiple addresses, multiple such structures are 
returned with the same NIC name.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
(Continue reading)

James Talbut | 20 Jun 14:37 2008

Re: enumerating IP addresses

Scope is part of sockaddr_in6 (on Windows, at least) and should be easy
to get.
I'm using getifaddrs on Linux and Mac, unfortunately it still requires a
bit of #ifdef work, but it's the best I've found.

Jim

> -----Original Message-----
> From: asio-users-bounces@... 
> [mailto:asio-users-bounces@...] On Behalf 
> Of Simon Perreault
> Sent: 20 June 2008 13:31
> To: asio-users@...
> Subject: Re: [asio-users] enumerating IP addresses
> 
> On Friday 20 June 2008 05:08:52 James Talbut wrote:
> > We also have a solution for Mac, Intel and Linux.
> > It returns a vector of objects, with members functions returning:
> > 1. NIC Identifier
> > 2. NIC name (this is only different from identifier on 
> windows) 3. MAC 
> > address 4. vector of IP addresses.
> 
> I'm also *very* interested in having such functionality in asio.
> 
> Don't know if it is possible, but it would be nice to also 
> return the scope ID for an interface. You know, the IPv6 
> scope ID for link-local addresses... I guess you could always 
> extract that from the vector of IP addresses since exactly 
> one of them should be in the IPv6 link-local prefix.
(Continue reading)

Christopher Kohlhoff | 25 Jun 02:02 2008

Re: enumerating IP addresses

Simon Perreault wrote:
> Don't know if it is possible, but it would be nice to also return the scope ID 
> for an interface. You know, the IPv6 scope ID for link-local addresses... I 
> guess you could always extract that from the vector of IP addresses since 
> exactly one of them should be in the IPv6 link-local prefix.

Assuming the scope ID of an interface can be determined from the OS, the 
ip::address_v6 already provides a data member to store it.

Cheers,
Chris

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
Christopher Kohlhoff | 25 Jun 01:58 2008

Re: enumerating IP addresses

Arvid Norberg wrote:
> Christopher Kohlhoff wrote:
>> Carlos Rafael Giani wrote:
>>   
>>> but I thought that asio can do this?
>>> I prefer an asio solution, since it is a layer over the 
>>> platform-dependent issues after all. But if asio does NOT support it, 
>>> then I have no choice but to go platform dependent.
>>>     
>> It's something I hope to support in the future, but it isn't right now.
>>   
> Chris, I would be more than happy to provide you with code to do this on 
> linux, Mac and windows. I think the hard part is to come up with a 
> unified API at a low enough level though. The different platforms 
> provide different information.

Awesome. I presume it's somewhere in the libtorrent repository? I'll 
take a look at adding something for the post-boost-1.36/post-asio-1.2.x 
timeframe. At the moment I'm thinking some sort of iterator 
(ip::interface_iterator?) but will need to experiment a bit first.

Cheers,
Chris

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
(Continue reading)

Arvid Norberg | 25 Jun 08:04 2008
Picon
Picon

Re: enumerating IP addresses

Christopher Kohlhoff wrote:
> Arvid Norberg wrote:
>   
>> Christopher Kohlhoff wrote:
>>     
>>> Carlos Rafael Giani wrote:
>>>   
>>>       
>>>> but I thought that asio can do this?
>>>> I prefer an asio solution, since it is a layer over the 
>>>> platform-dependent issues after all. But if asio does NOT support it, 
>>>> then I have no choice but to go platform dependent.
>>>>     
>>>>         
>>> It's something I hope to support in the future, but it isn't right now.
>>>   
>>>       
>> Chris, I would be more than happy to provide you with code to do this on 
>> linux, Mac and windows. I think the hard part is to come up with a 
>> unified API at a low enough level though. The different platforms 
>> provide different information.
>>     
>
> Awesome. I presume it's somewhere in the libtorrent repository?
Yeah, there's an enum_net.cpp. I'm not entirely happy with the interface 
though.
> I'll 
> take a look at adding something for the post-boost-1.36/post-asio-1.2.x 
> timeframe. At the moment I'm thinking some sort of iterator 
> (ip::interface_iterator?) but will need to experiment a bit first.
(Continue reading)


Gmane