diff options
Diffstat (limited to 'src/packet/packet.h')
-rw-r--r-- | src/packet/packet.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/packet/packet.h b/src/packet/packet.h new file mode 100644 index 0000000..12845b9 --- /dev/null +++ b/src/packet/packet.h @@ -0,0 +1,25 @@ +#pragma once + +#include "buffer.h" +#include "question.h" +#include "header.h" +#include "record.h" +#include "../client/addr.h" + +#include <stdbool.h> + +typedef struct { + Header header; + Question* questions; + Record* answers; + Record* authorities; + Record* resources; +} Packet; + +void read_packet(PacketBuffer* buffer, Packet* packet); +void write_packet(PacketBuffer* buffer, Packet* packet); +void free_packet(Packet* packet); + +bool get_random_a(Packet* packet, IpAddr* addr); +bool get_resolved_ns(Packet* packet, uint8_t* qname, IpAddr* addr); +bool get_unresoled_ns(Packet* packet, uint8_t* qname, Question* question); |