parse

Parse a decoded KRPC envelope node into a typed DhtMessage, or null if the message is malformed (not a dict, missing/!string t or y, unknown y, missing payload, or a 20-byte-id violation).

This is the read side of what verifyMessage guards on the wire: it does the same dict_find/length checks libtorrent does in incoming_request and the various *_observer::reply handlers, but rather than dispatching side effects it returns the structured message. Unknown query names parse into a Query with Args.Ping semantics only if they truly carry no recognised payload; otherwise an unrecognised query yields null so the caller can answer with incoming_error("unknown message").