History log of /haiku/src/kits/network/libnetapi/NetworkAddress.cpp
Revision Date Author Comments
# 71312468 23-Nov-2017 Augustin Cavalier <waddlesplash@gmail.com>

BNetworkAddress: Close socket in ResolveForDestination.

It was closed on all the failure cases but not on the success one.
Found by Coverity.


# e1c98cea 22-May-2016 Mark Hellegers <mark@firedisk.net>

Add support for TLS SNI

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>


# 1c620237 29-Jul-2015 Augustin Cavalier <waddlesplash@gmail.com>

NetworkAddress: Fix things yet again.

If I had used my head instead of blindly c&p'ing the suggested code
from Axel's message, I would have realized that Unset() unsets fStatus
too. Not a bright thing to do on my part...


# 1690d2f4 29-Jul-2015 Augustin Cavalier <waddlesplash@gmail.com>

BNetworkAddress: Fix review comments (again).

Axel changed his mind about the status on Unset(), and I messed
up the fStatus setters.


# d682f9fc 28-Jul-2015 Augustin Cavalier <waddlesplash@gmail.com>

BNetworkAddress: Address review comments.

Thanks Axel and Rene!


# 71b756a0 27-Jul-2015 Augustin Cavalier <waddlesplash@gmail.com>

BNetworkAddress: Fix setting fStatus all over the place.

Relevant quote from IRC:
<pdziepak> i would expect all overloads of SetTo to return status_t
<pdziepak> actually, i don't think what i would expect from class with such interface
<pdziepak> bugs probably


# f972422c 14-Jun-2015 Adrien Destugues <pulkomandy@gmail.com>

Add a simple DNS caching system to BNetworkAddress

netresolv (and libbind) won't cache DNS requests, which can result in a
lot of DNS requests being made for the same host. Implement a simple
cache in RAM (local to each application) which will keep the most
recently requested addresses cached. This can speed up loading of an
HTTP page a lot, by saving a DNS request for each resource stored on the
same server as the main page.


# d0444575 23-Mar-2015 Axel Dörfler <axeld@pinc-software.de>

BNetworkAddress::IsEmpty() now detects empty ipv4/6.

* Until now, only AF_UNSPEC addresses could be empty.
* Now, the unspecified IPV4/IPv6 address is considered empty, too.
* This corresponds to how the kernel modules handles this.


# 77206143 05-Feb-2015 Axel Dörfler <axeld@pinc-software.de>

Revert "Move getifaddrs to libnetwork again."

This reverts commit 31ea76548a64b232ed10cb444bf84ca1f7e40b0f.

Adrien, please try again without clobbering the otherwise nice
BNetworkInterface API!

Conflicts:
src/kits/network/getifaddrs.cpp


# 31ea7654 20-Jan-2015 Adrien Destugues <pulkomandy@gmail.com>

Move getifaddrs to libnetwork again.

* BNetworkInterfaceAddress is moved to libnetwork. It is modified to not
use BNetworkAddress (which is in libbnetapi) and instead use sockaddr
and sockaddr_storage directly. All callers are adjusted to this.
* Some support code is shared between BNetworkInterface and
BNetworkInterfaceAddress, move it to libnetwork but in the BPrivate
namespace.


# 754bbf48 26-Nov-2013 Jérôme Duval <jerome.duval@gmail.com>

libnetapi: second pass of style cleanup

* remarks from Axel


# a3c07906 26-Sep-2013 Axel Dörfler <axeld@pinc-software.de>

BNetworkAddress: accept NULL link address strings.


# ddf57b6c 18-Feb-2011 Axel Dörfler <axeld@pinc-software.de>

