Fix the event type taking 4 bytes (instead of one) on the network.

It is also the occasion for a little refactoring.
Fix event timestamp being 64 bits (instead of 32).