internal/proto: Implement functions for reading and parsing