Capacity of ad hoc networks