Wednesday, June 24, 2009

Another day, another Deadwood snapshot

This morning, while walking to work, I realized that a bailiwick check, while useful for making sure DNS data is in bailiwick, isn't useful for compressing DNS data.

The best way to compress DNS data is to make a list of every place a compression pointer might point to, and comparing every part of a label we will add to the compressed string to every one of those parts.

That in mind, I have added a function, dwc_push_offsets(), that adds the offsets of all parts a compression pointer can point to in a DNS name to a stack of 16-bit values.

I've also made functions more flexible, allowing dwc_in_bailiwick() to be used in contexts where it's not compressing a DNS packet more easily (the "q" string can now be NULL without issue).

It is at the usual place.