Logical Neighborhoods: A Programming Abstraction for Wireless Sensor Networks