Skip to main content

parse_hello

Function parse_hello 

Source
pub fn parse_hello(line: &str) -> Result<(StreamKind, String), HelloError>
Expand description

Parses one handshake line, returning the stream kind and session name.

ยงErrors

HelloError::NotHello when the line has no HELLO prefix; HelloError::MissingVersion when there is no version field at all; HelloError::BadVersion when the version field is not a bare non-negative integer; HelloError::UnsupportedVersion when the version is well-formed but not PROTOCOL_VERSION; HelloError::MissingStreamKind when there is no kind field (the old two-field form); HelloError::UnknownStreamKind when the kind is neither tokens nor trace; HelloError::BadName when the name is empty, longer than NAME_MAX, or contains anything but printable non-space ASCII.