* Reverted back to the original version of BNetworkAddress::SetAddress();
in_addr_t is now in network endian again. Thanks, Philippe!
* Made SetToLoopback(), and SetToLocal() a bit more useful (although the latter
isn't implemented yet).
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40552 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 448e9976 11-Feb-2011 Axel Dörfler <axeld@pinc-software.de>

* We need to convert the endian of the passed in IPv4 address.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40453 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 96a8b92d 05-Feb-2011 Alexander von Gluck IV <kallisti5@unixzen.com>

cleanup of some bad language and style within bitfield counting optimization as per axel; made addr_bitcount static

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40362 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0d6862d9 04-Feb-2011 Alexander von Gluck IV <kallisti5@unixzen.com>

added optimized gcc builtin bit population count as per Axel's recommendation; the optimized function might be used for the ipv6 netmask length as well.. i just don't want to touch that double for loop without *LOTS* of testing; lets hope this isn't my first build-breaker

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40360 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0a8ad865 09-Dec-2010 Axel Dörfler <axeld@pinc-software.de>

* Implemented operator<() for AF_LINK addresses as well; now NetworkStatus
actually marks the currently associated network.
* Removed unused code from NetworkDevice.cpp - doesn't look like we're going
to use it anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39793 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8faecc1d 08-Dec-2010 Axel Dörfler <axeld@pinc-software.de>

* Added ability to parse link level addresses.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39779 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d5a09773 08-Dec-2010 Axel Dörfler <axeld@pinc-software.de>

* Fixed size of sdl_type/sdl_e_type, the former is only a uint8, and the latter
a uint16.
* sdl_e_type is stored in network order now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39778 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1691b94f 01-Dec-2010 Axel Dörfler <axeld@pinc-software.de>

* Implemented link level setters.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39695 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 19b4490f 01-Dec-2010 Axel Dörfler <axeld@pinc-software.de>

* The constructors weren't defined in declaration order.
* Unflatten() will now check whether the size of the buffer was large enough
to hold a valid address.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39693 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e6cec983 29-Nov-2010 Axel Dörfler <axeld@pinc-software.de>

* BNetworkAddress isn't really BArchivable material, switched to BFlattenable
instead.
* Also actually implemented the serializing functionality this time, as usual
completely untested, though :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39677 a95241bf-73f2-0310-859d-f6bbb57e9c96


# de739bbe 24-Nov-2010 Philippe Houdoin <philippe.houdoin@gmail.com>

Factorized a bit more, and update fStatus in some place it was missing
but make sense. Please review.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39612 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3342fa76 24-Nov-2010 Philippe Houdoin <philippe.houdoin@gmail.com>

Make SetToWildcard() actually set address to wildcard one.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39606 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1c9ad669 24-Nov-2010 Philippe Houdoin <philippe.houdoin@gmail.com>

Set AF_INET broadcast sockaddr length.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39605 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6a758693 23-Nov-2010 Axel Dörfler <axeld@pinc-software.de>

* Added SetAddress() methods for IPv4, and IPv6 addresses.
* Improved API.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39590 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 28de0904 18-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Added non-const sockaddr casts.
* Automatic whitespace cleanup.
* This also fixes the build; I wanted to commit this earlier.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38237 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 31a49a69 12-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Added support for printing AF_LINK addresses.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38055 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 836c43f2 12-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Factored out a BNetworkAddressResolver from BNetworkAddress, that also allows
to iterate over all possible addresses, as suggested privately by Rene.
* Added flags to the resolving methods that allow more control over the
addresses returned.
* Added setters to BNetworkAddress that accept a service name instead of port
number, renamed PortName() to ServiceName().
* Made the sockaddr* cast operators return a const sockaddr as it was supposed
to be, although I should probably add non-const ones as well.
* This also simplified the code somewhat.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38039 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 23f20732 11-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Implemented SetToMask(), and added PrefixLength() method, mostly reusing
code from ifconfig.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38026 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 54b6869f 11-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Forgot to implement the sockaddr* cast operator.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38023 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 719c4707 09-Aug-2010 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

Header defines the default value for Archive's second param. Fixes build bustage.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37992 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c2808ea7 09-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Adapted API as needed, and implemented most of the C++ API - it's completely
untested at this point, though.
* Will port ifconfig, NetworkStatus, and the Network preferences application
later in order to test the API.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37988 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bf58f252 06-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Adapted headers after Stippi's suggestions - I won't add the const until I
know how I implement that function :-)
* Cleaned up libbnetapi.so Jamfile, removed non-Haiku target code.
* Added empty files to the build to see that the headers are compiling.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37942 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1c62023701e174b5903110195259f01afdae8ca5 29-Jul-2015 Augustin Cavalier <waddlesplash@gmail.com>

NetworkAddress: Fix things yet again.

If I had used my head instead of blindly c&p'ing the suggested code
from Axel's message, I would have realized that Unset() unsets fStatus
too. Not a bright thing to do on my part...


# 1690d2f4ddac03b233361044b07d408fa0abdf8d 29-Jul-2015 Augustin Cavalier <waddlesplash@gmail.com>

BNetworkAddress: Fix review comments (again).

Axel changed his mind about the status on Unset(), and I messed
up the fStatus setters.


