Design and analysis of MAC protocols for wireless networks