A Cross-layer Framework for Network-wide Adaptations and Optimizations in Mobile Ad Hoc Networks