# d682f9fc9c601f22e08c2c04cfbb505eed844247 28-Jul-2015 Augustin Cavalier <waddlesplash@gmail.com>

BNetworkAddress: Address review comments.

Thanks Axel and Rene!


# 71b756a0546837050d004088c19fcb9a70a5558b 27-Jul-2015 Augustin Cavalier <waddlesplash@gmail.com>

BNetworkAddress: Fix setting fStatus all over the place.

Relevant quote from IRC:
<pdziepak> i would expect all overloads of SetTo to return status_t
<pdziepak> actually, i don't think what i would expect from class with such interface
<pdziepak> bugs probably


# f972422c66af92a5c6abf9852c904b92ea9255ea 14-Jun-2015 Adrien Destugues <pulkomandy@gmail.com>

Add a simple DNS caching system to BNetworkAddress

netresolv (and libbind) won't cache DNS requests, which can result in a
lot of DNS requests being made for the same host. Implement a simple
cache in RAM (local to each application) which will keep the most
recently requested addresses cached. This can speed up loading of an
HTTP page a lot, by saving a DNS request for each resource stored on the
same server as the main page.


# d044457531a731dd97533d611ea7bfd22fa920e4 23-Mar-2015 Axel Dörfler <axeld@pinc-software.de>

BNetworkAddress::IsEmpty() now detects empty ipv4/6.

* Until now, only AF_UNSPEC addresses could be empty.
* Now, the unspecified IPV4/IPv6 address is considered empty, too.
* This corresponds to how the kernel modules handles this.


# 7720614300ff86e823735adcb96690c822dd60f8 05-Feb-2015 Axel Dörfler <axeld@pinc-software.de>

Revert "Move getifaddrs to libnetwork again."

This reverts commit 31ea76548a64b232ed10cb444bf84ca1f7e40b0f.

Adrien, please try again without clobbering the otherwise nice
BNetworkInterface API!

Conflicts:
src/kits/network/getifaddrs.cpp


# 31ea76548a64b232ed10cb444bf84ca1f7e40b0f 20-Jan-2015 Adrien Destugues <pulkomandy@gmail.com>

Move getifaddrs to libnetwork again.

* BNetworkInterfaceAddress is moved to libnetwork. It is modified to not
use BNetworkAddress (which is in libbnetapi) and instead use sockaddr
and sockaddr_storage directly. All callers are adjusted to this.
* Some support code is shared between BNetworkInterface and
BNetworkInterfaceAddress, move it to libnetwork but in the BPrivate
namespace.


# 754bbf4866278ecd2da2c517560bc90c67a3a6f5 26-Nov-2013 Jérôme Duval <jerome.duval@gmail.com>

libnetapi: second pass of style cleanup

* remarks from Axel


# a3c0790695f5a7e318c65eeec5e18a2efea21597 26-Sep-2013 Axel Dörfler <axeld@pinc-software.de>

BNetworkAddress: accept NULL link address strings.


# ddf57b6cf65fe40299b8b7140bab10d305b5ce15 18-Feb-2011 Axel Dörfler <axeld@pinc-software.de>

