pub fn parse_openvpn_tcp(i: &[u8]) -> IResult<&[u8], OpenVPNPacket> {
    let (i, hdr) = parse_openvpn_header_tcp(i)?;
    // length includes header (minus plen field)
    // substract 1 (opcode + key)
    let plen = match hdr.plen {
        Some(plen) if plen >= 2 => plen,
        _ => return Err(Err::Error(make_error(i, ErrorKind::LengthValue))),
    };
    let (i, msg) = map_parser(take(plen - 1), parse_openvpn_msg_payload(hdr.opcode))(i)?;
    Ok((i, OpenVPNPacket { hdr, msg }))
}
/// Parse an OpenVPN packet in TCP
Parse an OpenVPN packet in TCP
Parse an OpenVPN packet in TCP
pub fn parse_openvpn_tcp(i: &[u8]) -> IResult<&[u8], OpenVPNPacket> {
    let (i, hdr) = parse_openvpn_header_tcp(i)?;
    // length includes header (minus plen field)
    // substract 1 (opcode + key)
    let plen = match hdr.plen {
        Some(plen) if plen >= 2 => plen,
        _ => return Err(Err::Error(make_error(i, ErrorKind::LengthValue))),
    };
    let (i, msg) = map_parser(take(plen - 1), parse_openvpn_msg_payload(hdr.opcode))(i)?;
    Ok((i, OpenVPNPacket { hdr, msg }))
}
pub fn parse_openvpn_tcp ( i : & [ u8 ] ) -> IResult < & [ u8 ] , OpenVPNPacket > { let ( i , hdr ) = parse_openvpn_header_tcp ( i ) ? ; // length includes header (minus plen field) // substract 1 (opcode + key) let plen = match hdr . plen { Some ( plen ) if plen >= 2 => plen , _ => return Err ( Err :: Error ( make_error ( i , ErrorKind :: LengthValue ) ) ) , } ; let ( i , msg ) = map_parser ( take ( plen - 1 ) , parse_openvpn_msg_payload ( hdr . opcode ) ) ( i ) ? ; Ok ( ( i , OpenVPNPacket { hdr , msg } ) ) }
Parse an OpenVPN packet in TCP
Parse an OpenVPN packet in TCP
i
&[u8]