encoder: avoid recursive encoding
decoder: rename protocol function
encoder: rename protocol function