Skip to main content

parse_map_response

Function parse_map_response 

Source
pub fn parse_map_response(
    msg: &[u8],
    expected_nonce: &MapNonce,
) -> Result<MapResponse, PcpError>
Expand description

Parse a PCP MAP response, validating version, the MAP-response opcode, the result code, and the echoed nonce.

Response header (24 bytes): [version][opcode|R][reserved][result_code][lifetime:4] [epoch:4][reserved:12]. MAP body (36 bytes): [nonce:12][protocol][reserved:3][internal_port:2] [assigned_ext_port:2][assigned_ext_ip:16].