diff options
author | Tyler Murphy <tylerm@tylerm.dev> | 2023-04-17 22:49:49 -0400 |
---|---|---|
committer | Tyler Murphy <tylerm@tylerm.dev> | 2023-04-17 22:49:49 -0400 |
commit | 7d650d5d9bcba940ae312657d51e366e7401fd6b (patch) | |
tree | d7283c146aaa625920cf85582a2e4099df86759d /src/packet/packet.h | |
download | wig-7d650d5d9bcba940ae312657d51e366e7401fd6b.tar.gz wig-7d650d5d9bcba940ae312657d51e366e7401fd6b.tar.bz2 wig-7d650d5d9bcba940ae312657d51e366e7401fd6b.zip |
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); |