compress_tree_node Struct Reference

Data structure to help domain name compression in outgoing messages. More...

Data Fields

struct compress_tree_nodeleft
 left node in tree, all smaller to this
 
struct compress_tree_noderight
 right node in tree, all larger than this
 
struct compress_tree_nodeparent
 the parent node - not for tree, but zone parent. More...
 
uint8_t * dname
 the domain name for this node. More...
 
int labs
 number of labels in domain name, kept to help compare func.
 
size_t offset
 offset in packet that points to this dname
 

Detailed Description

Data structure to help domain name compression in outgoing messages.

A tree of dnames and their offsets in the packet is kept. It is kept sorted, not canonical, but by label at least, so that after a lookup of a name you know its closest match, and the parent from that closest match. These are possible compression targets.

It is a binary tree, not a rbtree or balanced tree, as the effort of keeping it balanced probably outweighs usefulness (given typical DNS packet size).

Field Documentation

◆ parent

struct compress_tree_node* compress_tree_node::parent

the parent node - not for tree, but zone parent.

One less label

Referenced by compress_tree_lookup(), compress_tree_newnode(), and compress_tree_store().

◆ dname

uint8_t* compress_tree_node::dname

the domain name for this node.

Pointer to uncompressed memory.

Referenced by compress_any_dname(), compress_tree_lookup(), compress_tree_newnode(), compress_tree_search(), compress_tree_store(), and write_compressed_dname().


The documentation for this struct was generated from the following file: