public final class Asn1Decoder extends Object implements TLVBerDecoderMBean
| Modifier and Type | Field and Description |
|---|---|
private static boolean |
END
This flag is used to indicate that there are no more bytes in the stream
|
private boolean |
indefiniteLengthAllowed
Flag that is used to allow/disallow the indefinite form of Length
|
private static org.slf4j.Logger |
LOG
The logger
|
private int |
maxLengthLength
The maximum number of bytes that could be used to encode the Length
|
private int |
maxTagLength
The maximum number of bytes that could be used to encode the Tag
|
private static boolean |
MORE
This flag is used to indicate that there are more bytes in the stream
|
| Modifier | Constructor and Description |
|---|---|
private |
Asn1Decoder()
A public constructor of an Asn1 Decoder.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
decode(ByteBuffer stream,
Asn1Container container)
The decoder main function.
|
private static void |
dumpTLVTree(Asn1Container container)
Dump the current TLV tree
|
int |
getMaxLengthLength()
Get the actual maximum number of bytes that can be used to encode the
Length
|
int |
getMaxTagLength()
Get the actual maximum number of bytes that can be used to encode the Tag
|
private static String |
getParentLength(TLV tlv)
A debug function used to dump the expected length stack.
|
boolean |
isIndefiniteLengthAllowed()
Tell if indefinite length form could be used for Length
|
private static boolean |
isTLVDecoded(Asn1Container container)
Check if the TLV tree is fully decoded
|
private static void |
treatLengthEndState(Asn1Container container)
The Length is fully decoded.
|
private static boolean |
treatLengthPendingState(ByteBuffer stream,
Asn1Container container)
This function is called when a Length is in the process of being decoded,
but the lack of bytes in the buffer stopped the process.
|
private static boolean |
treatLengthStartState(ByteBuffer stream,
Asn1Container container)
Treat the Length start.
|
private static boolean |
treatTagStartState(ByteBuffer stream,
Asn1Container container)
Treat the start of a TLV.
|
private static boolean |
treatTLVDoneState(ByteBuffer stream,
Asn1Container container)
When the TLV has been fully decoded, we have to execute the associated
action and switch to the next TLV, which will start with a Tag.
|
private static boolean |
treatValuePendingState(ByteBuffer stream,
Asn1Container container)
Treat a pending Value when we get more bytes in the buffer.
|
private static boolean |
treatValueStartState(ByteBuffer stream,
Asn1Container container)
Treat the Value part.
|
private static final org.slf4j.Logger LOG
private static final boolean MORE
private static final boolean END
private boolean indefiniteLengthAllowed
private int maxLengthLength
private int maxTagLength
private static boolean treatTagStartState(ByteBuffer stream, Asn1Container container)
stream - The ByteBuffer containing the PDU to decodecontainer - The container that stores the current state,
the result and other informations.true if there are more bytes to read, false
otherwiseprivate static void dumpTLVTree(Asn1Container container)
container - The containerprivate static boolean isTLVDecoded(Asn1Container container)
container - The containertrue if the TLV has been decodedprivate static boolean treatLengthStartState(ByteBuffer stream, Asn1Container container) throws org.apache.directory.api.asn1.DecoderException
stream - The ByteBuffer containing the PDU to decodecontainer - The container that stores the current state,
the result and other informations.true if there are more bytes to read, false
otherwiseorg.apache.directory.api.asn1.DecoderException - Thrown if anything went wrongprivate static boolean treatLengthPendingState(ByteBuffer stream, Asn1Container container)
stream - The ByteBuffer containing the PDU to decodecontainer - The container that stores the current state,
the result and other informations.true if there are more bytes to read, false
otherwiseprivate static String getParentLength(TLV tlv)
tlv - The current TLV.private static void treatLengthEndState(Asn1Container container) throws org.apache.directory.api.asn1.DecoderException
container - The container that stores the current state,
the result and other informations.org.apache.directory.api.asn1.DecoderException - Thrown if anything went wrongprivate static boolean treatValueStartState(ByteBuffer stream, Asn1Container container)
stream - The ByteBuffer containing the PDU to decodecontainer - The container that stores the current state,
the result and other informations.true if there are more bytes to read, false
otherwiseprivate static boolean treatValuePendingState(ByteBuffer stream, Asn1Container container)
stream - The ByteBuffer containing the PDU to decodecontainer - The container that stores the current state,
the result and other informations.MORE if some bytes remain in the buffer when the
value has been decoded, END if whe still need to get some
more bytes.private static boolean treatTLVDoneState(ByteBuffer stream, Asn1Container container) throws org.apache.directory.api.asn1.DecoderException
stream - The ByteBuffer containing the PDU to decodecontainer - The container that stores the current state,
the result and other informations.true if there are more bytes to read, false
otherwiseorg.apache.directory.api.asn1.DecoderException - Thrown if anything went wrongpublic static void decode(ByteBuffer stream, Asn1Container container) throws org.apache.directory.api.asn1.DecoderException
stream - The ByteBuffer containing the PDU to decodecontainer - The container that store the state, the result
and other elements.org.apache.directory.api.asn1.DecoderException - Thrown if anything went wrong!public int getMaxLengthLength()
getMaxLengthLength in interface TLVBerDecoderMBeanpublic int getMaxTagLength()
getMaxTagLength in interface TLVBerDecoderMBeanpublic boolean isIndefiniteLengthAllowed()
isIndefiniteLengthAllowed in interface TLVBerDecoderMBeantrue if the Indefinite form is allowedCopyright © 2003–2019 The Apache Software Foundation. All rights reserved.