A service-oriented approach to topology formation and resource discovery in wireless ad-hoc networks