Simulate multiple data link protocol in C