/// Parse the input for a PDU header, and skip the rest of the pdu body in the input
Parse the input for a PDU header, and skip the rest of the pdu body in the input
Parse the input for a PDU header and skip the rest of the pdu body in the input
pub fn parse_header(input: &[u8]) -> Result<PduHeader, DisError> {
    match pdu_header(input) {
        Ok((input, header)) => {
            let skipped = skip_body(header.pdu_length)(input); // Discard the body
            if let Err(Err::Error(error)) = skipped {
                return if error.code == Eof {
                    Err(DisError::InsufficientPduLength(header.pdu_length as usize - PDU_HEADER_LEN_BYTES, input.len()))
                } else { Err(DisError::ParseError) }
            }
            Ok(header)
        }
        Err(parse_error) => {
            if let Err::Error(error) = parse_error {
                if error.code == Eof {
                    return Err(DisError::InsufficientHeaderLength(input.len()));
                }
            }
            Err(DisError::ParseError)
        }
    }
}
pub fn parse_header ( input : & [ u8 ] ) -> Result < PduHeader , DisError > { match pdu_header ( input ) { Ok ( ( input , header ) ) => { let skipped = skip_body ( header . pdu_length ) ( input ) ; // Discard the body if let Err ( Err :: Error ( error ) ) = skipped { return if error . code == Eof { Err ( DisError :: InsufficientPduLength ( header . pdu_length as usize - PDU_HEADER_LEN_BYTES , input . len ( ) ) ) } else { Err ( DisError :: ParseError ) } } Ok ( header ) } Err ( parse_error ) => { if let Err :: Error ( error ) = parse_error { if error . code == Eof { return Err ( DisError :: InsufficientHeaderLength ( input . len ( ) ) ) ; } } Err ( DisError :: ParseError ) } } }
Parse the input for a PDU header, and skip the rest of the pdu body in the input
Parse the input for a PDU header and skip the rest of the pdu body in the input
input
&[u8]