dnslite
DnsLite is a C library for constructing, dispatching, and parsing DNS messages. It aims to be fully compatible with the standard and cover as many niche elements as possible while still remaining minimally sized and portable to both Windows and Unix-y systems.
Current Roadmap
Intended v1
| Task | Associated Function | Current Status | Unit Test? |
|---|---|---|---|
| RFC 1035 Type Compliance | n/a | Complete | n/a |
| Extended RFCs Compliance | n/a | In Progress | n/a |
| Hostname Translation | dnsl_encode_hostname | Functional | Yes |
| Socket Communication | dnsl_socket_* | In Progress | To-Do |
| DNS Message Creation | dnsl_new_* | In Progress | To-Do |
| DNS Message Composition | dnsl_append_* | In Progress | To-Do |
| Resolver Core | TBD | To-Do | No |
| Resolver Record Caching | TBD | To-Do | To-Do |
| Resolver Reverse DNS | TBD | To-Do | No |
Installation
Building
- Have a suitable C compiler (GCC, MSVC).
- Have CMake v3.12 or newer.
- (Optional) Have Doxygen to build documentation.
mkdir build
cd build
cmake ../
cmake --build . --target install --config Release
Usage
struct dnsl_error *error;
if (dnsl_socket_init(&error) != 0)
{
// Etc.
}
// Should probably be built on thread + don't forget to check for NULL.
dnsl_hostname_ref hostname = dnsl_encode_hostname("git.paterissa.net", &error);
dnsl_msg_ref msg = dnsl_new_query(DNSL_OPCODE_QUERY, true);
dnsl_question_ref question = dnsl_new_question(hostname, DNSL_QUESTION_TYPE_A, DNSL_QUESTION_CLASS_IN, &error);
dnsl_append_question(msg, question);
// Transmit DNS Message TBD...
dnsl_free_msg(msg); // Frees message, question, and hostname
dnsl_socket_fini();
