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.
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;
}
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);
}
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_ ||
}
AddressCollection addrs = iface->getAddresses();
-
for (AddressCollection::iterator addr = addrs.begin();
addr != addrs.end();
++addr) {
}
sock = openSocket(iface->getName(), *addr, port);
- if (sock<0) {
+ if (sock < 0) {
cout << "Failed to open unicast socket." << endl;
return (false);
}
// 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.");
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
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) &&
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();
/// @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
/// @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
/// @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