* Reverted back to the original version of BNetworkAddress::SetAddress();
in_addr_t is now in network endian again. Thanks, Philippe!
* Made SetToLoopback(), and SetToLocal() a bit more useful (although the latter
isn't implemented yet).
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40552 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 448e9976cf973be0642c71c42d720e4e679d8618 11-Feb-2011 Axel Dörfler <axeld@pinc-software.de>

* We need to convert the endian of the passed in IPv4 address.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40453 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 96a8b92d21d63385beb7ec32bf1d43262e7a381a 05-Feb-2011 Alexander von Gluck IV <kallisti5@unixzen.com>

cleanup of some bad language and style within bitfield counting optimization as per axel; made addr_bitcount static

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40362 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0d6862d9b9f3868b5d29463a1e8f644ac6a6155f 04-Feb-2011 Alexander von Gluck IV <kallisti5@unixzen.com>

added optimized gcc builtin bit population count as per Axel's recommendation; the optimized function might be used for the ipv6 netmask length as well.. i just don't want to touch that double for loop without *LOTS* of testing; lets hope this isn't my first build-breaker

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40360 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0a8ad865de1af8292591f980c130a376ff6eb219 09-Dec-2010 Axel Dörfler <axeld@pinc-software.de>

* Implemented operator<() for AF_LINK addresses as well; now NetworkStatus
actually marks the currently associated network.
* Removed unused code from NetworkDevice.cpp - doesn't look like we're going
to use it anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39793 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8faecc1d5effa91c8f95c5dcabc3003c8bf3fa99 08-Dec-2010 Axel Dörfler <axeld@pinc-software.de>

* Added ability to parse link level addresses.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39779 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d5a09773bf7146c6a9727eaad3a0709c0d9aac50 08-Dec-2010 Axel Dörfler <axeld@pinc-software.de>

* Fixed size of sdl_type/sdl_e_type, the former is only a uint8, and the latter
a uint16.
* sdl_e_type is stored in network order now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39778 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1691b94fe3050ed66beb25b4c192852da2373270 01-Dec-2010 Axel Dörfler <axeld@pinc-software.de>

* Implemented link level setters.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39695 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 19b4490fd23f50b0eb154cb7580e92ae4a108113 01-Dec-2010 Axel Dörfler <axeld@pinc-software.de>

* The constructors weren't defined in declaration order.
* Unflatten() will now check whether the size of the buffer was large enough
to hold a valid address.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39693 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e6cec9839d45710cd9cb276212804b68ac39d7c2 29-Nov-2010 Axel Dörfler <axeld@pinc-software.de>

* BNetworkAddress isn't really BArchivable material, switched to BFlattenable
instead.
* Also actually implemented the serializing functionality this time, as usual
completely untested, though :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39677 a95241bf-73f2-0310-859d-f6bbb57e9c96


# de739bbef33567bc4555780e56e6f31ee14c6b41 24-Nov-2010 Philippe Houdoin <philippe.houdoin@gmail.com>

Factorized a bit more, and update fStatus in some place it was missing
but make sense. Please review.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39612 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3342fa76025d1303657f948234e0a28c98398607 24-Nov-2010 Philippe Houdoin <philippe.houdoin@gmail.com>

Make SetToWildcard() actually set address to wildcard one.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39606 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1c9ad66954b28b2c4a98975a9f2b99bb7a57748a 24-Nov-2010 Philippe Houdoin <philippe.houdoin@gmail.com>

Set AF_INET broadcast sockaddr length.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39605 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6a758693033c67eeada1e5911e307c7ab47df3f2 23-Nov-2010 Axel Dörfler <axeld@pinc-software.de>

* Added SetAddress() methods for IPv4, and IPv6 addresses.
* Improved API.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39590 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 28de0904dc85d031e430aca519738ac898577f8b 18-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Added non-const sockaddr casts.
* Automatic whitespace cleanup.
* This also fixes the build; I wanted to commit this earlier.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38237 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 31a49a69c73b5895ba20fd6b7aa00c7cc55e29e1 12-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Added support for printing AF_LINK addresses.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38055 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 836c43f2b8f7519aeccdc30ec2804d0c66d56df4 12-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Factored out a BNetworkAddressResolver from BNetworkAddress, that also allows
to iterate over all possible addresses, as suggested privately by Rene.
* Added flags to the resolving methods that allow more control over the
addresses returned.
* Added setters to BNetworkAddress that accept a service name instead of port
number, renamed PortName() to ServiceName().
* Made the sockaddr* cast operators return a const sockaddr as it was supposed
to be, although I should probably add non-const ones as well.
* This also simplified the code somewhat.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38039 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 23f20732159676c101b3383087b1016a0692d265 11-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Implemented SetToMask(), and added PrefixLength() method, mostly reusing
code from ifconfig.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38026 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 54b6869f514bbaf601c938c4294f5ecb49286a72 11-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Forgot to implement the sockaddr* cast operator.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38023 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 719c470746c45f4a74711df786b7a2a7b78894c9 09-Aug-2010 Fredrik Holmqvist <fredrik.holmqvist@gmail.com>

Header defines the default value for Archive's second param. Fixes build bustage.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37992 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c2808ea7b2da2e03373962bc413c3c1c73a70e59 09-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Adapted API as needed, and implemented most of the C++ API - it's completely
untested at this point, though.
* Will port ifconfig, NetworkStatus, and the Network preferences application
later in order to test the API.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37988 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bf58f252deedcb8b22e8f9a92ed9a1663f67a58d 06-Aug-2010 Axel Dörfler <axeld@pinc-software.de>

* Adapted headers after Stippi's suggestions - I won't add the const until I
know how I implement that function :-)
* Cleaned up libbnetapi.so Jamfile, removed non-Haiku target code.
* Added empty files to the build to see that the headers are compiling.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37942 a95241bf-73f2-0310-859d-f6bbb57e9c96