Analysis and design of reliable and stable link-layer protocols for wireless communication