implement ROS_IP=localhost behavior for roscpp, and for outbound rospy connections

The wiki doc for ROS_IP:  http://wiki.ros.org/ROS/EnvironmentVariables    says that setting ROS_IP=localhost will "prevent remote components from being able to talk to your local component." This can be useful in some settings. However, this behavior was previously only implemented for inbound rospy topic connections and services. This pull request implements it for inbound and outbound roscpp connections, and for outbound rospy connections.
It seems wasteful to redo this lookup logic on every attempted connect.  Perhaps somewhere else, during initialization, we can build up the list of host/address strings that we're willing to match, then here we just match against that list.  

Same for the UDP case below.