A Software Architecture For Cross-Layer Wireless Networks