Convert all our protocol lengths to uint32_t.

This makes the protocol compatible between 32/64 bit
and locks down all our sizes. Internally we still use
size_t everywhere so caution must be used with esp.
memcpy - avoid using this and use casts instead.