implement a generic line protocol handler