Factor out common base class for packetized input and output.