Resource Allocation in Ad Hoc Networks