TCP: Replace the specific input callback with an abstract type.

This permits the socket and direct backends to drive their input
functions using different signatures.