unbound 0.1
compress_tree_node Struct Reference

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

Data Fields

struct compress_tree_node * left
 left node in tree, all smaller to this
struct compress_tree_node * right
 right node in tree, all larger than this
struct compress_tree_node * parent
 the parent node - not for tree, but zone parent.
uint8_t * dname
 the domain name for this node.
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

◆ left

struct compress_tree_node* compress_tree_node::left

left node in tree, all smaller to this

Referenced by compress_tree_newnode(), and compress_tree_search().

◆ right

struct compress_tree_node* compress_tree_node::right

right node in tree, all larger than this

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

◆ 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().

◆ labs

int compress_tree_node::labs

◆ offset

size_t compress_tree_node::offset

offset in packet that points to this dname

Referenced by compress_owner(), compress_tree_newnode(), compress_tree_store(), and write_compressed_dname().


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