/* BEGIN FUNCTION DEFINITION */ void Router::disconnect( Host& h) { // check that they are connected if ( is_connected_host( &h ) ) { h.setParent( NULL ); delete_host_entry( h.getAddress() ); remove_from_connected_hosts( &h ); } else cout << "Host " << h.getAddress() << " is not directly connected to Router " << address << " so this disconnection is forbidden!\n" << endl; }
/* BEGIN FUNCTION DEFINITION */ void Router::connectTo( Host& h ) { if ( h.getParent() == NULL ) //check for unconnected host { h.setParent(this); connected_hosts.push_back(&h); add_host_to_rTable( h.getAddress() ); } else cout << "Unable to connect Host " << h.getAddress() << " to Router " << address << ". Host " << h.getAddress() << " is " << ((h.getParent()->getAddress()==address)?"already ":"") << "connected to Router " << h.getParent()->getAddress() << ".\n" << endl; }