From: Stephen Morris Date: Mon, 25 Jun 2012 12:33:41 +0000 (+0100) Subject: [1957] Corrected spaces between operators and a few comments. X-Git-Tag: trac2351_base~188^2^2^2^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=61667bcc9c013ce7d105609404c32cd5d83fa02c;p=thirdparty%2Fkea.git [1957] Corrected spaces between operators and a few comments. --- diff --git a/src/lib/dhcp/iface_mgr.cc b/src/lib/dhcp/iface_mgr.cc index c4f006954b..b57a24f74a 100644 --- a/src/lib/dhcp/iface_mgr.cc +++ b/src/lib/dhcp/iface_mgr.cc @@ -198,7 +198,7 @@ void IfaceMgr::stubDetectIfaces() { iface.flag_up_ = true; iface.flag_running_ = true; - // note that we claim that this is not a loopback. iface_mgr tries to open a + // Note that we claim that this is not a loopback. iface_mgr tries to open a // socket on all interaces that are up, running and not loopback. As this is // the only interface we were able to detect, let's pretend this is a normal // interface. @@ -229,8 +229,8 @@ bool IfaceMgr::openSockets4(const uint16_t port) { int sock; int count = 0; - for (IfaceCollection::iterator iface=ifaces_.begin(); - iface!=ifaces_.end(); + for (IfaceCollection::iterator iface = ifaces_.begin(); + iface != ifaces_.end(); ++iface) { cout << "Trying interface " << iface->getFullName() << endl; @@ -242,18 +242,17 @@ bool IfaceMgr::openSockets4(const uint16_t port) { } AddressCollection addrs = iface->getAddresses(); - - for (AddressCollection::iterator addr= addrs.begin(); + for (AddressCollection::iterator addr = addrs.begin(); addr != addrs.end(); ++addr) { - // skip IPv6 addresses + // Skip IPv6 addresses if (addr->getFamily() != AF_INET) { continue; } sock = openSocket(iface->getName(), *addr, port); - if (sock<0) { + if (sock < 0) { cout << "Failed to open unicast socket." << endl; return (false); } @@ -269,8 +268,8 @@ bool IfaceMgr::openSockets6(const uint16_t port) { int sock; int count = 0; - for (IfaceCollection::iterator iface=ifaces_.begin(); - iface!=ifaces_.end(); + for (IfaceCollection::iterator iface = ifaces_.begin(); + iface != ifaces_.end(); ++iface) { if (iface->flag_loopback_ || @@ -280,7 +279,6 @@ bool IfaceMgr::openSockets6(const uint16_t port) { } AddressCollection addrs = iface->getAddresses(); - for (AddressCollection::iterator addr = addrs.begin(); addr != addrs.end(); ++addr) { @@ -291,7 +289,7 @@ bool IfaceMgr::openSockets6(const uint16_t port) { } sock = openSocket(iface->getName(), *addr, port); - if (sock<0) { + if (sock < 0) { cout << "Failed to open unicast socket." << endl; return (false); } @@ -300,7 +298,7 @@ bool IfaceMgr::openSockets6(const uint16_t port) { // works well on Mac OS (and possibly other BSDs), but does not work // on Linux. if ( !joinMulticast(sock, iface->getName(), - string(ALL_DHCP_RELAY_AGENTS_AND_SERVERS) ) ) { + string(ALL_DHCP_RELAY_AGENTS_AND_SERVERS))) { close(sock); isc_throw(Unexpected, "Failed to join " << ALL_DHCP_RELAY_AGENTS_AND_SERVERS << " multicast group."); @@ -316,7 +314,7 @@ bool IfaceMgr::openSockets6(const uint16_t port) { int sock2 = openSocket(iface->getName(), IOAddress(ALL_DHCP_RELAY_AGENTS_AND_SERVERS), port); - if (sock2<0) { + if (sock2 < 0) { isc_throw(Unexpected, "Failed to open multicast socket on " << " interface " << iface->getFullName()); iface->delSocket(sock); // delete previously opened socket @@ -401,8 +399,8 @@ int IfaceMgr::openSocketFromIface(const std::string& ifname, const uint8_t family) { int sock = 0; // Search for specified interface among detected interfaces. - for (IfaceCollection::iterator iface=ifaces_.begin(); - iface!=ifaces_.end(); + for (IfaceCollection::iterator iface = ifaces_.begin(); + iface != ifaces_.end(); ++iface) { if ((iface->getFullName() != ifname) && @@ -437,8 +435,8 @@ int IfaceMgr::openSocketFromAddress(const IOAddress& addr, int sock = 0; // Search through detected interfaces and addresses to match // local address we got. - for (IfaceCollection::iterator iface=ifaces_.begin(); - iface!=ifaces_.end(); + for (IfaceCollection::iterator iface = ifaces_.begin(); + iface != ifaces_.end(); ++iface) { AddressCollection addrs = iface->getAddresses(); diff --git a/src/lib/dhcp/iface_mgr.h b/src/lib/dhcp/iface_mgr.h index abb064c71a..4517bdfa6e 100644 --- a/src/lib/dhcp/iface_mgr.h +++ b/src/lib/dhcp/iface_mgr.h @@ -378,10 +378,10 @@ public: /// @brief Opens UDP/IP socket and binds it to interface specified. /// - /// This method differs from \ref openSocket such that it allows - /// not to specify local address to which socket will be bound. - /// Instead, method searches through addresses on specified - /// interface and selects one that matches address family. + /// This method differs from \ref openSocket in that it does not require + /// the specification of a local address to which socket will be bound. + /// Instead, the method searches through the addresses on the specified + /// interface and selects one that matches the address family. /// /// @param ifname name of the interface /// @param port UDP port @@ -395,8 +395,8 @@ public: /// @brief Opens UDP/IP socket and binds to address specified /// - /// This methods differs from \ref openSocket such that it allows - /// not to specify interface to which socket will be bound. + /// This methods differs from \ref openSocket in that it does not require + /// the specification of the interface to which the socket will be bound. /// /// @param addr address to be bound /// @param port UDP port @@ -408,10 +408,10 @@ public: /// @brief Opens UDP/IP socket to be used to connect to remote address /// - /// This method identifies local address to be used to connect - /// to remote address specified as argument. - /// Once local address is idetified \ref openSocket is called - /// to open socket and bind it to interface, address and port. + /// This method identifies the local address to be used to connect to the + /// remote address specified as argument. Once the local address is + /// identified, \ref openSocket is called to open a socket and bind it to + /// the interface, address and port. /// /// @param remote_addr remote address to connect to /// @param port UDP port