Added parsing and encoding of peer messages.