Package io.netty.handler.codec.quic
Class QuicHeaderParser
- java.lang.Object
-
- io.netty.handler.codec.quic.QuicHeaderParser
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public final class QuicHeaderParser extends java.lang.Object implements java.lang.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
orQuicServerCodecBuilder
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
QuicHeaderParser.QuicHeaderProcessor
Called when a QUIC packet and its header could be parsed.
-
Constructor Summary
Constructors Constructor Description QuicHeaderParser(int localConnectionIdLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
parse(java.net.InetSocketAddress sender, java.net.InetSocketAddress recipient, ByteBuf packet, QuicHeaderParser.QuicHeaderProcessor callback)
Parses a QUIC packet and extract the header values out of it.
-
-
-
Method Detail
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
-
parse
public void parse(java.net.InetSocketAddress sender, java.net.InetSocketAddress recipient, ByteBuf packet, QuicHeaderParser.QuicHeaderProcessor callback) throws java.lang.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.QuicHeaderProcessor
once parsing was successful.recipient
- the recipient of the packet.This is directly passed to theQuicHeaderParser.QuicHeaderProcessor
once parsing was successful.packet
- raw QUIC packet itself. The ownership of the packet is not transferred. This is directly passed to theQuicHeaderParser.QuicHeaderProcessor
once parsing was successful.callback
- theQuicHeaderParser.QuicHeaderProcessor
that is called once a QUIC packet could be parsed and all the header values be extracted.- Throws:
java.lang.Exception
- thrown if we couldn't parse the header or if theQuicHeaderParser.QuicHeaderProcessor
throws an exception.
-
-