Class QuicHeaderParser
java.lang.Object
io.netty.handler.codec.quic.QuicHeaderParser
- All Implemented Interfaces:
AutoCloseable
Parses the QUIC packet header and notifies a callback once parsing was successful.
Once the parser is not needed anymore the user needs to call close() to ensure all resources are
released. Failed to do so may lead to memory leaks.
This class can be used for advanced use-cases. Usually you want to just use QuicClientCodecBuilder or
QuicServerCodecBuilder.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCalled when a QUIC packet and its header could be parsed. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidparse(InetSocketAddress sender, InetSocketAddress recipient, ByteBuf packet, QuicHeaderParser.QuicHeaderProcessor callback) Parses a QUIC packet and extract the header values out of it.
-
Constructor Details
-
QuicHeaderParser
public QuicHeaderParser(int localConnectionIdLength)
-
-
Method Details
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
parse
public void parse(InetSocketAddress sender, InetSocketAddress recipient, ByteBuf packet, QuicHeaderParser.QuicHeaderProcessor callback) throws Exception Parses a QUIC packet and extract the header values out of it. This method takes no ownership of the packet itself which means the caller of this method is expected to callReferenceCounted.release()once the packet is not needed anymore.- Parameters:
sender- the sender of the packet. This is directly passed to theQuicHeaderParser.QuicHeaderProcessoronce parsing was successful.recipient- the recipient of the packet.This is directly passed to theQuicHeaderParser.QuicHeaderProcessoronce parsing was successful.packet- raw QUIC packet itself. The ownership of the packet is not transferred. This is directly passed to theQuicHeaderParser.QuicHeaderProcessoronce parsing was successful.callback- theQuicHeaderParser.QuicHeaderProcessorthat is called once a QUIC packet could be parsed and all the header values be extracted.- Throws:
Exception- thrown if we couldn't parse the header or if theQuicHeaderParser.QuicHeaderProcessorthrows an exception.
-