Changeset 19848
- Timestamp:
- 03/03/07 10:44:13 (2 years ago)
- Files:
-
- juggler/branches/2.0/modules/vapor/ChangeLog (modified) (1 diff)
- juggler/branches/2.0/modules/vapor/vpr/md/NSPR/IO/Socket/InetAddrNSPR.cpp (modified) (2 diffs)
- juggler/branches/2.0/modules/vapor/vpr/md/NSPR/IO/Socket/InetAddrNSPR.h (modified) (2 diffs)
- juggler/branches/2.0/modules/vapor/vpr/md/POSIX/IO/Socket/InetAddrBSD.cpp (modified) (2 diffs)
- juggler/branches/2.0/modules/vapor/vpr/md/POSIX/IO/Socket/InetAddrBSD.h (modified) (2 diffs)
- juggler/branches/2.0/modules/vapor/vpr/md/common/InetAddrHelpers.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
juggler/branches/2.0/modules/vapor/ChangeLog
r19815 r19848 1 1 DATE AUTHOR CHANGE 2 2 ---------- -------- ----------------------------------------------------------- 3 2007-03-03 patrick Allow callers of vpr::InetAddr::getAllLocalAddrs() to 4 indicate whether interfaces in the down state should be 5 considered. 6 3 7 [1.0.3 released - 2.14.2007]=================================================== 4 8 juggler/branches/2.0/modules/vapor/vpr/md/NSPR/IO/Socket/InetAddrNSPR.cpp
r18288 r19848 53 53 54 54 vpr::ReturnStatus getIfAddrs(std::vector<vpr::InetAddrNSPR>& hostAddrs, 55 const bool withLoopback); 55 const bool withLoopback, 56 const bool withDisabledNICs); 56 57 57 58 const InetAddrNSPR InetAddrNSPR::AnyAddr; // Default constructor defaults to ANY addr … … 74 75 vpr::ReturnStatus 75 76 InetAddrNSPR::getAllLocalAddrs(std::vector<vpr::InetAddrNSPR>& hostAddrs, 76 const bool withLoopback )77 { 78 return vpr::getIfAddrs(hostAddrs, withLoopback );77 const bool withLoopback, const bool withDown) 78 { 79 return vpr::getIfAddrs(hostAddrs, withLoopback, withDown); 79 80 } 80 81 juggler/branches/2.0/modules/vapor/vpr/md/NSPR/IO/Socket/InetAddrNSPR.h
r19215 r19848 122 122 * address (127.0.0.1) in \p hostAddrs. This parameter 123 123 * is optional and defaults to false. 124 * @param withDown A flag indicating whether the address for interfaces 125 * in the down state should be included. This parameter 126 * is optional and defaults to false. 124 127 * 125 128 * @note This method currently supports only IPv4. … … 133 136 static vpr::ReturnStatus 134 137 getAllLocalAddrs(std::vector<vpr::InetAddrNSPR>& hostAddrs, 135 const bool withLoopback = false); 138 const bool withLoopback = false, 139 const bool withDown = false); 136 140 137 141 /** juggler/branches/2.0/modules/vapor/vpr/md/POSIX/IO/Socket/InetAddrBSD.cpp
r19670 r19848 73 73 74 74 vpr::ReturnStatus getIfAddrs(std::vector<vpr::InetAddrBSD>& hostAddrs, 75 const bool withLoopback );75 const bool withLoopback, const bool withDown); 76 76 77 77 const InetAddrBSD InetAddrBSD::AnyAddr; // Default constructor defaults to ANY addr … … 106 106 vpr::ReturnStatus 107 107 InetAddrBSD::getAllLocalAddrs(std::vector<vpr::InetAddrBSD>& hostAddrs, 108 const bool withLoopback )109 { 110 return vpr::getIfAddrs(hostAddrs, withLoopback );108 const bool withLoopback, const bool withDown) 109 { 110 return vpr::getIfAddrs(hostAddrs, withLoopback, withDown); 111 111 } 112 112 juggler/branches/2.0/modules/vapor/vpr/md/POSIX/IO/Socket/InetAddrBSD.h
r18288 r19848 121 121 * address (127.0.0.1) in \p hostAddrs. This parameter 122 122 * is optional and defaults to false. 123 * @param withDown A flag indicating whether the address for interfaces 124 * in the down state should be included. This parameter 125 * is optional and defaults to false. 123 126 * 124 127 * @note This method currently supports only IPv4. … … 132 135 static vpr::ReturnStatus 133 136 getAllLocalAddrs(std::vector<vpr::InetAddrBSD>& hostAddrs, 134 const bool withLoopback = false); 137 const bool withLoopback = false, 138 const bool withDown = false); 135 139 136 140 /** juggler/branches/2.0/modules/vapor/vpr/md/common/InetAddrHelpers.cpp
r18957 r19848 57 57 # else 58 58 # include <sys/ioctl.h> 59 # include <net/if.h>60 59 # endif 61 60 61 # include <net/if.h> 62 62 # include <netinet/in.h> 63 63 # include <arpa/inet.h> … … 93 93 * @param withLoopback A flag indicating whether to include the loopback 94 94 * address (127.0.0.1) in \p hostAddrs. 95 * @param withDown A flag indicating whether the address for interfaces in 96 * the down state should be included. 95 97 * 96 98 * @note This method currently supports only IPv4. … … 101 103 */ 102 104 vpr::ReturnStatus getIfAddrs(std::vector<vpr::InetAddr>& hostAddrs, 103 const bool withLoopback )105 const bool withLoopback, const bool withDown) 104 106 { 105 107 #if defined(VPR_OS_Windows) … … 133 135 // We only handle IPv4 addresses. 134 136 if ( addr_in->sin_family != AF_INET ) 137 { 138 continue; 139 } 140 141 // If the inerface is down and the caller asked to exclude down 142 // interfaces, skip this one. 143 if ( a->ifa_flags & IFF_UP == 0 && ! withDown ) 135 144 { 136 145 continue; … … 334 343 } 335 344 345 #if defined(VPR_OS_Windows) 346 const bool down = if_list[i].iiFlags & IFF_UP == 0; 347 #else 348 // XXX: This call may cause problems. It may not work on Linux. 349 const bool down ifc.ifc_req[i].ifr_flags & IFF_UP == 0; 350 #endif 351 352 // If the inerface is down and the caller asked to exclude down 353 // interfaces, skip this one. 354 if ( down && ! withDown ) 355 { 356 continue; 357 } 358 336 359 // If we have the loopback address and withLoopback is false, then we 337 360 // skip this address.
