Author: axeld Date: 2010-12-10 00:42:19 +0100 (Fri, 10 Dec 2010) New Revision: 39793 Changeset: http://dev.haiku-os.org/changeset/39793 Modified: haiku/trunk/src/kits/network/libnetapi/NetworkAddress.cpp haiku/trunk/src/kits/network/libnetapi/NetworkDevice.cpp Log: * 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. Modified: haiku/trunk/src/kits/network/libnetapi/NetworkAddress.cpp =================================================================== --- haiku/trunk/src/kits/network/libnetapi/NetworkAddress.cpp 2010-12-09 22:33:34 UTC (rev 39792) +++ haiku/trunk/src/kits/network/libnetapi/NetworkAddress.cpp 2010-12-09 23:42:19 UTC (rev 39793) @@ -1117,6 +1117,17 @@ sizeof(address.sin6_addr)); break; } + + case AF_LINK: + if (LinkLevelAddressLength() < other.LinkLevelAddressLength()) + return true; + if (LinkLevelAddressLength() > other.LinkLevelAddressLength()) + return true; + + // TODO: could compare index, and name, too + compare = memcmp(LinkLevelAddress(), other.LinkLevelAddress(), + LinkLevelAddressLength()); + break; } if (compare < 0) Modified: haiku/trunk/src/kits/network/libnetapi/NetworkDevice.cpp =================================================================== --- haiku/trunk/src/kits/network/libnetapi/NetworkDevice.cpp 2010-12-09 22:33:34 UTC (rev 39792) +++ haiku/trunk/src/kits/network/libnetapi/NetworkDevice.cpp 2010-12-09 23:42:19 UTC (rev 39793) @@ -64,44 +64,7 @@ } -#if 0 -static status_t -set_80211(const char* name, int32 type, void* data, - int32 length = 0, int32 value = 0) -{ - int socket = ::socket(AF_INET, SOCK_DGRAM, 0); - if (socket < 0) - return errno; - - FileDescriptorCloser closer(socket); - - struct ieee80211req ireq; - strlcpy(ireq.i_name, name, IF_NAMESIZE); - ireq.i_type = type; - ireq.i_val = value; - ireq.i_len = length; - ireq.i_data = data; - - if (ioctl(socket, SIOCS80211, &ireq, sizeof(struct ieee80211req)) < 0) - return errno; - - return B_OK; -} - - template<typename T> status_t -set_80211(const char* name, int32 type, T& data, int32 length = 0, - int32 value = 0) -{ - if (length == 0) - length = sizeof(T); - - return set_80211(name, &data, length, value); -} -#endif - - -template<typename T> status_t do_request(T& request, const char* name, int option) { int socket = ::socket(AF_LINK, SOCK_DGRAM, 0);