RRtypes can have values 0-65535. To cover all possible types with the
existing branch node size we need four bytes to store the RRtype value,
one escape character and three to cover all possible values.
This means maximum qpkey length would become (256+2) + 4 = 516 bytes
(one more is byte is accounted for the closing SHIFT_NOBYTE).
A SHIFT_RRTYPE is added as RRtype indicator and a SHIFT_NOBYTE followed
by a SHIFT_RRTYPE means the domain name part of the key is read. What
must follow is three more bytes that encapsulate the RRtype.
This means key lenghts when converting a name are always 5 bytes long
(keylen 4).
In the dns_qp_lookup function there are subtle changes to when the
chain needs to be updated. Instead of two following NOBYTE bytes, a
shorter key in the trie is detected if there is a RRTYPE byte twig
in the branch (indicating the end of the name part), and the
preceding byte is a NOBYTE byte (label separator).
Since more than one byte follows, representing the RRtypes, there can
be multiple leaf nodes below the twig. In fact, the twig can be a
branch now too, so instead of requiring the twig to be a leaf, take
any leaf from the given branch. All should have the same name, so
any leaf node will do to retrieve the parent domain.
In the test code the following changes are required:
- random_byte() takes a random byte that represents a character in a
domain name. For now we need to skip over the RRTYPE byte so if that
is randomly picked, we need to try again.
- When creating a key from a domain name we now need to append the
RRtype in the mock functions too.
- All key related tests need to encapsulate the expected RRtype.