New struct sim_pending_pkt is introduced to hold information on pakets still in
fly. An array of such structures is stored in ppg->arch_data. This array is
written by every send. The insertion is designed to sort automatically the
packets so that the first element of the array after an insertion is always
the first packet that will be received. Function sim_fast_forward_ns is changed
to update also the reception times into this array, so that when you fast
forward, also the pending packets are fast_forwarded.
The main loop works in this way:
- if there are packets to be received check when
- if the first packet to be received is coming before the state machine
timestamps expire, then fast forward till it's time to receive it.
Then receive it and call the state machine of the receiver
- if there are no packet pending or the first pending packet is coming
after a timeout, then fast forward till the timeout expires and
run all the state machines